boolean (final PsiElement resolveResult1, final PsiElement resolveResult2, PsiElement qualifier2) { if (Comparing.equal(resolveResult1, resolveResult2)) return true; if (resolveResult1 instanceof PsiMethod method1 && resolveResult2 instanceof PsiMethod method2) { if (method1.hasModifierProperty(PsiModifier.STATIC)) return false; // static methods don't inherit if (ArrayUtil.find(method1.findSuperMethods(), method2) >= 0) return true; if (ArrayUtil.find(method2.findSuperMethods(), method1) >= 0) return true; if (method1.getName().equals(method2.getName())) { PsiClass class2 = method2.getContainingClass(); if (qualifier2 instanceof PsiReferenceExpression) { final PsiType type = ((PsiReferenceExpression)qualifier2).getType(); if (type instanceof PsiClassType){ final PsiClass resolvedClass = PsiUtil.resolveClassInType(type); if (!(resolvedClass instanceof PsiTypeParameter)) { class2 = resolvedClass; } } } if (class2 != null && PsiUtil.isAccessible(method1, class2, null)) { final PsiMethod[] methods = class2.getAllMethods(); if (ArrayUtil.find(methods, method1) != -1) return true; } } } return false; }