< prev index next >

src/share/vm/runtime/reflection.cpp

Print this page

        

@@ -462,12 +462,13 @@
  ------------------------------------------------------------------------------------------------
 
  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
  module UM                                            "reads" all modules
                                                   if (MT exports PT to UM or to all modules): YES

@@ -516,11 +517,11 @@
     // both in same (possibly unnamed) module
     if (module_from == module_to) {
       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() &&
         (module_from->can_read_all_unnamed() || module_from->can_read(module_to))) {
       return ACCESS_OK;

@@ -529,10 +530,15 @@
     // Establish readability, check if module_from is allowed to read module_to.
     if (!module_from->can_read(module_to)) {
       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");
 
     {
       MutexLocker m1(Module_lock);
< prev index next >