[kaffe] loadClass() vs. loadClass()

Mark Wielaard mark at klomp.org
Fri Sep 19 08:23:02 PDT 2003


On Fri, 2003-09-19 at 16:23, Helmer Krämer wrote:
> Whenever kaffe has to load some class
> using a user defined loader, it invokes the two parameter
> form of loadClass.
> [...]
> The simple and quick fix would be to modify kaffe so
> it calls the loadClass(String) method of a user defined
> class loader instead of the loadClass(String, boolean)
> one. In theory, this should not break existing code since
> loadClass(String) simply calls the other method. I don't
> know whether this is the right way to fix this, though.

I think this is the correct fix. See:

        1 Since JDK release 1.1 the Java virtual machine invokes the
        loadClass method of a class loader in order to cause it to load
        a class or interface. The argument to loadClass is the name of
        the class or interface to be loaded. There is also a
        two-argument version of the loadClass method. The second
        argument is a boolean that indicates whether the class or
        interface is to be linked or not. Only the two-argument version
        was supplied in JDK release 1.0.2, and the Java virtual machine
        relied on it to link the loaded class or interface. From JDK
        release 1.1 onward, the Java virtual machine links the class or
        interface directly, without relying on the class loader.

You should also call the one argument ClassLoader.loadClass(String)
method for Class.forName(), but I cannot quickly find where in the spec
this is defined.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://kaffe.org/pipermail/kaffe/attachments/20030919/4d76fe35/attachment-0002.pgp 

More information about the kaffe mailing list