Skip to content

Commit 4590205

Browse files
authored
Fix NPE in ChangeSdkType (#5342)
1 parent 8aa665c commit 4590205

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

migration-tool/src/main/java/software/amazon/awssdk/migration/recipe/ChangeSdkType.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ private void storeV1ClassMetadata(String currentFqcn) {
343343

344344
@Override
345345
public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx) {
346+
if (method.getMethodType() == null) {
347+
return method;
348+
}
349+
346350
JavaType.FullyQualified declaringType = method.getMethodType().getDeclaringType();
347351
if (isV1Class(declaringType)) {
348352
String fullyQualifiedName = declaringType.getFullyQualifiedName();
@@ -351,7 +355,7 @@ public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx)
351355
Pair<JavaType.Class, JavaType> oldTypeToNewTypePair = oldTypeToNewType.get(fullyQualifiedName);
352356
JavaType.Class originalType = oldTypeToNewTypePair.left();
353357
JavaType targetType = oldTypeToNewTypePair.right();
354-
if (method.getMethodType() != null && method.getMethodType().hasFlags(Flag.Static)) {
358+
if (method.getMethodType().hasFlags(Flag.Static)) {
355359
if (method.getMethodType().getDeclaringType().isAssignableFrom(originalType)) {
356360
JavaSourceFile cu = getCursor().firstEnclosingOrThrow(JavaSourceFile.class);
357361

0 commit comments

Comments
 (0)