Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting Java record fields similar to classes with Intellij IDEA

I have the following code:

record FooBar(@NotNull String foo, @NotNull Integer bar) {
}

I'd like Intellij IDEA to format it to:

record FooBar(

    @NotNull 
    String foo, 

    @NotNull 
    Integer bar

) {
}

Is this possible?

The closest I was able to get is:

record FooBar(
    @NotNull String foo, 
    @NotNull Integer bar
) {
}

which is not ideal as number of annotations can vary.

The options I used to get to this result are

Record components   Wrap always
Align when multiline    true
New line after '('  true
Place ')' on new line   true
like image 489
Lovro Pandžić Avatar asked Oct 27 '25 12:10

Lovro Pandžić


1 Answers

Currently this doesn't seem to be supported - I've opened a ticket on JetBrains issue tracker.

like image 98
Lovro Pandžić Avatar answered Oct 29 '25 01:10

Lovro Pandžić