boolean (@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { PsiMethod superMethod = (PsiMethod)startElement; PsiMethod method = methodPtr.getElement(); if (method == null || !method.isValid()) return false; JavaPsiFacade facade = JavaPsiFacade.getInstance(project); PsiClass containingClass = method.getContainingClass(); PsiClass superContainingClass = superMethod.getContainingClass(); if (containingClass == null || superContainingClass == null) return false; if (!facade.getResolveHelper().isAccessible(superMethod, containingClass, null)) return false; MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY); PsiSubstitutor superSubstitutor = JavaClassSupers.getInstance() .getSuperClassSubstitutor(superContainingClass, containingClass, containingClass.getResolveScope(), PsiSubstitutor.EMPTY); if (superSubstitutor == null) return false; MethodSignature superSignature = superMethod.getSignature(superSubstitutor); if (method.getParameterList().getParametersCount() != superMethod.getParameterList().getParametersCount()) return false; return !signature.equals(superSignature) && MethodSignatureUtil.areSignaturesErasureEqual(signature, superSignature); }