@Nullable
  private static PsiClass getCircularClass(@NotNull PsiClass aClass, @NotNull Collection<? super PsiClass> usedClasses) {
    if (usedClasses.contains(aClass)) {
      return aClass;
    }
    try {
      usedClasses.add(aClass);
      PsiClassType[] superTypes = aClass.getSuperTypes();
      for (PsiClassType superType : superTypes) {
        PsiClass circularClass = getCircularClassInner(superType.resolve(), usedClasses);
        if (circularClass != null) return circularClass;
        for (PsiAnnotation annotation : superType.getAnnotations()) {
          circularClass = getCircularClassInner(annotation.resolveAnnotationType(), usedClasses);
          if (circularClass != null) return circularClass;
        }
      }
    }
    finally {
      usedClasses.remove(aClass);
    }
    return null;
  }
@Nullable
  private static PsiClass getCircularClass(@NotNull PsiClass aClass, @NotNull Collection<? super PsiClass> usedClasses)