mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8202419: Avoid creating Permission constants early
Reviewed-by: alanb, mullan
This commit is contained in:
parent
f7afa8ff53
commit
0f478d2cfd
4 changed files with 26 additions and 21 deletions
|
@ -425,7 +425,8 @@ class Thread implements Runnable {
|
|||
*/
|
||||
if (security != null) {
|
||||
if (isCCLOverridden(getClass())) {
|
||||
security.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
security.checkPermission(
|
||||
SecurityConstants.SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1703,10 +1704,6 @@ class Thread implements Runnable {
|
|||
return m;
|
||||
}
|
||||
|
||||
|
||||
private static final RuntimePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
|
||||
new RuntimePermission("enableContextClassLoaderOverride");
|
||||
|
||||
/** cache of subclass security audit results */
|
||||
/* Replace with ConcurrentReferenceHashMap when/if it appears in a future
|
||||
* release */
|
||||
|
|
|
@ -35,6 +35,7 @@ import jdk.internal.reflect.CallerSensitive;
|
|||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.reflect.ReflectionFactory;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* The {@code AccessibleObject} class is the base class for {@code Field},
|
||||
|
@ -73,17 +74,14 @@ import sun.security.action.GetPropertyAction;
|
|||
*/
|
||||
public class AccessibleObject implements AnnotatedElement {
|
||||
|
||||
/**
|
||||
* The Permission object that is used to check whether a client
|
||||
* has sufficient privilege to defeat Java language access
|
||||
* control checks.
|
||||
*/
|
||||
private static final java.security.Permission ACCESS_PERMISSION =
|
||||
new ReflectPermission("suppressAccessChecks");
|
||||
|
||||
static void checkPermission() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkPermission(ACCESS_PERMISSION);
|
||||
if (sm != null) {
|
||||
// SecurityConstants.ACCESS_PERMISSION is used to check
|
||||
// whether a client has sufficient privilege to defeat Java
|
||||
// language access control checks.
|
||||
sm.checkPermission(SecurityConstants.ACCESS_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue