[kaffe] Re: Java lang spec: private access
Tom Tromey
tromey at redhat.com
Tue May 16 08:16:06 PDT 2006
>>>>> "Ito" == Ito Kazumitsu <kaz at maczuka.gcd.org> writes:
Ito> The Java Language Specification, Third Edition says:
Ito> |6.6.1 Determining Accessibility
Ito> Why "the top level class" ?
At this level it is a language design decision.
The idea is that all the code defined within the scope of a top-level
class can share implementation details. I suppose the thinking is
that, because the member and its users are lexically close, this is
safe enough to promote as a general practice. Also, there are no
binary compatibility issues here.
Ito> What if the private member is declared in an inner class?
>From a language semantics point of view, that is definitely allowed by
the JLS. It isn't unreasonable from a design point of view, just a
choice...
>From a compiler point of view, you have to emit accessor methods in
these cases, because to the JVM all classes are top-level classes, and
there are no special access rules for this. This is a pain; Classpath
avoids private accesses across class boundaries for this reason.
Tom
More information about the kaffe
mailing list