< prev index next >

src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java

Print this page
rev 49922 : 8202419: Avoid creating Permission constants early
Reviewed-by: TBD

*** 45,54 **** --- 45,55 ---- import java.util.Properties; import jdk.internal.misc.VM; import sun.reflect.misc.ReflectUtil; import sun.security.action.GetPropertyAction; + import sun.security.util.SecurityConstants; /** <P> The master factory for all reflective objects, both those in java.lang.reflect (Fields, Methods, Constructors) as well as their delegates (FieldAccessors, MethodAccessors, ConstructorAccessors). </P>
*** 61,72 **** */ public class ReflectionFactory { private static boolean initted = false; - private static final Permission reflectionFactoryAccessPerm - = new RuntimePermission("reflectionFactoryAccess"); private static final ReflectionFactory soleInstance = new ReflectionFactory(); // Provides access to package-private mechanisms in java.lang.reflect private static volatile LangReflectAccess langReflectAccess; /* Method for static class initializer <clinit>, or null */ --- 62,71 ----
*** 128,138 **** * access to the RuntimePermission "reflectionFactoryAccess". */ public static ReflectionFactory getReflectionFactory() { SecurityManager security = System.getSecurityManager(); if (security != null) { // TO DO: security.checkReflectionFactoryAccess(); ! security.checkPermission(reflectionFactoryAccessPerm); } return soleInstance; } /** --- 127,138 ---- * access to the RuntimePermission "reflectionFactoryAccess". */ public static ReflectionFactory getReflectionFactory() { SecurityManager security = System.getSecurityManager(); if (security != null) { // TO DO: security.checkReflectionFactoryAccess(); ! security.checkPermission( ! SecurityConstants.REFLECTION_FACTORY_ACCESS_PERMISSION); } return soleInstance; } /**
< prev index next >