public static void processJavaClasses(final @NotNull CompletionParameters parameters,
                                        final @NotNull PrefixMatcher prefixMatcher,
                                        final boolean filterByScope,
                                        final @NotNull Consumer<? super PsiClass> consumer) {
    final PsiElement context = parameters.getPosition();
    final Project project = context.getProject();
    final GlobalSearchScope scope = filterByScope ? context.getContainingFile().getResolveScope() : GlobalSearchScope.allScope(project);

    processJavaClasses(prefixMatcher, project, scope, new LimitedAccessibleClassPreprocessor(parameters, filterByScope, c->{consumer.consume(c); return true;}));
  }
public static void processJavaClasses(final @NotNull CompletionParameters parameters,
                                        final @NotNull PrefixMatcher prefixMatcher,
                                        final boolean filterByScope,
                                        final @NotNull Consumer<? super PsiClass> consumer)