On 1/26/06, Mark Wielaard <mark@xxxxxxxxx> wrote: > Which doesn't compile with either gcj, jikes or ecj because they think > the b = a in GrandChild refers to Child.a which is private. This is > surprising and non-intuitive. I would expect a warning that there is a > private field a in Child. But not an error because there is an > accessible field a (in Parent). It is just an implementation detail that > there is a similarly named private field in Child. > > Is this actually specified in the JLS? Yep. http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.3 "If the class declares a field with a certain name, then the declaration of that field is said to hide any and all accessible declarations of fields with the same name in superclasses, and superinterfaces of the class." Note that it doesn't say "if the class declares an *accessible* field..." Stuart. -- http://sab39.dev.netreach.com/