Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6442982

Javadoc crashes with ClasscastException when processing annotations

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
      Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Versione 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      javadoc exists with a classcastexception when trying to process annotations.

      The stack trace is:

      java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl
              at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46)
              at com.sun.tools.doclets.internal.toolkit.util.Util.isDeprecated(Util.java:804)
              at com.sun.tools.doclets.formats.html.TagletWriterImpl.deprecatedTagOutput(TagletWriterImpl.java:70)
              at com.sun.tools.doclets.internal.toolkit.taglets.DeprecatedTaglet.getTagletOutput(DeprecatedTaglet.java:40)
              at com.sun.tools.doclets.formats.html.HtmlSerialFieldWriter.writeMemberDeprecatedInfo(HtmlSerialFieldWriter.java
      :96)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildFieldInfo(SerializedFormBuilder.ja
      va:444)
              at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java
      :131)
              at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildSerializableFields(SerializedFormB
      uilder.java:482)
              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:585)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java
      :131)
              at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildClassSerializedForm(SerializedForm
      Builder.java:185)
              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:585)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java
      :131)
              at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildPackageSerializedForm(SerializedFo
      rmBuilder.java:167)
              at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java
      :131)
              at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildSerializedFormSummaries(Serialized
      FormBuilder.java:148)
              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:585)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java
      :131)
              at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildSerializedForm(SerializedFormBuild
      er.java:116)
              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:585)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java
      :131)
              at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
              at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.build(SerializedFormBuilder.java:101)
              at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateOtherFiles(AbstractDoclet.java:137)
              at com.sun.tools.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:66)
              at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:122)
              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 gr.spinellis.umlgraph.doclet.UmlDoc.start(UmlDoc.java:48)
              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:585)
              at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
              at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
              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)


      The bug is triggered by two tools I know of, maven and annogen, when runnig the standard doclet (so, not from command line, but from an external application that calls com.sun.tools.javadoc.Main.
      Unfortunately I don't have a test case for it, but you can refer to the associated bug reports on the maven and annogen issue trackers:

      http://jira.codehaus.org/browse/ANNOGEN-14
      http://jira.codehaus.org/browse/MJAVADOC-72


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Activity

        Hide
        sseligmasunw Scott Seligman (Inactive) added a comment -
        BT2:EVALUATION

        The Annogen bug report says:
          There seems to be a bug in 1.5 javadoc that comes up when trying to get
          annotations of types that are not correctly imported in the source file.

        When an annotation's type is erroneous, DocEnv.getClassDoc may return
        a ClassDocImpl to AnnotationDescImpl.annotationType. Perhaps it should
        return an AnnotationTypeDocImpl instead. Or else
        AnnotationDescImpl.annotationType must be smarter about checking for
        error conditions.
        Show
        sseligmasunw Scott Seligman (Inactive) added a comment - BT2:EVALUATION The Annogen bug report says:   There seems to be a bug in 1.5 javadoc that comes up when trying to get   annotations of types that are not correctly imported in the source file. When an annotation's type is erroneous, DocEnv.getClassDoc may return a ClassDocImpl to AnnotationDescImpl.annotationType. Perhaps it should return an AnnotationTypeDocImpl instead. Or else AnnotationDescImpl.annotationType must be smarter about checking for error conditions.

          People

          • Assignee:
            Unassigned
            Reporter:
            rmandalasunw Ranjith Mandala (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Imported:
              Indexed: