private static boolean subClassExtendsClass(@Nullable PsiClass subClass,
                                              @NotNull PsiClass psiClass,
                                              @NotNull List<PsiClass> sealedClasses) {
    if (subClass == null) return false;
    if (subClass.hasModifierProperty(PsiModifier.SEALED)) {
      sealedClasses.add(subClass);
      return false;
    }
    //DON'T use `hasModifierProperty(PsiModifier.NON_SEALED)`, because compiled classes don't have this modifier
    return !subClass.hasModifierProperty(PsiModifier.FINAL) ||
           InheritanceUtil.isInheritorOrSelf(subClass, psiClass, true);
  }
private static boolean subClassExtendsClass(@Nullable PsiClass subClass,
                                              @NotNull PsiClass psiClass,
                                              @NotNull List<PsiClass> sealedClasses)