LookupElement (@Nullable PsiReference position, @Nullable PsiClass origClass) { PsiVariable var = getObject(); if (var instanceof PsiField && !willBeImported() && shouldQualify((PsiField)var, position)) { boolean isInstanceField = !var.hasModifierProperty(PsiModifier.STATIC); PsiClass aClass = ((PsiField)var).getContainingClass(); if (aClass != null && origClass != null && !JavaResolveUtil.isAccessible(aClass, aClass.getContainingClass(), aClass.getModifierList(), position.getElement(), null, null) && JavaResolveUtil.isAccessible(origClass, origClass.getContainingClass(), origClass.getModifierList(), position.getElement(), null, null) && var.isEquivalentTo(origClass.findFieldByName(var.getName(), true))) { aClass = origClass; } String className = aClass == null ? null : aClass.getName(); if (className != null) { String infix = isInstanceField ? ".this." : "."; myQualifierClass = aClass; myForcedQualifier = className + infix; for (String s : JavaCompletionUtil.getAllLookupStrings(aClass)) { setLookupString(s + infix + var.getName()); } if (isInstanceField) { return PrioritizedLookupElement.withExplicitProximity(this, -1); } } } return this; }