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

javadoc fails with ClassCastException on {@link byte[]}

    Details

    • Subcomponent:
    • Introduced In Build:
      b147
    • Introduced In Version:
      9
    • Resolved In Build:
      b22
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "9.0.4"
        Java(TM) SE Runtime Environment (build 9.0.4+11)
        Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 10.0.16299.309]

        A DESCRIPTION OF THE PROBLEM :
        When a Javadoc comment contains "@{link byte[]}", the javadoc tool crashes with a ClassCastException because of it

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        * create a file Issue.java with the source below
        * run the command: javadoc Issue.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Javadoc is generated
        ACTUAL -
        the javadoc tool crashes with a ClassCastException

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Loading source file Issue.java...
        Constructing Javadoc information...
        Standard Doclet version 9.0.4
        Building tree for all the packages and classes...
        Generating .\Issue.html...
        javadoc: error - An exception occurred while building a component: ClassDescription
                (java.lang.ClassCastException: jdk.compiler/com.sun.tools.javac.code.Symtab$6 cannot be cast to jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol)
        Please file a bug against the javadoc tool via the Java bug reporting page
        (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
        for duplicates. Include error messages and the following diagnostic in your report. Thank you.
        java.lang.ClassCastException: jdk.compiler/com.sun.tools.javac.code.Symtab$6 cannot be cast to jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol
                at jdk.compiler/com.sun.tools.javac.code.Symbol.outermostClass(Symbol.java:492)
                at jdk.javadoc/jdk.javadoc.internal.tool.ToolEnvironment.getFileKind(ToolEnvironment.java:196)
                at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.isTypeElementSelected(ElementsTable.java:985)
                at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.access$400(ElementsTable.java:158)
                at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable$IncludedVisitor.visitType(ElementsTable.java:1062)
                at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable$IncludedVisitor.visitType(ElementsTable.java:1038)
                at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.accept(Symbol.java:1432)
                at java.compiler@9.0.4/javax.lang.model.util.AbstractElementVisitor6.visit(AbstractElementVisitor6.java:106)
                at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.isIncluded(ElementsTable.java:333)
                at jdk.javadoc/jdk.javadoc.internal.tool.DocEnvImpl.isIncluded(DocEnvImpl.java:85)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.isIncluded(Utils.java:2708)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.LinkFactoryImpl.getClassLink(LinkFactoryImpl.java:92)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.links.LinkFactory.getLink(LinkFactory.java:193)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.getLink(HtmlDocletWriter.java:1191)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.seeTagToContent(HtmlDocletWriter.java:1565)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter$2.visitLink(HtmlDocletWriter.java:1949)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter$2.visitLink(HtmlDocletWriter.java:1797)
                at jdk.compiler/com.sun.tools.javac.tree.DCTree$DCLink.accept(DCTree.java:500)
                at jdk.compiler/com.sun.source.util.SimpleDocTreeVisitor.visit(SimpleDocTreeVisitor.java:79)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.commentTagsToContent(HtmlDocletWriter.java:2017)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addCommentTags(HtmlDocletWriter.java:1719)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addCommentTags(HtmlDocletWriter.java:1700)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addInlineComment(HtmlDocletWriter.java:1686)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.ClassWriterImpl.addClassDescription(ClassWriterImpl.java:357)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildClassDescription(ClassBuilder.java:310)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:564)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:157)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.buildChildren(AbstractBuilder.java:200)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildClassInfo(ClassBuilder.java:181)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:564)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:157)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.buildChildren(AbstractBuilder.java:200)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildClassDoc(ClassBuilder.java:155)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:564)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:157)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.build(ClassBuilder.java:125)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:263)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:286)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:268)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:207)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:117)
                at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72)
                at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:574)
                at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:423)
                at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:340)
                at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
                at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
        1 error

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        /**
         * See {@link byte[]}
         */
        public class Issue {
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        The obvious workaround is to delete the @link (or at least the square brackets causing the issue). However, since these constructs occur in sources which are generated during the build process, and Javadoc is generated during the same build process, it's not trivial to apply the workaround in my case.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  hannesw Hannes Wallnoefer
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: