boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (element instanceof PsiPackage && !isQualifiedContext()) { if (myScope instanceof PsiClass) { return true; } if (((PsiPackage)element).getQualifiedName().contains(".") && PsiTreeUtil.getParentOfType(myElement, PsiImportStatementBase.class) != null) { return true; } } if (element instanceof PsiClass && seemsInternal((PsiClass) element)) { return true; } if (element instanceof PsiMember && !PsiNameHelper.getInstance(element.getProject()).isIdentifier(((PsiMember)element).getName())) { // The member could be defined in another JVM language where its name is not a legal name in Java. // In this case, just skip such the member. We cannot legally reference it from Java source. return true; } if (element instanceof PsiMethod method && PsiTypesUtil.isGetClass(method) && PsiUtil.isLanguageLevel5OrHigher(myElement)) { PsiType patchedType = PsiTypesUtil.createJavaLangClassType(myElement, myQualifierType, false); if (patchedType != null) { element = new LightMethodBuilder(element.getManager(), method.getName()). addModifier(PsiModifier.PUBLIC). setMethodReturnType(patchedType). setContainingClass(method.getContainingClass()); } } if (element instanceof PsiVariable) { String name = ((PsiVariable)element).getName(); if (myShadowedNames.contains(name)) return true; if (myQualified || PsiUtil.isJvmLocalVariable(element)) { myShadowedNames.add(name); } } if (element instanceof PsiMethod) { myCurrentScopeMethodNames.add(((PsiMethod)element).getName()); } if (!satisfies(element, state) || !isAccessible(element)) return true; StaticProblem sp = myElement.getParent() instanceof PsiMethodReferenceExpression ? StaticProblem.none : getStaticProblem(element); if (sp == StaticProblem.instanceAfterStatic) return true; CompletionElement completion = new CompletionElement( element, state.get(PsiSubstitutor.KEY), getCallQualifierText(element), getMethodReferenceType(element)); CompletionElement prev = myResults.get(completion); if (prev == null || completion.isMoreSpecificThan(prev)) { myResults.put(completion, completion); if (sp == StaticProblem.staticAfterInstance) { mySecondRateResults.add(completion); } } if (!(element instanceof PsiClass psiClass) || !PATTERNS_IN_SWITCH.isAvailable(myElement)) return true; if (psiClass.hasModifierProperty(PsiModifier.SEALED)) { addSealedHierarchy(state, psiClass); } return true; }