hotspot/src/share/vm/runtime/reflection.cpp
changeset 46404 ae62ba99a1a7
parent 46388 d7a164ad6b7f
child 46543 a6c67129b3fd
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Mon Apr 24 12:08:28 2017 -0400
@@ -464,8 +464,9 @@
  Caller S in package     If MS is loose: YES      If same classloader/package (PS == PT): YES
  PS, runtime module MS   If MS can read T's       If same runtime module: (MS == MT): YES
                          unnamed module: YES
-                                                  Else if (MS can read MT (Establish readability) &&
-                                                    MT exports PT to MS or to all modules): YES
+                                                  Else if (MS can read MT (establish readability) &&
+                                                    ((MT exports PT to MS or to all modules) ||
+                                                     (MT is open))): YES
 
  ------------------------------------------------------------------------------------------------
  Caller S in unnamed         YES                  Readability exists because unnamed module
@@ -511,7 +512,7 @@
       return ACCESS_OK;
     }
 
-    // Acceptable access to a type in an unamed module.  Note that since
+    // Acceptable access to a type in an unnamed module. Note that since
     // unnamed modules can read all unnamed modules, this also handles the
     // case where module_from is also unnamed but in a different class loader.
     if (!module_to->is_named() &&
@@ -524,6 +525,11 @@
       return MODULE_NOT_READABLE;
     }
 
+    // Access is allowed if module_to is open, i.e. all its packages are unqualifiedly exported
+    if (module_to->is_open()) {
+      return ACCESS_OK;
+    }
+
     PackageEntry* package_to = new_class->package();
     assert(package_to != NULL, "can not obtain new_class' package");