Another reflection bug; compatibility results

Stuart Ballard sballard at netreach.net
Wed Jun 14 19:56:05 PDT 2000


Godmar Back wrote:
> 
> For the second bug, that would be nice.
> 
> I checked in a fix for the first problem (reporting overridden methods twice.)
> Update libraries/clib/native/Class.c

Your fix solved the vast, vast majority of cases of the first problem,
but a couple remain. It also removed a large number of occurrences of
the second, although there are more of that one left.

A class that provides a simplified test case is at
http://stuart.wuffies.net/japi/KaffeBugTest.java . It lives in a package
net.wuffies.japi, but of course it's trivial to remove the package line
from the source. It demonstrates both bugs by looping over the methods
of java.util.List (this seemed to be an ideal candidate because both
bugs are still displayed) and displaying either:

NoSuchMethodException: [value of methods[i].toString()]

or

Non-equality: [value of methods[i].toString()]
Does not equal [value of c.getMethod(methods[i].getName(),
methods[i].getParameterTypes()).toString()]

or

No problem on [value of methods[i].toString()]

It seems that the problems remain on interfaces - specifically,
interfaces inheriting methods from other interfaces (the
NoSuchMethodException case) and interfaces that override methods in
class Object (the non-equality case). I haven't confirmed it for all
cases of the bug; after these two cases are fixed I'll report back on
whether any failure cases remain in the standard library.

I think this second bug may even be in the JDK - I had Japize printing
out a "!" for every time this test failed, and I noticed it a couple of
times in the JDK output as well. Of course, JDK1.1 doesn't have List
which is a beautiful test case for these problems :)

HTH,
Stuart.


More information about the kaffe mailing list