Incorrect indentation level in parameter list of nested record class
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 28
### What happened
Pressing Enter after a parameter in the parameter list of a nested record class indents the next line incorrectly, as if the record class was one nesting level higher than it actuall is.
### Language / Project Type / NetBeans Component
Java, Editor
### How to reproduce
Example:
```java
class Example
{
class Nested
{
private record ExampleRecord(
ProcessHandle processHandle, ThreadGroup threadGroup)
{
// ...
}
}
}
```
Pressing Enter after the comma results in:
```java
class Example
{
class Nested
{
private record ExampleRecord(
ProcessHandle processHandle,
ThreadGroup threadGroup)
{
// ...
}
}
}
```
Whereas the expected result would be:
```java
class Example
{
class Nested
{
record ExampleRecord(
ProcessHandle processHandle,
ThreadGroup threadGroup)
{
// ...
}
}
}
```
The `Nested` class is just to illustrate that the resulting indentation level is exactly 1 level too high. The incorrect behavior also happens with one nesting level less.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows
### JDK
JDK 21
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
The generated indentation is correct when the record class is a top-level class. It's only for nested record classes that the indentation level is wrong.
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Reproduce the indentation problem in the NetBeans Java Editor using the nested record example on Windows with JDK 21. Compare pressing Enter after the comma in nested and top-level record parameter lists, then trace the editor indentation handling for Java records. Done means nested record parameters align with the existing parameter indentation without changing the correct top-level behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100