On 01/09/2013 02:47 PM, Peter Levart wrote:
On 01/09/2013 01:19 PM, Aleksey Shipilev wrote:
e) Should useCaches be final? That will allow aggressive optimizations
for (c).
It could be made final if moved into the ReflectionData class and
initialized in static initializer of that class. Good idea!
I'll check if this is doable.
Sorry, no go:
// To be able to query system properties as soon as they're available
private static boolean initted = false;
private static void checkInitted() {
if (initted) return;
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
// Tests to ensure the system properties table is fully
// initialized. This is needed because reflection
code is
// called very early in the initialization process
(before
// command-line arguments have been parsed and
therefore
// these user-settable properties installed.) We
assume that
// if System.out is non-null then the System class
has been
// fully initialized and that the bulk of the
startup code
// has been run.
if (System.out == null) {
// java.lang.System not yet fully initialized
return null;
}
String val =
System.getProperty("sun.reflect.noCaches");
if (val != null && val.equals("true")) {
useCaches = false;
}
initted = true;
return null;
}
});
}
Regards, Peter