void (@NotNull GrReferenceExpression referenceExpression) { if (myHaveInstanceRefs) return; if (PsiUtil.isSuperReference(referenceExpression)) { registerInstanceRef(); return; } if (PsiUtil.isThisReference(referenceExpression)) { if (!(referenceExpression.getParent() instanceof GrReferenceExpression)) {//if we have reference parent -- check it instead of this ref registerInstanceRef(); } return; } GrExpression qualifier = referenceExpression.getQualifierExpression(); if (qualifier == null || PsiUtil.isThisOrSuperRef(qualifier)) { GroovyResolveResult result = referenceExpression.advancedResolve(); PsiElement element = result.getElement(); if (isPrintOrPrintln(element)) return; PsiElement resolveContext = result.getCurrentFileResolveContext(); if (qualifier == null && resolveContext != null) return; if (element instanceof PsiClass && ((PsiClass)element).getContainingClass() == null) return; if (element instanceof PsiMember && !((PsiMember)element).hasModifierProperty(PsiModifier.STATIC)) { registerInstanceRef(); } if (element == null) { registerInstanceRef(); } } else { super.visitReferenceExpression(referenceExpression); } }