void (GrReferenceExpression referenceExpression, GrExpression qualifier, String referenceName) { if (!context.isInAnonymousContext() && qualifier != null) { qualifier.accept(this); builder.append('.'); builder.append(referenceName); } else if (GenerationUtil.getWrappingImplicitClass(referenceExpression) != null) { final PsiClass contextClass; if ("this".equals(referenceName)) { final PsiElement _contextClass = referenceExpression.resolve(); if (_contextClass instanceof PsiClass) { contextClass = (PsiClass)_contextClass; } else { contextClass = null; } GenerationUtil.writeThisReference(contextClass, builder, context); } else { //super ref //super ref is used without qualifier. So we should use context class as a qualifier contextClass = PsiUtil.getContextClass(referenceExpression); GenerationUtil.writeSuperReference(contextClass, builder, context); } } else { builder.append(referenceName); } }