changeset 19351:b657b9585c94

More clean-up of internal API to change modules
author alanb
date Sun, 19 Mar 2017 12:14:58 +0000
parents c9294b00cc92
children 69bb5be60882
files src/java.base/share/classes/java/lang/reflect/Module.java src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java src/java.base/share/classes/jdk/internal/module/Modules.java
diffstat 3 files changed, 43 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/reflect/Module.java	Sun Mar 19 11:58:46 2017 +0000
+++ b/src/java.base/share/classes/java/lang/reflect/Module.java	Sun Mar 19 12:14:58 2017 +0000
@@ -1555,14 +1555,18 @@
                     m.implAddExportsOrOpens(pn, other, false, true);
                 }
                 @Override
+                public void addExportsToAllUnnamed(Module m, String pn) {
+                    m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, false, true);
+                }
+                @Override
+                public void addOpens(Module m, String pn) {
+                    m.implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, true, true);
+                }
+                @Override
                 public void addOpens(Module m, String pn, Module other) {
                     m.implAddExportsOrOpens(pn, other, true, true);
                 }
                 @Override
-                public void addExportsToAllUnnamed(Module m, String pn) {
-                    m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, false, true);
-                }
-                @Override
                 public void addOpensToAllUnnamed(Module m, String pn) {
                     m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, true, true);
                 }
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java	Sun Mar 19 11:58:46 2017 +0000
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java	Sun Mar 19 12:14:58 2017 +0000
@@ -77,17 +77,22 @@
     void addExports(Module m1, String pkg, Module m2);
 
     /**
+     * Updates a module m to export a package to all unnamed modules.
+     */
+    void addExportsToAllUnnamed(Module m, String pkg);
+
+    /**
+     * Updates a module m to open a package to all modules.
+     */
+    void addOpens(Module m, String pkg);
+
+    /**
      * Updates module m1 to open a package to module m2. Opening the
      * package does not result in a strong reference to m2 (m2 can be GC'ed).
      */
     void addOpens(Module m1, String pkg, Module m2);
 
     /**
-     * Updates a module m to export a package to all unnamed modules.
-     */
-    void addExportsToAllUnnamed(Module m, String pkg);
-
-    /**
      * Updates a module m to open a package to all unnamed modules.
      */
     void addOpensToAllUnnamed(Module m, String pkg);
--- a/src/java.base/share/classes/jdk/internal/module/Modules.java	Sun Mar 19 11:58:46 2017 +0000
+++ b/src/java.base/share/classes/jdk/internal/module/Modules.java	Sun Mar 19 12:14:58 2017 +0000
@@ -38,10 +38,10 @@
 import jdk.internal.misc.SharedSecrets;
 
 /**
- * A helper class to allow JDK classes create dynamic modules and to update
- * modules, exports and the readability graph. It is also invoked by the VM
- * to add read edges when agents are instrumenting code that need to link
- * to supporting classes.
+ * A helper class for creating and updating modules. This class is intended to
+ * support command-line options, tests, and the instrumentation API. It is also
+ * used by the VM to add read edges when agents are instrumenting code that
+ * need to link to supporting classes.
  *
  * The parameters that are package names in this API are the fully-qualified
  * names of the packages as defined in section 6.5.3 of <cite>The Java&trade;
@@ -71,7 +71,7 @@
     }
 
     /**
-     * Updates {@code m1} to read {@code m1}.
+     * Updates m1 to read m2.
      * Same as m1.addReads(m2) but without a caller check.
      */
     public static void addReads(Module m1, Module m2) {
@@ -79,7 +79,7 @@
     }
 
     /**
-     * Update module {@code m} to read all unnamed modules.
+     * Update module m to read all unnamed modules.
      */
     public static void addReadsAllUnnamed(Module m) {
         JLRMA.addReadsAllUnnamed(m);
@@ -87,6 +87,8 @@
 
     /**
      * Update module m to export a package to all modules.
+     *
+     * This method is for intended for use by tests only.
      */
     public static void addExports(Module m, String pn) {
         JLRMA.addExports(m, pn);
@@ -94,13 +96,29 @@
 
     /**
      * Updates module m1 to export a package to module m2.
-     * Same as m1.addExports(pn, m2) but without a caller check.
+     * Same as m1.addExports(pn, m2) but without a caller check
      */
     public static void addExports(Module m1, String pn, Module m2) {
         JLRMA.addExports(m1, pn, m2);
     }
 
     /**
+     * Updates module m to export a package to all unnamed modules.
+     */
+    public static void addExportsToAllUnnamed(Module m, String pn) {
+        JLRMA.addExportsToAllUnnamed(m, pn);
+    }
+
+    /**
+     * Update module m to open a package to all modules.
+     *
+     * This method is for intended for use by tests only.
+     */
+    public static void addOpens(Module m, String pn) {
+        JLRMA.addOpens(m, pn);
+    }
+
+    /**
      * Updates module m1 to open a package to module m2.
      * Same as m1.addOpens(pn, m2) but without a caller check.
      */
@@ -109,13 +127,6 @@
     }
 
     /**
-     * Updates module m to export a package to all unnamed modules.
-     */
-    public static void addExportsToAllUnnamed(Module m, String pn) {
-        JLRMA.addExportsToAllUnnamed(m, pn);
-    }
-
-    /**
      * Updates module m to open a package to all unnamed modules.
      */
     public static void addOpensToAllUnnamed(Module m, String pn) {