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

Guilhem Lavaux guilhem at kaffe.org
Wed Aug 13 06:03:02 PDT 2003

Ito Kazumitsu wrote:

>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.
I have found where the bug lies ! In CMethod, the test for accessibility 
forget to check whether the calling
context is nested into an authorized class. I have attached the real 
simple patch with this mail.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: method_access_nested_patch
Url: http://kaffe.org/pipermail/kaffe/attachments/20030813/524ba4b3/attachment-0002.txt 

More information about the kaffe mailing list