@@ -76,7 +76,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
76
76
77
77
// Constructor Injected Test
78
78
if (parametersMethodName != null && constructorParams != null && constructorParams .stream ().anyMatch (org .openrewrite .java .tree .J .VariableDeclarations .class ::isInstance )) {
79
- doAfterVisit (new ParameterizedRunnerToParameterizedTestsVisitor (classDecl , parametersMethodName , initMethodName , parametersAnnotationArguments , constructorParams , true , beforeMethodName ,ctx ));
79
+ doAfterVisit (new ParameterizedRunnerToParameterizedTestsVisitor (classDecl , parametersMethodName , initMethodName , parametersAnnotationArguments , constructorParams , true , beforeMethodName , ctx ));
80
80
}
81
81
82
82
// Field Injected Test
@@ -290,7 +290,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
290
290
if (statement instanceof J .VariableDeclarations ) {
291
291
J .VariableDeclarations varDecls = (J .VariableDeclarations ) statement ;
292
292
if (varDecls .getVariables ().stream ().anyMatch (it -> fieldNames .contains (it .getSimpleName ())) &&
293
- (varDecls .hasModifier (J .Modifier .Type .Final ))) {
293
+ (varDecls .hasModifier (J .Modifier .Type .Final ))) {
294
294
varDecls = varDecls .withModifiers (ListUtils .map (varDecls .getModifiers (), mod -> mod .getType () == J .Modifier .Type .Final ? null : mod ));
295
295
statement = maybeAutoFormat (statement , varDecls , ctx , new Cursor (getCursor (), finalBody ));
296
296
}
@@ -383,15 +383,10 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
383
383
getCursor ().dropParentUntil (J .ClassDeclaration .class ::isInstance ).putMessage ("INIT_VARS" , fieldNames );
384
384
385
385
// Remove any potential super call
386
- m = m .withBody (m .getBody ().withStatements (ListUtils .mapFirst (m .getBody ().getStatements (), stmt -> {
387
- if (stmt instanceof J .MethodInvocation ) {
388
- J .MethodInvocation mi = (J .MethodInvocation ) stmt ;
389
- if (mi .getName ().getSimpleName ().equals ("super" )) {
390
- return null ;
391
- }
392
- }
393
- return stmt ;
394
- })));
386
+ m = m .withBody (m .getBody ().withStatements (ListUtils .mapFirst (m .getBody ().getStatements (),
387
+ stmt -> stmt instanceof J .MethodInvocation &&
388
+ "super" .equals (((J .MethodInvocation ) stmt ).getSimpleName ()) ?
389
+ null : stmt )));
395
390
}
396
391
}
397
392
return m ;
0 commit comments