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

javadoc throws NPE with --ignore-source-errors option

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      9
    • Resolved In Build:
      b27
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      $ java -version
      openjdk version "11.0.11" 2021-04-20
      OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
      OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      Generating javadoc for a class using generics and extending another class, the process fails when the other class is not available. This worked previously with JDK 8, but fails with JDK 11 and 16.

      REGRESSION : Last worked in version 8u291

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a source file with the contents specified in "Source code for an executable test case"
      2. ${JAVA_HOME}/bin/javadoc Test.java
      3. ${JAVA_HOME}/bin/javadoc --ignore-source-errors Test.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The HTML files are generated.
      ACTUAL -
      Without "--ignore-source-errors", the process exits with an error.

      When adding "--ignore-source-errors", there is an exception:

      Generating ./package-summary.html...
      Generating ./package-tree.html...
      javadoc: error - An internal exception has occurred.
      (java.lang.NullPointerException)
      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.NullPointerException
      at jdk.compiler/com.sun.tools.javac.code.Types.erasure(Types.java:2340)
      at jdk.compiler/com.sun.tools.javac.code.Types$14.visitTypeVar(Types.java:2398)
      at jdk.compiler/com.sun.tools.javac.code.Types$14.visitTypeVar(Types.java:2348)
      at jdk.compiler/com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1659)
      at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4857)
      at jdk.compiler/com.sun.tools.javac.code.Types.erasure(Types.java:2343)
      at jdk.compiler/com.sun.tools.javac.code.Types.erasure(Types.java:2329)
      at jdk.compiler/com.sun.tools.javac.model.JavacTypes.erasure(JavacTypes.java:134)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils$5.visitTypeVariable(Utils.java:1069)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils$5.visitTypeVariable(Utils.java:1048)
      at jdk.compiler/com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1695)
      at java.compiler@11.0.11/javax.lang.model.util.AbstractTypeVisitor6.visit(AbstractTypeVisitor6.java:104)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.asTypeElement(Utils.java:1086)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.setContext(LinkInfoImpl.java:410)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.<init>(LinkInfoImpl.java:285)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.LinkFactoryImpl.getTypeParameterLink(LinkFactoryImpl.java:184)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.LinkFactoryImpl.getTypeParameterLinks(LinkFactoryImpl.java:167)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.links.LinkFactory.getLink(LinkFactory.java:196)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.getLink(HtmlDocletWriter.java:679)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addPreQualifiedClassLink(HtmlDocletWriter.java:814)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addPreQualifiedStrongClassLink(HtmlDocletWriter.java:839)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractTreeWriter.addPartialInfo(AbstractTreeWriter.java:185)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractTreeWriter.addLevelInfo(AbstractTreeWriter.java:92)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractTreeWriter.addLevelInfo(AbstractTreeWriter.java:94)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractTreeWriter.addTree(AbstractTreeWriter.java:129)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractTreeWriter.addTree(AbstractTreeWriter.java:112)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.PackageTreeWriter.generatePackageTreeFile(PackageTreeWriter.java:115)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.PackageTreeWriter.generate(PackageTreeWriter.java:92)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generatePackageFiles(HtmlDoclet.java:312)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:210)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:114)
      at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72)
      at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:588)
      at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:432)
      at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:345)
      at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
      at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)

      ---------- BEGIN SOURCE ----------
      import invalid.example.OtherClass;

      public class Test<T> extends OtherClass<T> {

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use JDK 8 to build the javadoc.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: