[kaffe] Problem with defineClass in a user-ClassLoader

Patrick Tullmann tullmann at cs.utah.edu
Mon May 20 16:42:32 PDT 2002


Dalibor wrote:
> Is kaffe's behaviour a bug? That's a tricky question: I am not
> sure. According to the descriptions of class loader semantics given
> above, I believe that the buggy class loader's behaviour is outside
> the spec, for Java 1.2 semantics, and at least questionable for 1.1
> semantics. But kaffe fails with a not very useful assertion message,
> so that could be seen as a bug. Of course, you could say that it
> works on Sun and doesn't on kaffe, thus it's a bug in kaffe.
> However that's not a good idea, as Sun's implementation (generally
> speaking) has its own share of bugs, too.

I believe that in Sun's more recent VMs, a ClassLoader such Nico's
will *never even be asked* to load any of the system classes like
java.lang.Object.  You might add some println's to establish that.
So, the bug isn't really in processClass(), but the code that decided
to let the ClassLoader load java.lang.Object.  I think even Sun's 1.0
and 1.1 VMs even prevented this in a fairly arbitrary way.

(I'd try this myself, but I didn't see Nico's code on the mailing
list... but I may not have looked hard enough.)

Fixing this in Kaffe is pretty much equivalent to providing 1.2
ClassLoader semantics... (better tracking of loaded classes and better
tests as to what a ClassLoader should be asked to load.)

As a caveat, I haven't played with ClassLoaders in nasty ways like
this in a while, so I could very well be wrong...

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann at cs.utah.edu
			  Mean people suck.




More information about the kaffe mailing list