Japi reverse comparisons (eg finalness and SimpleDoc)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://developer.classpath.org/pipermail/classpath/attachments/20060126/2b7b6448/attachment.pgp

[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux