@Override
  @Nullable
  public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
    final List<PsiClass> classes = myCache.getClassesByFQName(qualifiedName, scope, true);
    if (classes.isEmpty()) return null;
    if (classes.size() == 1) return classes.get(0);
    return Collections.min(classes, PsiClassUtil
      .createScopeComparator(scope)
      .thenComparing(c -> c.getQualifiedName(), Comparator.nullsLast(Comparator.naturalOrder()))
      .thenComparing(c -> {
        PsiFile file = c.getContainingFile();
        return file instanceof GroovyFileBase ? ((GroovyFileBase)file).getPackageName() : "";
      }));
  }
@Override
  @Nullable
  public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope)