Set<LookupElement> (@NotNull PsiElement element, @NotNull PsiJavaCodeReferenceElement javaReference, @NotNull ElementFilter elementFilter, @NotNull JavaCompletionProcessor.Options options, @NotNull Condition<? super String> nameCondition, @NotNull CompletionParameters parameters) { Set<LookupElement> set = new LinkedHashSet<>(); JavaCompletionProcessor processor = new JavaCompletionProcessor(element, elementFilter, options, nameCondition); PsiType plainQualifier = processor.getQualifierType(); List<PsiType> runtimeQualifiers = getQualifierCastTypes(javaReference, parameters); if (!runtimeQualifiers.isEmpty()) { PsiType[] conjuncts = JBIterable.of(plainQualifier).append(runtimeQualifiers).toArray(PsiType.EMPTY_ARRAY); PsiType composite = PsiIntersectionType.createIntersection(false, conjuncts); PsiElement ctx = createContextWithXxxVariable(element, composite); javaReference = createReference("xxx.xxx", ctx); processor.setQualifierType(composite); } javaReference.processVariants(processor); List<PsiTypeLookupItem> castItems = ContainerUtil.map(runtimeQualifiers, q -> PsiTypeLookupItem.createLookupItem(q, element)); boolean pkgContext = inSomePackage(element); PsiClass qualifierClass = PsiUtil.resolveClassInClassTypeOnly(plainQualifier); boolean honorExcludes = qualifierClass == null || !isInExcludedPackage(qualifierClass, false); Set<PsiType> expectedTypes = ObjectUtils.coalesce(getExpectedTypes(parameters), Collections.emptySet()); Set<PsiMember> mentioned = new HashSet<>(); JavaLookupElementHighlighter highlighter = getHighlighterForPlace(element); for (CompletionElement completionElement : processor.getResults()) { for (LookupElement item : createLookupElements(completionElement, javaReference)) { item.putUserData(QUALIFIER_TYPE_ATTR, plainQualifier); Object o = item.getObject(); if (o instanceof PsiClass) { PsiClass specifiedQualifierClass = javaReference.isQualified() ? qualifierClass : ((PsiClass)o).getContainingClass(); if (!isSourceLevelAccessible(element, (PsiClass)o, pkgContext, specifiedQualifierClass)) { continue; } } if (o instanceof PsiMember) { if (honorExcludes && isInExcludedPackage((PsiMember)o, true)) { continue; } mentioned.add(CompletionUtil.getOriginalOrSelf((PsiMember)o)); } PsiTypeLookupItem qualifierCast = findQualifierCast(item, castItems, plainQualifier, processor, expectedTypes); if (qualifierCast != null) item = castQualifier(item, qualifierCast); set.add(highlighter.highlightIfNeeded(qualifierCast != null ? qualifierCast.getType() : plainQualifier, item, o)); } } PsiElement refQualifier = javaReference.getQualifier(); if (refQualifier == null && PsiTreeUtil.getParentOfType(element, PsiPackageStatement.class, PsiImportStatementBase.class) == null) { StaticMemberProcessor memberProcessor = new JavaStaticMemberProcessor(parameters); memberProcessor.processMembersOfRegisteredClasses(nameCondition, (member, psiClass) -> { if (!mentioned.contains(member) && processor.satisfies(member, ResolveState.initial())) { ContainerUtil.addIfNotNull(set, memberProcessor.createLookupElement(member, psiClass, true)); } }); } else if (refQualifier instanceof PsiSuperExpression && ((PsiSuperExpression)refQualifier).getQualifier() == null) { set.addAll(SuperCalls.suggestQualifyingSuperCalls(element, javaReference, elementFilter, options, nameCondition)); } return set; }