[Kaffe] ease of use patch.

Archie Cobbs archie at whistle.com
Wed Feb 24 12:21:50 PST 1999


Alexandre Oliva writes:
> > Could you elaborate on this, eg, with an example? I don't see
> > what you're talking about.
> 
> It's not that private variables are ``promoted'' to package-protected
> ones; package-protected accessor methods are may be created to grant
> access to private variables of a class to its inner classes.
> 
> class foo { private int bar; class baz { int foobar() { return bar; }}}
> 
> there will be an accessor bar$something() that baz.foobar() will call
> to obtain the value of foo.bar.

That's not the way I think about it. Rather, every inner class
is given two things: (1) an implicit object reference to its
enclosing class, and (2) the same access as the enclosing class.

So "return bar" really does this:

  return specialImplicitReferenceToFoo.bar;

There is no bar$something() method created as far as I know.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list