AnonymousClassLoader and ClassLoader

Rémi Forax forax at univ-mlv.fr
Thu Apr 24 02:26:34 PDT 2008


Yesterday evening, I've tried to replace the application classloader
(the one used to load the application) by one that use an anymous class 
loader
to load the class. And i've tested by launching SwingSet2.

And it doesn't work because UI program  like SwingSet  lookup their 
resources
like image, icons etc. using getResource()/getResourceAsStream().
getResource() makes the assumption that if getClassLoader() returns null
the class is loaded by the bootstrap classloader.

In my opinion, getResource() is not the only method that makes this 
assumption
so an anonymous class should be able to specify an external classloader
when defined i.e. Unsafe.defineAnonymousClass should take
a classloader as argument.

Rémi



More information about the mlvm-dev mailing list