mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8344011: Remove usage of security manager from Class and reflective APIs
Reviewed-by: liach, yzheng, rriggs
This commit is contained in:
parent
c977ef7b45
commit
abacece826
26 changed files with 163 additions and 1251 deletions
|
@ -44,7 +44,6 @@ import java.util.function.Function;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
import jdk.internal.javac.Restricted;
|
||||
import jdk.internal.loader.ClassLoaderValue;
|
||||
import jdk.internal.loader.Loader;
|
||||
|
@ -54,7 +53,6 @@ import jdk.internal.misc.CDS;
|
|||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* A layer of modules in the Java virtual machine.
|
||||
|
@ -505,9 +503,6 @@ public final class ModuleLayer {
|
|||
List<ModuleLayer> parents = List.copyOf(parentLayers);
|
||||
checkConfiguration(cf, parents);
|
||||
|
||||
checkCreateClassLoaderPermission();
|
||||
checkGetClassLoaderPermission();
|
||||
|
||||
try {
|
||||
Loader loader = new Loader(cf.modules(), parentLoader);
|
||||
loader.initRemotePackageMap(cf, parents);
|
||||
|
@ -572,9 +567,6 @@ public final class ModuleLayer {
|
|||
List<ModuleLayer> parents = List.copyOf(parentLayers);
|
||||
checkConfiguration(cf, parents);
|
||||
|
||||
checkCreateClassLoaderPermission();
|
||||
checkGetClassLoaderPermission();
|
||||
|
||||
LoaderPool pool = new LoaderPool(cf, parents, parentLoader);
|
||||
try {
|
||||
ModuleLayer layer = new ModuleLayer(cf, parents, pool::loaderFor);
|
||||
|
@ -654,8 +646,6 @@ public final class ModuleLayer {
|
|||
checkConfiguration(cf, parents);
|
||||
Objects.requireNonNull(clf);
|
||||
|
||||
checkGetClassLoaderPermission();
|
||||
|
||||
// The boot layer is checked during module system initialization
|
||||
if (boot() != null) {
|
||||
checkForDuplicatePkgs(cf, clf);
|
||||
|
@ -693,20 +683,6 @@ public final class ModuleLayer {
|
|||
}
|
||||
}
|
||||
|
||||
private static void checkCreateClassLoaderPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(SecurityConstants.CREATE_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
|
||||
private static void checkGetClassLoaderPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks a configuration and the module-to-loader mapping to ensure that
|
||||
* no two modules mapped to the same class loader have the same package.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue