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

javadoc fails if source is set to 8 and the -subpackages option is used

XMLWordPrintable

    • 9
    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      OS: Arch Linux
      Tested with javadoc 23, 17 (and javadoc 8, only works as expected with javadoc 8)

      java-23/java -version:
      openjdk version "23" 2024-09-17
      OpenJDK Runtime Environment (build 23)
      OpenJDK 64-Bit Server VM (build 23, mixed mode, sharing)

      java-17/java -version
      openjdk version "17.0.13" 2024-10-15
      OpenJDK Runtime Environment (build 17.0.13+11)
      OpenJDK 64-Bit Server VM (build 17.0.13+11, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      if javadoc is invoked with the -subpackages option and the source is set to 8, the program fails with an AssertionError (see the ActualResult section for a trace).


      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javadoc -source 8 -subpackages test
      # also fails with javadoc -source 8 -subpackages test test.pkg
      # also fails with javadoc -source 8 -subpackages test.pkg
      # also fails if -d and -sourcepath is used


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Something like:

      Loading source files for package test.pkg...
      Constructing Javadoc information...
      Building index for all the packages and classes...
      Standard Doclet version 23
      Building tree for all the packages and classes...
      Generating ./test/pkg/Test.html...
      ./test/pkg/Test.java:2: warning: no comment
      public class Test {
             ^
      ./test/pkg/Test.java:2: warning: use of default constructor, which does not provide a comment
      public class Test {
             ^
      Generating ./test/pkg/package-summary.html...
      Generating ./test/pkg/package-tree.html...
      Generating ./overview-tree.html...
      Generating ./allclasses-index.html...
      Building index for all classes...
      Generating ./allpackages-index.html...
      Generating ./index-all.html...
      Generating ./search.html...
      Generating ./index.html...
      Generating ./help-doc.html...
      2 warnings
      ACTUAL -
      Loading source files for package test...
      Constructing Javadoc information...
      error: fatal error encountered: java.lang.AssertionError
      error: Please file a bug against the javadoc tool via the Java bug reporting page
        (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com)
        for duplicates. Include error messages and the following diagnostic in your report. Thank you.
      java.lang.AssertionError
              at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
              at jdk.compiler/com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
              at jdk.compiler/com.sun.tools.javac.comp.Modules.allModules(Modules.java:1225)
              at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.findModuleOfPackageName(ElementsTable.java:873)
              at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.addPackagesFromLocations(ElementsTable.java:553)
              at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.computeSubpackages(ElementsTable.java:526)
              at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.computeSpecifiedPackages(ElementsTable.java:763)
              at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.analyze(ElementsTable.java:344)
              at jdk.javadoc/jdk.javadoc.internal.tool.JavadocTool.getEnvironment(JavadocTool.java:215)
              at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:579)
              at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:400)
              at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:349)
              at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:57)
              at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:46)
      2 errors

      ---------- BEGIN SOURCE ----------
      test.pkg.Test.java:
      package test.pkg;
      public class Test {
        // it does not really matter how the class looks like, as long as it is a valid java class
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      avoid the usage of -subpackages and list the package and all its subpackages instead when invoking javadoc

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: