Kaffe compiler bug with anonymous inner classes.

C. Scott Ananian cananian at lesser-magoo.lcs.mit.edu
Tue Aug 4 00:02:24 PDT 1998


// The kaffe compiler (1.00) flags a bogus fatal error when compiling this
// class.  sun's javac does just fine (1.1.6).
//   -- C. Scott Ananian <cananian at alumni.princeton.edu>
class TestK {
  // Reference the anonymous object before we declare it.
  // (if we move this method last, there are no problems.)
  public String toString() { return this.o.toString(); }
  // Gratuitous anonymous object/class.
  public static final Object o = (new Object() {});
  // This *is* legal java.
  // kaffe complains:
  //  Test/TestK.java:9: duplicate definition of constructor
  //  TestK$$anonymous_class0() in class TestK.$anonymous_class1
  //    public static final Object o = (new Object() {});
  //                                        ^
}

/* ----- Who says software isn't speech? ------------ */



More information about the kaffe mailing list