private static boolean hasOnlySameFileInheritors(PsiClass psiClass) {
    if (!psiClass.hasModifierProperty(PsiModifier.SEALED) || psiClass.getPermitsList() != null) return false;
    Ref<Boolean> hasInheritors = Ref.create(false);
    boolean hasOnlySameFileInheritors = DirectClassInheritorsSearch.search(psiClass).forEach((Processor<? super PsiClass>) inheritor -> {
      if (inheritor.getContainingFile() != psiClass.getContainingFile()) {
        return false;
      }
      hasInheritors.set(true);
      return true;
    });
    return hasOnlySameFileInheritors && hasInheritors.get();
  }
private static boolean hasOnlySameFileInheritors(PsiClass psiClass)