mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8266459: Implement JEP 411: Deprecate the Security Manager for Removal
Co-authored-by: Sean Mullan <mullan@openjdk.org> Co-authored-by: Lance Andersen <lancea@openjdk.org> Co-authored-by: Weijun Wang <weijun@openjdk.org> Reviewed-by: erikj, darcy, chegar, naoto, joehw, alanb, mchung, kcr, prr, lancea
This commit is contained in:
parent
19450b9951
commit
6765f90250
826 changed files with 2734 additions and 757 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2021, 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
|
||||
|
@ -390,6 +390,7 @@ public class Proxy implements java.io.Serializable {
|
|||
Class<?>... interfaces)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
Class<?> caller = System.getSecurityManager() == null
|
||||
? null
|
||||
: Reflection.getCallerClass();
|
||||
|
@ -463,6 +464,7 @@ public class Proxy implements java.io.Serializable {
|
|||
ClassLoader loader,
|
||||
Class<?> ... interfaces)
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader ccl = caller.getClassLoader();
|
||||
|
@ -663,6 +665,7 @@ public class Proxy implements java.io.Serializable {
|
|||
* Must call the checkProxyAccess method to perform permission checks
|
||||
* before calling this.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
Constructor<?> build() {
|
||||
Class<?> proxyClass = defineProxyClass(module, interfaces);
|
||||
assert !module.isNamed() || module.isOpen(proxyClass.getPackageName(), Proxy.class.getModule());
|
||||
|
@ -1018,6 +1021,7 @@ public class Proxy implements java.io.Serializable {
|
|||
InvocationHandler h) {
|
||||
Objects.requireNonNull(h);
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
final Class<?> caller = System.getSecurityManager() == null
|
||||
? null
|
||||
: Reflection.getCallerClass();
|
||||
|
@ -1055,6 +1059,7 @@ public class Proxy implements java.io.Serializable {
|
|||
}
|
||||
|
||||
private static void checkNewProxyPermission(Class<?> caller, Class<?> proxyClass) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
if (ReflectUtil.isNonPublicProxyClass(proxyClass)) {
|
||||
|
@ -1076,6 +1081,7 @@ public class Proxy implements java.io.Serializable {
|
|||
/**
|
||||
* Returns the class loader for the given module.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static ClassLoader getLoader(Module m) {
|
||||
PrivilegedAction<ClassLoader> pa = m::getClassLoader;
|
||||
return AccessController.doPrivileged(pa);
|
||||
|
@ -1113,6 +1119,7 @@ public class Proxy implements java.io.Serializable {
|
|||
* s.checkPackageAccess()} denies access to the invocation
|
||||
* handler's class.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public static InvocationHandler getInvocationHandler(Object proxy)
|
||||
throws IllegalArgumentException
|
||||
|
@ -1286,6 +1293,7 @@ public class Proxy implements java.io.Serializable {
|
|||
*
|
||||
* @return a lookup for proxy class of this proxy instance
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static MethodHandles.Lookup proxyClassLookup(MethodHandles.Lookup caller, Class<?> proxyClass) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue