boolean (@NotNull PsiJavaCodeReferenceElement reference, @NotNull PsiMember member) { final String referenceName = reference.getReferenceName(); if (referenceName == null) { return false; } final Project project = reference.getProject(); final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); final PsiResolveHelper resolveHelper = psiFacade.getResolveHelper(); PsiElement newTarget = null; if (member instanceof PsiMethod) { final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)reference.getParent().copy(); final PsiElement qualifier = methodCallExpression.getMethodExpression().getQualifier(); assert qualifier != null; qualifier.delete(); newTarget = methodCallExpression.resolveMethod(); } else if (member instanceof PsiField) { newTarget = resolveHelper.resolveAccessibleReferencedVariable(referenceName, reference); } else if (member instanceof PsiClass) { newTarget = resolveHelper.resolveReferencedClass(referenceName, reference); } return member.equals(newTarget); }