void (final Consumer<? super LookupElement> results, @Nullable final PsiClass where, final boolean acceptMethods, final boolean searchInheritors) { if (where == null || isPrimitiveClass(where)) return; String qualifiedName = where.getQualifiedName(); final boolean searchFactoryMethods = searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(qualifiedName) && !isPrimitiveClass(where); final Project project = myPlace.getProject(); final GlobalSearchScope scope = myPlace.getResolveScope(); final PsiClassType baseType = JavaPsiFacade.getElementFactory(project).createType(where); Consumer<PsiType> consumer = psiType -> { PsiClass psiClass = PsiUtil.resolveClassInType(psiType); if (psiClass == null) { return; } psiClass = CompletionUtil.getOriginalOrSelf(psiClass); if (mayProcessMembers(psiClass)) { final FilterScopeProcessor<PsiElement> declProcessor = new FilterScopeProcessor<>(TrueFilter.INSTANCE); psiClass.processDeclarations(declProcessor, ResolveState.initial(), null, myPlace); doProcessMembers(acceptMethods, results, psiType == baseType, psiClass, declProcessor.getResults()); String name = psiClass.getName(); if (name != null && searchFactoryMethods) { Collection<PsiMember> factoryMethods = JavaStaticMemberTypeIndex.getInstance().getStaticMembers(name, project, scope); doProcessMembers(acceptMethods, results, false, psiClass, factoryMethods); } } }; consumer.consume(baseType); if (searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(qualifiedName)) { CodeInsightUtil.processSubTypes(baseType, myPlace, true, PrefixMatcher.ALWAYS_TRUE, consumer); } else if (qualifiedName != null) { // If we don't search inheritors, we still process some known very common ones StreamEx.ofTree(qualifiedName, cls -> StreamEx.of(COMMON_INHERITORS.getOrDefault(cls, List.of()))).skip(1) .map(className -> JavaPsiFacade.getElementFactory(project).createTypeByFQClassName(className, myPlace.getResolveScope())) .forEach(consumer::consume); } }