void () { getSettings(JavaLanguage.INSTANCE).PARAMETER_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS; getSettings(JavaLanguage.INSTANCE).VARIABLE_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS; doTextTest(""" class Foo { public void foo(@Ann1 @Ann2 int p1, @Ann3 boolean p1){} }""", """ class Foo { public void foo( @Ann1 @Ann2 int p1, @Ann3 boolean p1) { } }"""); doTextTest(""" public interface PsiClass{ @Nullable(documentation = "return null for anonymous and local classes, and for type parameters", doc2="") String getQualifiedName(); }""", """ public interface PsiClass { @Nullable(documentation = "return null for anonymous and local classes, and for type parameters", doc2 = "") String getQualifiedName(); }"""); getSettings(JavaLanguage.INSTANCE).CLASS_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS; doTextTest("@Ann1 @Ann2 class Foo {}", """ @Ann1 @Ann2 class Foo { }"""); doTextTest("@Ann1 @Ann2 interface Foo {}", """ @Ann1 @Ann2 interface Foo { }"""); doTextTest("class Foo { @Ann1 @Ann2 public static int myField;}", """ class Foo { @Ann1 @Ann2 public static int myField; }"""); doTextTest(""" class Foo { void foo() { @Ann1 @Ann2 final int i = 0; } }""", """ class Foo { void foo() { @Ann1 @Ann2 final int i = 0; } }"""); getCustomJavaSettings().ANNOTATION_PARAMETER_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED; getSettings(JavaLanguage.INSTANCE).CLASS_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED; getSettings(JavaLanguage.INSTANCE).RIGHT_MARGIN = 40; doTextTest("@Annotation1 @Annotation2 @Annotation3(param1=\"value1\", param2=\"value2\") @Annotation4 class Foo {}", """ @Annotation1 @Annotation2 @Annotation3(param1 = "value1", param2 = "value2") @Annotation4 class Foo { }"""); }