mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8154447: Exempt classes under java.util.concurrent from MH.Lookup restrictions
Reviewed-by: mchung, martin
This commit is contained in:
parent
1af2806677
commit
27f82bea87
3 changed files with 89 additions and 3 deletions
|
@ -745,10 +745,13 @@ public class MethodHandles {
|
|||
if (name.startsWith("java.lang.invoke."))
|
||||
throw newIllegalArgumentException("illegal lookupClass: "+lookupClass);
|
||||
|
||||
// For caller-sensitive MethodHandles.lookup()
|
||||
// disallow lookup more restricted packages
|
||||
// For caller-sensitive MethodHandles.lookup() disallow lookup from
|
||||
// restricted packages. This a fragile and blunt approach.
|
||||
// TODO replace with a more formal and less fragile mechanism
|
||||
// that does not bluntly restrict classes under packages within
|
||||
// java.base from looking up MethodHandles or VarHandles.
|
||||
if (allowedModes == ALL_MODES && lookupClass.getClassLoader() == null) {
|
||||
if (name.startsWith("java.") ||
|
||||
if ((name.startsWith("java.") && !name.startsWith("java.util.concurrent.")) ||
|
||||
(name.startsWith("sun.") && !name.startsWith("sun.invoke."))) {
|
||||
throw newIllegalArgumentException("illegal lookupClass: " + lookupClass);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue