RFR 6642881: Improve performance of Class.getClassLoader()

Alan Bateman Alan.Bateman at oracle.com
Tue Jun 24 07:13:29 UTC 2014

On 24/06/2014 00:45, Coleen Phillimore wrote:
> Please review a change to the JDK code for adding classLoader field to 
> the instances of java/lang/Class.  This change restricts reflection 
> from changing access to the classLoader field.  In the spec, 
> AccessibleObject.setAccessible() may throw SecurityException if the 
> accessibility of an object may not be changed:
> http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/AccessibleObject.html#setAccessible(boolean) 
> Only AccessibleObject.java has changes from the previous version of 
> this change.
> open webrev at http://cr.openjdk.java.net/~coleenp/6642881_jdk_4/
> bug link https://bugs.openjdk.java.net/browse/JDK-6642881
Having setAccessible throw SecurityException when there isn't a security 
manager set is a bit odd but as you point out, setAccessible is 
specified to allow that. The changes looks okay, although I don't think 
strictly necessary.


More information about the core-libs-dev mailing list