private static void addPermitsClause(@NotNull Project project, PsiClass aClass, List<String> nonNullNames) {
    String permitsClause = StreamEx.of(nonNullNames).sorted().joining(",", "permits ", "");
    PsiReferenceList permitsList = createPermitsClause(project, permitsClause);
    PsiReferenceList implementsList = Objects.requireNonNull(aClass.getImplementsList());
    aClass.addAfter(permitsList, implementsList);
  }
private static void addPermitsClause(@NotNull Project project, PsiClass aClass, List<String> nonNullNames)