public static void fillPermitsList(@NotNull PsiClass psiClass, @NotNull Collection<String> missingInheritors) {
    PsiReferenceList permitsList = psiClass.getPermitsList();
    PsiFileFactory factory = PsiFileFactory.getInstance(psiClass.getProject());
    if (permitsList == null) {
      PsiReferenceList implementsList = Objects.requireNonNull(psiClass.getImplementsList());
      String permitsClause = StreamEx.of(missingInheritors).sorted().joining(",", "permits ", "");
      psiClass.addAfter(createPermitsClause(factory, permitsClause), implementsList);
    }
    else {
      Stream<String> curClasses = Arrays.stream(permitsList.getReferenceElements()).map(PsiJavaCodeReferenceElement::getQualifiedName);
      String permitsClause = StreamEx.of(missingInheritors).append(curClasses).sorted().joining(",", "permits ", "");
      permitsList.replace(createPermitsClause(factory, permitsClause));
    }
  }
public static void fillPermitsList(@NotNull PsiClass psiClass, @NotNull Collection<String> missingInheritors)