[kaffe] KJC bug report: inner class cannot find the enclosing class's method

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Tue Aug 12 19:16:02 PDT 2003


Hi,

I think this is a bug of KJC.

While trying to build the CVS verion of HSQLDB
(http://hsqldb.sourceforge.net/), I found some
code which kjc cannot compile while both Sun's javac
and gcj can.

Simplified programs to show this bug are as follows.

bash$ cat a/A.java
package a;
public class A {
  protected void foo() {
    System.out.println("This is foo.");
  }
}
bash$ cat b/B.java
package b;
import a.A;
public class B extends A {
  public static void main(String[] args) {
    (new B()).go();
  }
  private void go() {
    (new B1()).bar();
  }
  class B1 {
    private void bar() {
      B.this.foo();
    }
  }
}
bash$ CLASSPATH=kjc.jar java at.dms.kjc.Main a/A.java b/B.java 
b\B.java:12: error:Cannot find method "b.B.foo()"
bash$ javac a/A.java b/B.java 
bash$ java b.B
This is foo.
bash$ 




More information about the kaffe mailing list