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
|
@ -467,6 +467,7 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
|||
return value;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private Method[] computeMemberMethods() {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<Method[]>() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
|
@ -293,6 +293,7 @@ public class AnnotationParser {
|
|||
* Returns an annotation of the given type backed by the given
|
||||
* member {@literal ->} value map.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Annotation annotationForMap(final Class<? extends Annotation> type,
|
||||
final Map<String, Object> memberValues)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
|
@ -181,6 +181,7 @@ public final class AnnotationSupport {
|
|||
/* Reflectively invoke the values-method of the given annotation
|
||||
* (container), cast it to an array of annotations and return the result.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static <A extends Annotation> A[] getValueArray(Annotation container) {
|
||||
try {
|
||||
// According to JLS the container must have an array-valued value
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
|
@ -105,6 +105,7 @@ public class AnnotationType {
|
|||
if (!annotationClass.isAnnotation())
|
||||
throw new IllegalArgumentException("Not an annotation type");
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
Method[] methods =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public Method[] run() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
|
@ -53,6 +53,7 @@ class Trampoline {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static void ensureInvocableMethod(Method m)
|
||||
throws InvocationTargetException
|
||||
{
|
||||
|
@ -101,6 +102,7 @@ public final class MethodUtil extends SecureClassLoader {
|
|||
* Class.getMethods() and walking towards Object until
|
||||
* we're done.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Method[] getPublicMethods(Class<?> cls) {
|
||||
// compatibility for update release
|
||||
if (System.getSecurityManager() == null) {
|
||||
|
@ -278,6 +280,7 @@ public final class MethodUtil extends SecureClassLoader {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static Method getTrampoline() {
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
|
@ -82,6 +82,7 @@ public final class ReflectUtil {
|
|||
* @param m the {@code Member} about to be accessed
|
||||
*/
|
||||
public static void conservativeCheckMemberAccess(Member m) throws SecurityException{
|
||||
@SuppressWarnings("removal")
|
||||
final SecurityManager sm = System.getSecurityManager();
|
||||
if (sm == null)
|
||||
return;
|
||||
|
@ -114,6 +115,7 @@ public final class ReflectUtil {
|
|||
* also check the package access on the proxy interfaces.
|
||||
*/
|
||||
public static void checkPackageAccess(Class<?> clazz) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null) {
|
||||
privateCheckPackageAccess(s, clazz);
|
||||
|
@ -123,7 +125,7 @@ public final class ReflectUtil {
|
|||
/**
|
||||
* NOTE: should only be called if a SecurityManager is installed
|
||||
*/
|
||||
private static void privateCheckPackageAccess(SecurityManager s, Class<?> clazz) {
|
||||
private static void privateCheckPackageAccess(@SuppressWarnings("removal") SecurityManager s, Class<?> clazz) {
|
||||
String pkg = clazz.getPackageName();
|
||||
if (!pkg.isEmpty()) {
|
||||
s.checkPackageAccess(pkg);
|
||||
|
@ -141,6 +143,7 @@ public final class ReflectUtil {
|
|||
* the true caller (application).
|
||||
*/
|
||||
public static void checkPackageAccess(String name) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null) {
|
||||
String cname = name.replace('/', '.');
|
||||
|
@ -207,6 +210,7 @@ public final class ReflectUtil {
|
|||
* @param clazz Proxy class object
|
||||
*/
|
||||
public static void checkProxyPackageAccess(Class<?> clazz) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null) {
|
||||
privateCheckProxyPackageAccess(s, clazz);
|
||||
|
@ -216,7 +220,7 @@ public final class ReflectUtil {
|
|||
/**
|
||||
* NOTE: should only be called if a SecurityManager is installed
|
||||
*/
|
||||
private static void privateCheckProxyPackageAccess(SecurityManager s, Class<?> clazz) {
|
||||
private static void privateCheckProxyPackageAccess(@SuppressWarnings("removal") SecurityManager s, Class<?> clazz) {
|
||||
// check proxy interfaces if the given class is a proxy class
|
||||
if (Proxy.isProxyClass(clazz)) {
|
||||
for (Class<?> intf : clazz.getInterfaces()) {
|
||||
|
@ -235,6 +239,7 @@ public final class ReflectUtil {
|
|||
public static void checkProxyPackageAccess(ClassLoader ccl,
|
||||
Class<?>... interfaces)
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
for (Class<?> intf : interfaces) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue