8344011: Remove usage of security manager from Class and reflective APIs

Reviewed-by: liach, yzheng, rriggs
This commit is contained in:
Alan Bateman 2024-11-14 07:39:28 +00:00
parent c977ef7b45
commit abacece826
26 changed files with 163 additions and 1251 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
@ -30,8 +30,6 @@ import java.lang.reflect.AnnotatedElement;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Objects;
import jdk.internal.loader.BootLoader;
@ -417,9 +415,7 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
// find package-info.class defined by loader
String cn = packageName() + ".package-info";
Module module = module();
PrivilegedAction<ClassLoader> pa = module::getClassLoader;
@SuppressWarnings("removal")
ClassLoader loader = AccessController.doPrivileged(pa);
ClassLoader loader = module.getClassLoader();
Class<?> c;
if (loader != null) {
c = loader.loadClass(module, cn);