File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter
spring-javaformat-formatter-tests/src/test/resources Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1
1
package example;
2
2
3
+ import org.jspecify.annotations.NonNull;
3
4
import org.jspecify.annotations.Nullable;
4
5
import org.jspecify.annotations.NullMarked;
5
6
import org.jspecify.annotations.NullUnmarked;
@@ -34,4 +35,16 @@ public interface ExampleNullables {
34
35
@NullUnmarked
35
36
void withNullUnmarked(String str);
36
37
38
+ static class Fields {
39
+
40
+ @Nullable Object one;
41
+
42
+ @NonNull Object two;
43
+
44
+ private @Nullable Object three;
45
+
46
+ private @NonNull Object four;
47
+
48
+ }
49
+
37
50
}
Original file line number Diff line number Diff line change 1
1
package example;
2
2
3
+ import org.jspecify.annotations.NonNull;
3
4
import org.jspecify.annotations.Nullable;
4
5
import org.jspecify.annotations.NullMarked;
5
6
import org.jspecify.annotations.NullUnmarked;
@@ -32,4 +33,16 @@ public interface ExampleNullables {
32
33
@NullUnmarked
33
34
void withNullUnmarked(String str);
34
35
36
+ static class Fields {
37
+
38
+ @Nullable Object one;
39
+
40
+ @NonNull Object two;
41
+
42
+ private @Nullable Object three;
43
+
44
+ private @NonNull Object four;
45
+
46
+ }
47
+
35
48
}
Original file line number Diff line number Diff line change 29
29
import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .ASTVisitor ;
30
30
import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .Annotation ;
31
31
import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .CompilationUnit ;
32
+ import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .FieldDeclaration ;
32
33
import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .IExtendedModifier ;
33
34
import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .ImportDeclaration ;
34
35
import io .spring .javaformat .eclipse .jdt .jdk17 .core .dom .MethodDeclaration ;
@@ -85,6 +86,12 @@ public boolean visit(ImportDeclaration node) {
85
86
return super .visit (node );
86
87
}
87
88
89
+ @ Override
90
+ public boolean visit (FieldDeclaration node ) {
91
+ clearLineBreaksIfHasJSpecifyAnnotation (node .modifiers ());
92
+ return super .visit (node );
93
+ }
94
+
88
95
@ Override
89
96
public boolean visit (MethodDeclaration node ) {
90
97
clearLineBreaksIfHasJSpecifyAnnotation (node .modifiers ());
Original file line number Diff line number Diff line change 29
29
import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .ASTVisitor ;
30
30
import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .Annotation ;
31
31
import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .CompilationUnit ;
32
+ import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .FieldDeclaration ;
32
33
import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .IExtendedModifier ;
33
34
import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .ImportDeclaration ;
34
35
import io .spring .javaformat .eclipse .jdt .jdk8 .core .dom .MethodDeclaration ;
@@ -85,6 +86,12 @@ public boolean visit(ImportDeclaration node) {
85
86
return super .visit (node );
86
87
}
87
88
89
+ @ Override
90
+ public boolean visit (FieldDeclaration node ) {
91
+ clearLineBreaksIfHasJSpecifyAnnotation (node .modifiers ());
92
+ return super .visit (node );
93
+ }
94
+
88
95
@ Override
89
96
public boolean visit (MethodDeclaration node ) {
90
97
clearLineBreaksIfHasJSpecifyAnnotation (node .modifiers ());
You can’t perform that action at this time.
0 commit comments