Patch: FYI: don't call getSystemClassLoader()

Bryce McKinlay mckinlay@redhat.com
Thu Mar 10 13:45:00 GMT 2005


Tom Tromey wrote:

>I'm checking this in on the trunk and the 4.0 branch.
>
>Andrew pointed out that calling getSystemClassLoader is expensive, as
>we do a security check.  I think there is no reason to call this
>method from our native code; instead it is always safe to simply refer
>to the field itself.  Note that we don't rely on the class
>initialization semantics of the method call in these places.
>  
>
Good idea. Note that there's already a "getSystemClassLoaderInternal()" 
in Class.h. We should probably try to standardize on one or the other 
(the field or the inlined accessor method).

Bryce



More information about the Java-patches mailing list