boolean (@NotNull PsiElement pe, @NotNull ResolveState state) { if (pe instanceof PsiVariable) { if (!usedNames.add(((PsiVariable)pe).getName())) { return false; } //exclude variables that are initialized in 'place' final PsiExpression initializer = ((PsiVariable)pe).getInitializer(); if (initializer != null && PsiTreeUtil.isAncestor(initializer, myPlace, false)) return true; } return pe instanceof PsiField && !PsiUtil.isAccessible((PsiField)pe, myPlace, null) || super.execute(pe, state); }