boolean (PsiJavaCodeReferenceElement referenceElement, PsiClass qualifyingClass) { final String referenceName = referenceElement.getReferenceName(); if (referenceName == null) { return false; } PsiClass containingClass = ClassUtils.getContainingClass(referenceElement); while (containingClass != null) { final PsiMethod[] methods = containingClass.findMethodsByName(referenceName, true); for (final PsiMethod method : methods) { final String name = method.getName(); if (referenceName.equals(name)) { return containingClass.equals(qualifyingClass); } } containingClass = ClassUtils.getContainingClass(containingClass); } return false; }