mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java completion: correct overriding resolution check (IDEA-CR-21402)
This commit is contained in:
+4
-5
@@ -97,15 +97,14 @@ public class CompletionElement{
|
||||
Object anotherElement = another.getElement();
|
||||
if (!(anotherElement instanceof PsiMethod && myElement instanceof PsiMethod)) return false;
|
||||
|
||||
if (isInterfaceMethod((PsiMethod)myElement) && !isInterfaceMethod((PsiMethod)anotherElement)) return false;
|
||||
if (((PsiMethod)myElement).hasModifierProperty(PsiModifier.ABSTRACT) &&
|
||||
!((PsiMethod)anotherElement).hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiType prevType = another.getSubstitutor().substitute(((PsiMethod)anotherElement).getReturnType());
|
||||
PsiType candidateType = mySubstitutor.substitute(((PsiMethod)myElement).getReturnType());
|
||||
return prevType != null && candidateType != null && !prevType.equals(candidateType) && prevType.isAssignableFrom(candidateType);
|
||||
}
|
||||
|
||||
private static boolean isInterfaceMethod(PsiMethod anotherElement) {
|
||||
PsiClass aClass = anotherElement.getContainingClass();
|
||||
return aClass != null && aClass.isInterface();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user