void (@NotNull GrReferenceExpression ref, @NotNull PsiField field) { GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(ref.getProject()); GrExpression qualifier = ref.getQualifier(); if (qualifier == null) { PsiClass parentClass = PsiTreeUtil.getParentOfType(ref, PsiClass.class); PsiClass containingClass = findContainingClass(ref, field); GrReferenceExpression thisRef = !ref.getManager().areElementsEquivalent(parentClass, containingClass) ? factory.createThisExpression(containingClass) : factory.createThisExpression(null); ref.setQualifier(thisRef); } ref.getNode().addLeaf(GroovyTokenTypes.mAT, "@", ref.getDotToken().getNode().getTreeNext()); }