On Sun, 16 Sep 2001, Eric Blake wrote:

> I just noticed the JDK 1.4 documentation for java.util.Hashtable claims
> that Hashtable inherits the nested type Entry from Map:
> http://java.sun.com/j2se/1.4/docs/api/java/util/Hashtable.html
>
> This would mean that the following program should be legal, and output
> "true":
>
> import java.util.*;
> class Foo
> {
>   public static void main(String[] args)
>   {
>     System.out.println(Hashtable.Entry.class == Map.Entry.class);
>   }
> }
>
> However, it does not compile against Classpath, since the implementation
> of Hashtable defines a private nested class named Entry which hides
> Map.Entry, and Hashtable.Entry is not accessible (instead of being an
> alias for Map.Entry as the documentation claims).  See JLS 8.5 for the
> specification of nested class hiding.

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.

- Erwin



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

Reply via email to