public static boolean isInheritorDeep(@NotNull PsiClass candidateClass,
                                        @NotNull PsiClass baseClass,
                                        final @Nullable PsiClass classToByPass) {
    if (baseClass instanceof PsiAnonymousClass) {
      return false;
    }

    PsiManager manager = candidateClass.getManager();
    Set<PsiClass> checkedClasses = null;
    if (classToByPass != null) {
      checkedClasses = new ObjectOpenCustomHashSet<>(new PsiClass[]{classToByPass}, new Hash.Strategy<PsiClass>() {
        @Override
        public int hashCode(@Nullable PsiClass o) {
          return o == null ? 0 : ObjectUtils.notNull(o.getName(), o.getContainingFile().getName()).hashCode();
        }

        @Override
        public boolean equals(@Nullable PsiClass a, @Nullable PsiClass b) {
          return manager.areElementsEquivalent(a, b);
        }
      });
    }
    
    return isInheritor(manager, candidateClass, baseClass, true, checkedClasses);
  }
public static boolean isInheritorDeep(@NotNull PsiClass candidateClass,
                                        @NotNull PsiClass baseClass,
                                        final @Nullable PsiClass classToByPass)