boolean (@NotNull PsiField field, @Nullable PsiReference context) { if ((context instanceof PsiReferenceExpression && !((PsiReferenceExpression)context).isQualified()) || (context instanceof PsiJavaCodeReferenceElement && !((PsiJavaCodeReferenceElement)context).isQualified())) { PsiElement element = context.getElement(); if (isEnumInSwitch(field, element)) return false; PsiVariable target = JavaPsiFacade.getInstance(element.getProject()).getResolveHelper() .resolveReferencedVariable(field.getName(), (PsiElement)context); return !field.getManager().areElementsEquivalent(target, field) && !field.getManager().areElementsEquivalent(target, CompletionUtil.getOriginalOrSelf(field)); } return false; }