diff --git a/src/main/java/org/openrewrite/java/spring/batch/ReplaceSupportClassWithItsInterface.java b/src/main/java/org/openrewrite/java/spring/batch/ReplaceSupportClassWithItsInterface.java index 72a209acc..325ab2456 100644 --- a/src/main/java/org/openrewrite/java/spring/batch/ReplaceSupportClassWithItsInterface.java +++ b/src/main/java/org/openrewrite/java/spring/batch/ReplaceSupportClassWithItsInterface.java @@ -84,7 +84,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, getCursor(), cd.getCoordinates().addImplementsClause() ); - cd = (J.ClassDeclaration) new RemoveSuperStatementVisitor().visitNonNull(cd, ctx, getCursor()); + cd = (J.ClassDeclaration) new RemoveSuperStatementVisitor().visitNonNull(cd, ctx, getCursor().getParentOrThrow()); maybeRemoveImport(fullyQualifiedClassName); maybeAddImport(fullyQualifiedInterfaceName); } diff --git a/src/main/java/org/openrewrite/java/spring/boot2/ReplaceExtendWithAndContextConfiguration.java b/src/main/java/org/openrewrite/java/spring/boot2/ReplaceExtendWithAndContextConfiguration.java index f6c8959d5..142e8d300 100644 --- a/src/main/java/org/openrewrite/java/spring/boot2/ReplaceExtendWithAndContextConfiguration.java +++ b/src/main/java/org/openrewrite/java/spring/boot2/ReplaceExtendWithAndContextConfiguration.java @@ -90,7 +90,7 @@ public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext ct maybeRemoveImport(FQN_CONTEXT_CONFIGURATION); maybeAddImport(FQN_SPRING_JUNIT_CONFIG); a = (J.Annotation) new ChangeType(FQN_CONTEXT_CONFIGURATION, FQN_SPRING_JUNIT_CONFIG, false) - .getVisitor().visitNonNull(a, ctx, getCursor()); + .getVisitor().visitNonNull(a, ctx, getCursor().getParentOrThrow()); a = autoFormat(a, ctx); } diff --git a/src/main/java/org/openrewrite/java/spring/boot3/AddRouteTrailingSlash.java b/src/main/java/org/openrewrite/java/spring/boot3/AddRouteTrailingSlash.java index eabe9c6a3..e7388f8f9 100644 --- a/src/main/java/org/openrewrite/java/spring/boot3/AddRouteTrailingSlash.java +++ b/src/main/java/org/openrewrite/java/spring/boot3/AddRouteTrailingSlash.java @@ -71,7 +71,7 @@ public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext ct .build() .apply(getCursor(), anno.getCoordinates().replaceArguments(), - buildTwoStringsArray(str)); + (Object[]) buildTwoStringsArray(str)); return autoFormat(replacement, ctx); } } else { @@ -90,7 +90,7 @@ public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext ct .build() .apply(getCursor(), anno.getCoordinates().replaceArguments(), - buildTwoStringsArray(str)).getArguments().get(0); + (Object[]) buildTwoStringsArray(str)).getArguments().get(0); } } } diff --git a/src/main/java/org/openrewrite/java/spring/framework/MigrateWebMvcConfigurerAdapter.java b/src/main/java/org/openrewrite/java/spring/framework/MigrateWebMvcConfigurerAdapter.java index 107d68549..d3d0a0412 100644 --- a/src/main/java/org/openrewrite/java/spring/framework/MigrateWebMvcConfigurerAdapter.java +++ b/src/main/java/org/openrewrite/java/spring/framework/MigrateWebMvcConfigurerAdapter.java @@ -63,7 +63,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex .classpathFromResources(ctx, "spring-webmvc-5.*")) .build().apply(getCursor(), cd.getCoordinates().addImplementsClause()); updateCursor(cd); - cd = (J.ClassDeclaration) new RemoveSuperStatementVisitor().visitNonNull(cd, ctx, getCursor()); + cd = (J.ClassDeclaration) new RemoveSuperStatementVisitor().visitNonNull(cd, ctx, getCursor().getParentOrThrow()); maybeRemoveImport("org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter"); maybeAddImport("org.springframework.web.servlet.config.annotation.WebMvcConfigurer"); }