Hi, On Thu, 2006-01-26 at 15:34 +0100, Jeroen Frijters wrote: > It's really amazing how complex the seemingly simple Java language is...
Indeed amazing. I made an "stand-alone" example:
public class Parent
{
public int a;
}
public class Child extends Parent
{
private int a;
}
class GrandChild extends Child
{
int b = a;
}
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?
Cheers,
Mark
signature.asc
Description: This is a digitally signed message part

