diff --git a/migration/src/main/java/io/javaoperatorsdk/operator/migration/RemoveMethodDeclaration.java b/migration/src/main/java/io/javaoperatorsdk/operator/migration/RemoveMethodDeclaration.java
index 33841d5acc..62151f469f 100644
--- a/migration/src/main/java/io/javaoperatorsdk/operator/migration/RemoveMethodDeclaration.java
+++ b/migration/src/main/java/io/javaoperatorsdk/operator/migration/RemoveMethodDeclaration.java
@@ -59,13 +59,13 @@ public J.ClassDeclaration visitClassDeclaration(
J.ClassDeclaration classDecl, ExecutionContext ctx) {
J.ClassDeclaration cd = super.visitClassDeclaration(classDecl, ctx);
- if (cd.getType() == null || !typeMatchesOrImplements(cd.getType())) {
+ JavaType.FullyQualified type = cd.getType();
+ if (type == null || !typeMatchesOrImplements(type)) {
return cd;
}
// Mutate the type info in place to remove the method from the declared methods list,
// so all AST nodes sharing this type reference stay consistent.
- var type = cd.getType();
if (type instanceof JavaType.Class classType) {
var updatedMethods =
classType.getMethods().stream().filter(m -> !m.getName().equals(methodName)).toList();
@@ -90,11 +90,16 @@ public J.MethodDeclaration visitMethodDeclaration(
}
J.ClassDeclaration classDecl = getCursor().firstEnclosing(J.ClassDeclaration.class);
- if (classDecl == null || classDecl.getType() == null) {
+ if (classDecl == null) {
return super.visitMethodDeclaration(method, ctx);
}
- if (typeMatchesOrImplements(classDecl.getType())) {
+ JavaType.FullyQualified type = classDecl.getType();
+ if (type == null) {
+ return super.visitMethodDeclaration(method, ctx);
+ }
+
+ if (typeMatchesOrImplements(type)) {
//noinspection DataFlowIssue
return null;
}
diff --git a/pom.xml b/pom.xml
index e1e6bdd299..db4c23c394 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,7 +103,7 @@
10.0.0
3.5.1
3.8.0
- 4.9.8.3
+ 4.10.2.0