langtools/test/tools/lib/toolbox/ModuleBuilder.java
changeset 44807 47e09e3f1829
parent 44684 6ce4d52084e8
--- a/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Mon Apr 17 17:03:19 2017 -0700
+++ b/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Tue Apr 18 06:29:53 2017 -0700
@@ -45,6 +45,7 @@
     private String comment = "";
     private List<String> requires = new ArrayList<>();
     private List<String> exports = new ArrayList<>();
+    private List<String> opens = new ArrayList<>();
     private List<String> uses = new ArrayList<>();
     private List<String> provides = new ArrayList<>();
     private List<String> content = new ArrayList<>();
@@ -134,33 +135,6 @@
     }
 
     /**
-     * Adds an unqualified "exports dynamic" directive to the declaration.
-     * @param pkg the name of the package to be exported
-     * @return this builder
-     */
-    public ModuleBuilder exportsDynamic(String pkg) {
-        return addDirective(exports, "exports dynamic " + pkg + ";");
-    }
-
-    /**
-     * Adds an unqualified "exports private" directive to the declaration.
-     * @param pkg the name of the package to be exported
-     * @return this builder
-     */
-    public ModuleBuilder exportsPrivate(String pkg) {
-        return addDirective(exports, "exports private " + pkg + ";");
-    }
-
-    /**
-     * Adds an unqualified "exports dynamic private" directive to the declaration.
-     * @param pkg the name of the package to be exported
-     * @return this builder
-     */
-    public ModuleBuilder exportsDynamicPrivate(String pkg) {
-        return addDirective(exports, "exports dynamic private " + pkg + ";");
-    }
-
-    /**
      * Adds a qualified "exports" directive to the declaration.
      * @param pkg the name of the package to be exported
      * @param module the name of the module to which it is to be exported
@@ -171,33 +145,22 @@
     }
 
     /**
-     * Adds a qualified "exports dynamic" directive to the declaration.
-     * @param pkg the name of the package to be exported
-     * @param module the name of the module to which it is to be exported
+     * Adds an unqualified "opens" directive to the declaration.
+     * @param pkg the name of the package to be opened
      * @return this builder
      */
-    public ModuleBuilder exportsDynamicTo(String pkg, String module) {
-        return addDirective(exports, "exports dynamic " + pkg + " to " + module + ";");
+    public ModuleBuilder opens(String pkg) {
+        return addDirective(opens, "opens " + pkg + ";");
     }
 
     /**
-     * Adds a qualified "exports private" directive to the declaration.
-     * @param pkg the name of the package to be exported
-     * @param module the name of the module to which it is to be exported
+     * Adds a qualified "opens" directive to the declaration.
+     * @param pkg the name of the package to be opened
+     * @param module the name of the module to which it is to be opened
      * @return this builder
      */
-    public ModuleBuilder exportsPrivateTo(String pkg, String module) {
-        return addDirective(exports, "exports private " + pkg + " to " + module + ";");
-    }
-
-    /**
-     * Adds a qualified "exports dynamic private" directive to the declaration.
-     * @param pkg the name of the package to be exported
-     * @param module the name of the module to which it is to be exported
-     * @return this builder
-     */
-    public ModuleBuilder exportsDynamicPrivateTo(String pkg, String module) {
-        return addDirective(exports, "exports dynamic private " + pkg + " to " + module + ";");
+    public ModuleBuilder opensTo(String pkg, String module) {
+        return addDirective(opens, "opens " + pkg + " to " + module + ";");
     }
 
     /**
@@ -254,6 +217,7 @@
         sb.append("module ").append(name).append(" {\n");
         requires.forEach(r -> sb.append("    " + r + "\n"));
         exports.forEach(e -> sb.append("    " + e + "\n"));
+        opens.forEach(o -> sb.append("    " + o + "\n"));
         uses.forEach(u -> sb.append("    " + u + "\n"));
         provides.forEach(p -> sb.append("    " + p + "\n"));
         sb.append("}");