diff --git a/java-api/src/java9/java/xyz/wagyourtail/jvmdg/j9/stub/java_base/J_L_M_ModuleDescriptor.java b/java-api/src/java9/java/xyz/wagyourtail/jvmdg/j9/stub/java_base/J_L_M_ModuleDescriptor.java index 78dd70c..367d900 100644 --- a/java-api/src/java9/java/xyz/wagyourtail/jvmdg/j9/stub/java_base/J_L_M_ModuleDescriptor.java +++ b/java-api/src/java9/java/xyz/wagyourtail/jvmdg/j9/stub/java_base/J_L_M_ModuleDescriptor.java @@ -239,6 +239,26 @@ public String toString() { return sb.toString(); } + public static Builder newModule(String name, Set ms) { + Set mods = new HashSet<>(ms); + if (mods.contains(Modifier.AUTOMATIC) && mods.size() > 1) { + throw new IllegalArgumentException("AUTOMATIC cannot be used with other modifiers"); + } + return new Builder(name, true, mods); + } + + public static Builder newModule(String name) { + return new Builder(name, true, Collections.emptySet()); + } + + public static Builder newOpenModule(String name) { + return new Builder(name, true, Collections.singleton(Modifier.OPEN)); + } + + public static Builder newAutomaticModule(String name) { + return new Builder(name, true, Collections.singleton(Modifier.AUTOMATIC)); + } + @Adapter("java/lang/module/ModuleDescriptor$Modifier") public enum Modifier { OPEN, AUTOMATIC, SYNTHETIC, MANDATED