[kaffe] Re: KJC bug report: inner class cannot find the enclosing class's method
ito.kazumitsu at hitachi-cable.co.jp
ito.kazumitsu at hitachi-cable.co.jp
Wed Aug 13 19:34:02 PDT 2003
In message "Re: [kaffe] KJC bug report: inner class cannot find the enclosing class's method"
on 03/08/13, Guilhem Lavaux <guilhem at kaffe.org> writes:
> 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.
Thank you very much.
But I am sorry I forgot to report another case similar to the
previous one. In this case, reference to a protected field
other than a method call concerns.
bash$ cat a/A.java
package a;
public class A {
protected String foo = "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() {
System.out.println(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 field "foo" [JLS 15.11]
bash$ javac a/A.java b/B.java
bash$ java b.B
This is foo.
bash$
More information about the kaffe
mailing list