< prev index next >

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

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs

*** 25,41 **** package jdk.internal.reflect; import java.lang.reflect.*; - import java.security.AccessController; - import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Map; import java.util.Objects; import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.misc.VM; /** Common utility routines used by both java.lang and java.lang.reflect */ public class Reflection { --- 25,40 ---- package jdk.internal.reflect; import java.lang.reflect.*; import java.util.HashMap; import java.util.Map; import java.util.Objects; import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.misc.VM; + import sun.security.action.GetPropertyAction; /** Common utility routines used by both java.lang and java.lang.reflect */ public class Reflection {
*** 342,360 **** // true if printStackWhenAccessFails has been initialized private static volatile boolean printStackWhenAccessFailsSet; private static void printStackTraceIfNeeded(Throwable e) { if (!printStackWhenAccessFailsSet && VM.initLevel() >= 1) { ! // can't use method reference here, might be too early in startup ! PrivilegedAction<Boolean> pa = new PrivilegedAction<Boolean>() { ! public Boolean run() { ! String s; ! s = System.getProperty("sun.reflect.debugModuleAccessChecks"); ! return (s != null && !s.equalsIgnoreCase("false")); ! } ! }; ! printStackWhenAccessFails = AccessController.doPrivileged(pa); printStackWhenAccessFailsSet = true; } if (printStackWhenAccessFails) { e.printStackTrace(); } --- 341,354 ---- // true if printStackWhenAccessFails has been initialized private static volatile boolean printStackWhenAccessFailsSet; private static void printStackTraceIfNeeded(Throwable e) { if (!printStackWhenAccessFailsSet && VM.initLevel() >= 1) { ! String s = GetPropertyAction ! .getProperty("sun.reflect.debugModuleAccessChecks"); ! printStackWhenAccessFails = ! (s != null && !s.equalsIgnoreCase("false")); printStackWhenAccessFailsSet = true; } if (printStackWhenAccessFails) { e.printStackTrace(); }
< prev index next >