-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
generic
-
generic
Name: bsT130419 Date: 09/20/2001
java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)
Javadoc does not take into account the hiding of nested classes. For an example
of this, look at the documentation for Hashtable:
http://java.sun.com/j2se/1.4/docs/api/java/util/Hashtable.html
Notice that the documentation claims that Hashtable inherits Map.Entry, the nested type Entry from interface Map. However, according to javap -private,
Hashtable defines its own private nested type Entry which implements Map.Entry.
Therefore, Hashtable.Entry hides Map.Entry, and Hashtable does not inherit the
type Map.Entry after all.
As proof, try compiling this program. If the javadoc were correct, this should
be legal, and print "true":
import java.util.*;
class Foo {
public static void main(String[] args) {
System.out.println(Hashtable.Entry.class == Map.Entry.class);
}
}
But the result of javadoc is wrong, and the class doesn't even compile:
$ javac Foo.java
Foo.java:4: java.util.Hashtable.Entry has private access in java.util.Hashtable
System.out.println(Hashtable.Entry.class == Map.Entry.class);
^
1 error
On the other hand, you may decide that this is a library bug, and that Hashtable
should not define a nested class named Entry because it would hide the
(non-canonical) name Hashtable.Entry as being an alias for Map.Entry.
(Review ID: 132013)
======================================================================
java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)
Javadoc does not take into account the hiding of nested classes. For an example
of this, look at the documentation for Hashtable:
http://java.sun.com/j2se/1.4/docs/api/java/util/Hashtable.html
Notice that the documentation claims that Hashtable inherits Map.Entry, the nested type Entry from interface Map. However, according to javap -private,
Hashtable defines its own private nested type Entry which implements Map.Entry.
Therefore, Hashtable.Entry hides Map.Entry, and Hashtable does not inherit the
type Map.Entry after all.
As proof, try compiling this program. If the javadoc were correct, this should
be legal, and print "true":
import java.util.*;
class Foo {
public static void main(String[] args) {
System.out.println(Hashtable.Entry.class == Map.Entry.class);
}
}
But the result of javadoc is wrong, and the class doesn't even compile:
$ javac Foo.java
Foo.java:4: java.util.Hashtable.Entry has private access in java.util.Hashtable
System.out.println(Hashtable.Entry.class == Map.Entry.class);
^
1 error
On the other hand, you may decide that this is a library bug, and that Hashtable
should not define a nested class named Entry because it would hide the
(non-canonical) name Hashtable.Entry as being an alias for Map.Entry.
(Review ID: 132013)
======================================================================
- duplicates
-
JDK-4492178 stddoclet: javadoc incorrectly lists hidden fields
-
- Resolved
-