Skip to content

Commit

Permalink
Pass correct cursor in visitNonNull() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Feb 20, 2024
1 parent 9ab5f86 commit a13c87c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit a13c87c

Please sign in to comment.