private static @NotNull ModCommand getMissingInheritors(@NotNull PsiJavaFile psiJavaFile,
                                                          @NotNull PsiClass psiClass,
                                                          @NotNull Set<PsiClass> permittedClasses) {
    Collection<String> missingInheritors = new SmartList<>();
    PsiJavaModule module = JavaModuleGraphUtil.findDescriptorByElement(psiClass);
    for (PsiClass inheritor : DirectClassInheritorsSearch.search(psiClass)) {
      String errorTitle = SealedUtils.checkInheritor(psiJavaFile, module, inheritor);
      if (errorTitle != null) {
        return ModCommand.error(JavaBundle.message(errorTitle));
      }
      String qualifiedName = Objects.requireNonNull(inheritor.getQualifiedName());
      if (!ContainerUtil.exists(permittedClasses, cls -> cls.isEquivalentTo(inheritor))) missingInheritors.add(qualifiedName);
    }

    if (missingInheritors.isEmpty()) {
      String message = JavaBundle.message("inspection.fill.permits.list.no.missing.inheritors");
      return ModCommand.error(message);
    }
    return ModCommand.psiUpdate(psiClass, cls -> SealedUtils.fillPermitsList(cls, missingInheritors));
  }
private static @NotNull ModCommand getMissingInheritors(@NotNull PsiJavaFile psiJavaFile,
                                                          @NotNull PsiClass psiClass,
                                                          @NotNull Set<PsiClass> permittedClasses)