No, javac and jikes are correct.  Similarly, it is possible for a
private field to hide a visible field:

class A {
  public int i;
}
class B extends A {
  private int i;
}
class C extends B {
  void foo() {
    // illegal, i is hidden in B, and A's i is not available
    // i++;
  }
}

Also, see
http://www.ergnosis.com/java-spec-report/java-language/jls-8.5-b.html
for an unofficial take on the hole in the JLS.

You're thinking of methods, where it is NOT legal for a method with less
visibility to hide one with more.

Erwin Bolwidt wrote:
> 
> > import java.util.*;
> > class Foo
> > {
> >   public static void main(String[] args)
> >   {
> >     System.out.println(Hashtable.Entry.class == Map.Entry.class);
> >   }
> > }
> >
> 
> I think it is a bug in javac and jikes. Since Hashtable.Entry is private,
> it is not visible to other classes, so it does not hide Map.Entry. So your
> example should work, but the compilers are probably wrong.
> 
> It is not so strange though that Hashtable has its own Entry member class,
> because Map.Entry is an interface that still needs to be implemented.

Yes, but the implementation need not be named Entry, so that it does not
hide the inherited Map.Entry.

> 
> - Erwin

-- 
This signature intentionally left boring.

Eric Blake             [EMAIL PROTECTED]
  BYU student, free software programmer

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to