homberghp opened a new issue, #7043:
URL: https://github.com/apache/netbeans/issues/7043
### Apache NetBeans version
Apache NetBeans 20
### What happened
when you have a record, say
```
record Student( String id, String lastname, String firstname, LocalDate dob
) implements Serializable, Wither<Student, StudentBuilder> {
@Override
public StudentBuilder with() {
return new StudentBuilder(this);
}
}
```
and you press reformat, then the resulting code looks like this:
```
record Student( String id, String lastname, String firstname, LocalDate dob)
implements Serializable, Wither<Student, StudentBuilder> {
@Override
public StudentBuilder with() {
return new StudentBuilder( this );
}
} // indented wrongly
```
with the last brace at the wrong place.
This happens if I set spaces within method declaration in the
Options > editor> formatting> spaces > checkbox "method declarations", see
below.
I like my code spacious so both in method declaration and calls, because I
consider readability paramount.

### Language / Project Type / NetBeans Component
java editor
### How to reproduce
turn on within parenthesis> Method Declaration and reformat with the well
know shortcut or menu.
Shortcut is <alt-shift-F> on my machine.

### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Linux Ubunto 22.04 LTS
### JDK
all since 14
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
The problem is always, repeatably reproducible.
If I had a clue how this reformating is implemented I might be able to write
a pull request.
For me the reformat tries to be too smart, and considers the code in the
record before the first parenthesis as a method declaration too (which it is
more or less) and becomes confused when it finds a method declaration before
the opening brace of a class, in this case a record.
I would be fine to put spaces inside all pairs of <>, (), [], {}, but that
might not be to everyone's taste.
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists