Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4505328
Votes 0
Synopsis stddoclet: javadoc incorrectly lists hidden nested classes
Category doclet:tbd
Reported Against merlin-beta2
Release Fixed
State 11-Closed, duplicate of 4492178, bug
Priority: 4-Low
Related Bugs 4492178
Submit Date 20-SEP-2001
Description

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) 
======================================================================
Work Around




Use canonical classnames, rather than relying on javadoc output.  In other
words, don't expect Hashtable.Entry to be an alias for Map.Entry, even if the
javadoc claims it is so.
======================================================================
Evaluation
I think this is a doclet bug as javadoc does not
expose anything about which entities are inherited.
  xxxxx@xxxxx  

This seems closely related to 
bug 4492178 javadoc incorrectly lists hidden fields
  xxxxx@xxxxx   2001-12-08

This is the exact same bug as 4492178.  Both bugs show that doclets requires more information from Javadoc to detect member hiding.  I will mark this bug as a duplicate.
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang