Skip to content

Commit

Permalink
[java-intentions] WrapWithAdapterMethodCallFix: do not fail on incons…
Browse files Browse the repository at this point in the history
…istent hierarchy

This might happen when result of getAllMethods() returns methods of unresolved classes, probably due to reindexing/dumb mode?
Fixes IDEA-363881 'superClassSubstitutor requested when derived doesn't extend super' at com.intellij.codeInsight.daemon.impl.quickfix.WrapWithAdapterMethodCallFix$InstanceMethodFixer

GitOrigin-RevId: ba3e97a4984d11f08b3d041617ce89c2e69f4b49
  • Loading branch information
amaembo authored and intellij-monorepo-bot committed Dec 6, 2024
1 parent 0025dd5 commit 74904a8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ private static PsiMethod findOnlyMethod(@Nullable PsiType inType, @NotNull PsiTy
if (type instanceof PsiClassType) {
PsiClass containingClass = method.getContainingClass();
if (containingClass == null) return false;
type = TypeConversionUtil.getSuperClassSubstitutor(containingClass, (PsiClassType)inType).substitute(type);
var substitutor = TypeConversionUtil.getMaybeSuperClassSubstitutor(containingClass, psiClass, result.getSubstitutor());
if (substitutor != null) {
type = substitutor.substitute(type);
}
}
return outType.isAssignableFrom(type);
})).orElse(null);
Expand Down

0 comments on commit 74904a8

Please sign in to comment.