mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8160710: Enable Thread to grant VarHandle field access to ThreadLocalRandom/Striped64
Reviewed-by: martin, dl, chegar
This commit is contained in:
parent
8f93cf0a46
commit
6b84b1d30a
5 changed files with 107 additions and 94 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -846,8 +846,11 @@ public class MethodHandles {
|
|||
// 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.") && !name.startsWith("java.util.concurrent.")) ||
|
||||
(name.startsWith("sun.") && !name.startsWith("sun.invoke."))) {
|
||||
if ((name.startsWith("java.") &&
|
||||
!name.equals("java.lang.Thread") &&
|
||||
!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