@Override
  public PsiClass @NotNull [] findClassByShortName(@NotNull String name, final @NotNull GlobalSearchScope scope) {
    PsiClass[] allClasses = getCachedClassesByName(name, scope);
    if (allClasses.length == 0) return allClasses;
    if (allClasses.length == 1) {
      return PsiSearchScopeUtil.isInScope(scope, allClasses[0]) ? allClasses.clone() : PsiClass.EMPTY_ARRAY;
    }
    return StreamEx.of(allClasses)
      .filter(aClass -> PsiSearchScopeUtil.isInScope(scope, aClass) && aClass.getContainingClass() == null)
      .sorted(PsiClassUtil
                .createScopeComparator(scope)
                .thenComparing(c -> c.getQualifiedName(), Comparator.nullsLast(Comparator.naturalOrder()))
                .thenComparing(c -> {
                  PsiFile file = c.getContainingFile();
                  return file instanceof PsiClassOwner ? ((PsiClassOwner)file).getPackageName() : "";
                }))
      .toArray(PsiClass.EMPTY_ARRAY);
  }
@Override
  public PsiClass @NotNull [] findClassByShortName(@NotNull String name, final @NotNull GlobalSearchScope scope)