[kaffe] [bug] Method delegation error with superinterfaces

Benja Fallenstein b.fallenstein at gmx.de
Mon Jul 19 07:59:23 PDT 2004


Hi all,

The following bug is triggered by the combination of Jikes 1.21 with the 
current version of Kaffe from CVS. It is not triggered by Jikes + 
sunjava or by sunjavac + Kaffe...

With jikes+Kaffe, the following code:

-----------------------------------------------------------------
public class Bug {
     static interface I1 {
	public String toString();
     }
     static interface I2 extends I1 {
     }
     static class CBug implements I2 {
     }
     public static void main(String[] argv) throws Exception {
	I2 b = new CBug();
	System.out.println(b);
	System.out.println(b.toString().length());
	System.out.println(b.toString());
     }
}
-----------------------------------------------------------------

gives me this output with a freshly compiled version of Kaffe from CVS:

-----------------------------------------------------------------
benja at joy:/tmp$ jikes Bug.java; kaffe Bug
Bug$CBug at 82d7d50
137009132
java.lang.OutOfMemoryError
    at java.io.Writer.write (Writer.java:185)
    at java.io.OutputStreamWriter.write (OutputStreamWriter.java:196)
    at java.io.PrintWriter.write (PrintWriter.java:542)
    at java.io.PrintWriter.write (PrintWriter.java:568)
    at java.io.PrintWriter.print (PrintWriter.java:204)
    at java.io.PrintWriter.println (PrintWriter.java:453)
    at java.io.PrintStream.println (PrintStream.java:389)
    at Bug.main (Bug.java:16)
-----------------------------------------------------------------

which is obviously wrong, since the returned string should be 
"Bug$CBug at 82d7d50", which does not have length 137009132...

I first noticed this bug in a much more complex program, where I would 
get NullPointerExceptions when calling any method on the string returned 
by toString().

Not sure whether this should be seen as a bug in Kaffe or Jikes -- but 
since Kaffe aims to run programs that work on Sun's JDK, I guess this 
should be fixed. I don't understand Kaffe well enough to do it, though.

Cheers,
- Benja




More information about the kaffe mailing list