void (@NotNull PsiJavaCodeReferenceElement expression) { PsiElement qualifierExpression; if (!isParameterizedReference(expression) && !(expression instanceof PsiMethodReferenceExpression) && !(expression.getParent() instanceof PsiErrorElement) && (qualifierExpression = expression.getQualifier()) instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)qualifierExpression).isReferenceTo(aClass)) { try { JavaResolveResult[] resolved = expression.multiResolve(false); int end = expression.getTextRange().getEndOffset(); qualifierExpression.delete(); PsiElement firstChild = expression.getFirstChild(); if (firstChild instanceof PsiJavaToken && ((PsiJavaToken)firstChild).getTokenType() == JavaTokenType.DOT) { firstChild.delete(); } delta += end - expression.getTextRange().getEndOffset(); JavaResolveResult[] resolvedAfter = expression.multiResolve(false); if (resolvesToSame(manager, resolved, resolvedAfter)) { int offset = expression.getTextRange().getStartOffset() + delta; PsiJavaCodeReferenceElement originalExpression = PsiTreeUtil.findElementOfClassAtOffset(root, offset, PsiJavaCodeReferenceElement.class, false); if (originalExpression != null) { PsiElement originalQualifier = originalExpression.getQualifier(); if (originalQualifier instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)originalQualifier).isReferenceTo(aClass)) { expressionsToDequalify.add(originalExpression); } } } else { conflict.set(true); } } catch (IncorrectOperationException e) { LOG.error(e); } } super.visitReferenceElement(expression); }