[kaffe] Java lang spec: private access

Ito Kazumitsu kaz at maczuka.gcd.org
Tue May 16 16:24:48 PDT 2006


From: Ito Kazumitsu <kaz at maczuka.gcd.org>
Date: Wed, 17 May 2006 01:20:37 +0900 (JST)

> But the following cannot be compiled because "a" in type "ZZ$ZZ1" is
> not accessible.  Isn't this an access from within the top level class?

I understand.  It is not an access to "a" in type "ZZ$ZZ1".

> public class ZZ {
>   public class ZZ1 {
>     private int a;
>     public void foo() {}
>   }
> 
>   ZZ1 zz1;
> 
>   public ZZ() {
>     zz1 = new ZZ1() {
>       public void foo() {
>           a = 1;

This is not an access to "a" in "ZZ1", but an access to "a" in the
anonymous class as a subclass of "ZZ1".  And the private member "a"
cannot be inherited.




More information about the kaffe mailing list