Need a blank line between fields if annotations are on separate lines?

Basically, I need different styles depending on the number of annotations, for example.

class Foo { @Autowire private MyService myService; @Autowire private MyOtherService service; ... } 

but if I have more annotations, space is required

 @Entity class Bar { @Id @NotNull @Column(...) private Long id; @NotNull @NotEmpty @Column(...) private String description; } 

Is it possible to force IDEA to format Java for these two styles?

+5
source share
1 answer

In the Editor> Code Style> Java> Wrapper and Braces section, specify the Wrap Always fields annotations and check the Do not wrap after separate annotations box.

Graphic

enter image description here

-2
source

Source: https://habr.com/ru/post/1206581/


All Articles