PsiMethod (PsiElement element, PsiMethod member) { final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class, false); if ( containingMethod != null && !containingMethod.hasModifierProperty(PsiModifier.STATIC) && !containingMethod.isConstructor() && containingMethod.findDeepestSuperMethods().length == 0 && !containingMethod.equals(member) && OverridingMethodsSearch.search(containingMethod).findFirst() == null) { final PsiClass containingClass = containingMethod.getContainingClass(); if (containingClass != null) { if (ClassUtil.isTopLevelClass(containingClass) || containingClass.hasModifierProperty(PsiModifier.STATIC)) { final InternalUsageInfo[] refsInMember = MakeStaticUtil.findClassRefsInMember(containingMethod, true); for (InternalUsageInfo info : refsInMember) { final PsiElement referencedElement = info.getReferencedElement(); if (!member.equals(referencedElement) && !containingMethod.equals(referencedElement)) { return null; } } return containingMethod; } } } return null; }