Skip to content

Commit

Permalink
Pass correct cursor in visitNonNull() calls (#495)
Browse files Browse the repository at this point in the history
* Pass correct cursor in `visitNonNull()` calls

* Fix compile error in `DowngradeServletApiWhenUsingJetty`

* Fix two compiler warnings

* Revert "Fix compile error in `DowngradeServletApiWhenUsingJetty`"

This reverts commit 5548109.
  • Loading branch information
knutwannheden authored Feb 20, 2024
1 parent 9ab5f86 commit 9deb572
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 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 @@ -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 {
Expand All @@ -90,7 +90,7 @@ public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext ct
.build()
.<J.Annotation>apply(getCursor(),
anno.getCoordinates().replaceArguments(),
buildTwoStringsArray(str)).getArguments().get(0);
(Object[]) buildTwoStringsArray(str)).getArguments().get(0);
}
}
}
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 9deb572

Please sign in to comment.