private static void setForGeneratedSources(@NotNull SourceFolder folder, boolean generated) {
    JpsModuleSourceRoot jpsElement = folder.getJpsElement();
    JpsElement properties = jpsElement.getProperties(jpsElement.getRootType());
    if (properties instanceof JavaSourceRootProperties p) {
      p.setForGeneratedSources(generated);
    }
    else if (properties instanceof JavaResourceRootProperties p) {
      p.setForGeneratedSources(generated);
    }
  }
private static void setForGeneratedSources(@NotNull SourceFolder folder, boolean generated)