mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8165896: Use "open" flag from JVM_DefineModule to export all module packages
Implemented VM side of open modules, which export all their packages unqualifiedly. Automatic modules and unnamed modules are treated internally as open modules. Reviewed-by: alanb, hseigel, lfoltan
This commit is contained in:
parent
f9e13c6d3f
commit
9947f147f6
28 changed files with 205 additions and 93 deletions
|
@ -464,8 +464,9 @@ static bool can_relax_access_check_for(const Klass* accessor,
|
|||
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 @@ Reflection::VerifyClassAccessResults Reflection::verify_class_access(
|
|||
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 @@ Reflection::VerifyClassAccessResults Reflection::verify_class_access(
|
|||
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");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue