Set<LookupElement> (CompletionParameters parameters, PsiJavaCodeReferenceElement qualifier, ElementFilter filter) { String referenceName = qualifier.getReferenceName(); if (referenceName == null) { return Collections.emptySet(); } PrefixMatcher qMatcher = new CamelHumpMatcher(referenceName); Set<LookupElement> plainVariants = JavaSmartCompletionContributor.completeReference(qualifier, qualifier, filter, true, true, parameters, qMatcher); Project project = qualifier.getProject(); PsiResolveHelper helper = JavaPsiFacade.getInstance(project).getResolveHelper(); for (PsiClass aClass : PsiShortNamesCache.getInstance(project).getClassesByName(referenceName, qualifier.getResolveScope())) { if (helper.isAccessible(aClass, qualifier, null)) { plainVariants.add(JavaClassNameCompletionContributor.createClassLookupItem(aClass, true)); } } if (!plainVariants.isEmpty()) { return plainVariants; } final Set<LookupElement> allClasses = new LinkedHashSet<>(); PsiElement qualifierName = qualifier.getReferenceNameElement(); if (qualifierName != null) { JavaClassNameCompletionContributor.addAllClasses(parameters.withPosition(qualifierName, qualifierName.getTextRange().getEndOffset()), true, qMatcher, new CollectConsumer<>(allClasses)); } return allClasses; }