JDK-6709246 : ClassCastException in javadoc
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-05-30
  • Updated: 2011-07-15
  • Resolved: 2011-07-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b73Fixed
Description
I can make javadoc blow up with a ClassCastException. This is Bad.

in p/package-info.java
-------------------------
/** This is package p. */
@Deprecated
@q.Anno
package p;
-------------------------

in p/A.java
-------------------------
package p;
/** This is class A. */
public class A { }
-------------------------


in q/Anno.java
-------------------------
package q;
@interface Anno { }
-------------------------



Then...

jjg@j2gnotebook:/w/jjg/work/javadoc$ javadoc -d play/api play/{p,q}/*.java
Loading source file play/p/A.java...
Loading source file play/p/package-info.java...
Loading source file play/q/Anno.java...
Constructing Javadoc information...
play/p/package-info.java:3: q.Anno is not public in q; cannot be accessed from outside package
@q.Anno
  ^
Standard Doclet version 1.6.0_03
Building tree for all the packages and classes...
Generating play/api/p//A.html...
Generating play/api/p//package-frame.html...
Generating play/api/p//package-summary.html...
java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc
        at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46)
        at com.sun.tools.doclets.formats.html.HtmlDocletWriter.getAnnotations(HtmlDocletWriter.java:1739)
        at com.sun.tools.doclets.formats.html.HtmlDocletWriter.writeAnnotationInfo(HtmlDocletWriter.java:1713)
        at com.sun.tools.doclets.formats.html.HtmlDocletWriter.writeAnnotationInfo(HtmlDocletWriter.java:1702)
        at com.sun.tools.doclets.formats.html.HtmlDocletWriter.writeAnnotationInfo(HtmlDocletWriter.java:1672)
        at com.sun.tools.doclets.formats.html.PackageWriterImpl.writePackageHeader(PackageWriterImpl.java:174)
        at com.sun.tools.doclets.internal.toolkit.builders.PackageSummaryBuilder.buildPackageHeader(PackageSummaryBuilder.java:121)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.PackageSummaryBuilder.invokeMethod(PackageSummaryBuilder.java:81)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.PackageSummaryBuilder.buildPackageDoc(PackageSummaryBuilder.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.PackageSummaryBuilder.invokeMethod(PackageSummaryBuilder.java:81)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.PackageSummaryBuilder.build(PackageSummaryBuilder.java:92)
        at com.sun.tools.doclets.formats.html.HtmlDoclet.generatePackageFiles(HtmlDoclet.java:183)
        at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:120)
        at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
        at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
        at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:215)
        at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:91)
        at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
        at com.sun.tools.javadoc.Start.begin(Start.java:128)
        at com.sun.tools.javadoc.Main.execute(Main.java:41)
        at com.sun.tools.javadoc.Main.main(Main.java:31)
Generating play/api/p//package-tree.html...
Generating play/api/constant-values.html...
Building index for all the packages and classes...
Generating play/api/overview-tree.html...
Generating play/api/index-all.html...
Generating play/api/deprecated-list.html...
Building index for all classes...
Generating play/api/allclasses-frame.html...
Generating play/api/allclasses-noframe.html...
Generating play/api/index.html...
Generating play/api/help-doc.html...
Generating play/api/stylesheet.css...
1 warning

Comments
EVALUATION Fix submitted by Google.
2009-09-08