@@ -72,12 +72,12 @@ private TestsNotPublicVisitor(Boolean orProtected) {
7272 }
7373
7474 @ Override
75- public ClassDeclaration visitClassDeclaration (ClassDeclaration classDecl , ExecutionContext ctx ) {
76- ClassDeclaration c = super .visitClassDeclaration (classDecl , ctx );
75+ public J . ClassDeclaration visitClassDeclaration (J . ClassDeclaration classDecl , ExecutionContext ctx ) {
76+ J . ClassDeclaration c = super .visitClassDeclaration (classDecl , ctx );
7777
78- if (c .getKind () != ClassDeclaration .Kind .Type .Interface
78+ if (c .getKind () != J . ClassDeclaration .Kind .Type .Interface
7979 && c .getModifiers ().stream ().anyMatch (mod -> mod .getType () == J .Modifier .Type .Public )
80- && c .getModifiers ().stream ().noneMatch (mod -> mod .getType () == Type .Abstract )) {
80+ && c .getModifiers ().stream ().noneMatch (mod -> mod .getType () == J . Modifier . Type .Abstract )) {
8181
8282 boolean hasTestMethods = c .getBody ().getStatements ().stream ()
8383 .filter (org .openrewrite .java .tree .J .MethodDeclaration .class ::isInstance )
@@ -98,7 +98,7 @@ public ClassDeclaration visitClassDeclaration(ClassDeclaration classDecl, Execut
9898 if (hasTestMethods && !hasPublicNonTestMethods && !hasPublicVariableDeclarations ) {
9999 // Remove public modifier and move associated comment
100100 final List <Comment > modifierComments = new ArrayList <>();
101- List <Modifier > modifiers = ListUtils .map (c .getModifiers (), mod -> {
101+ List <J . Modifier > modifiers = ListUtils .map (c .getModifiers (), mod -> {
102102 if (mod .getType () == J .Modifier .Type .Public ) {
103103 modifierComments .addAll (mod .getComments ());
104104 return null ;
@@ -131,7 +131,7 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
131131 return m ;
132132 }
133133
134- if (m .getModifiers ().stream ().anyMatch (mod -> (mod .getType () == J .Modifier .Type .Public || (orProtected && mod .getType () == Type .Protected )))
134+ if (m .getModifiers ().stream ().anyMatch (mod -> (mod .getType () == J .Modifier .Type .Public || (orProtected && mod .getType () == J . Modifier . Type .Protected )))
135135 && Boolean .FALSE .equals (TypeUtils .isOverride (method .getMethodType ()))
136136 && hasJUnit5MethodAnnotation (m )) {
137137 // remove public modifier
@@ -141,7 +141,7 @@ && hasJUnit5MethodAnnotation(m)) {
141141 return m ;
142142 }
143143
144- private boolean hasJUnit5MethodAnnotation (MethodDeclaration method ) {
144+ private boolean hasJUnit5MethodAnnotation (J . MethodDeclaration method ) {
145145 for (J .Annotation a : method .getLeadingAnnotations ()) {
146146 if (TypeUtils .isOfClassType (a .getType (), "org.junit.jupiter.api.Test" )
147147 || TypeUtils .isOfClassType (a .getType (), "org.junit.jupiter.api.RepeatedTest" )
0 commit comments