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

javadoc fails with -sourcepath if module-info.java contains import statements

    XMLWordPrintable

Details

    • b21
    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      Running javadoc on a module whose module-info.java file contains import statements results in the output "error: module [name] not found on source path". Removing all import statements from module-info.java makes it work as expected. This may appear as a usage issue. However, I checked javadoc usage thoroughly and tried a lot to resolve this issue by improved usage, also reaching out to other developers, see https://stackoverflow.com/questions/77098070/javadoc-fails-in-presence-of-imports-in-module-info-java.
      It appears that javadoc should work correctly with the command provided (but doesn't). Even if some subtle usage issue should have been overlooked, at very least the error message should be improved.
      The issue can be reproduced also on OpenJDK 20.0.2 (earlier releases not tested).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      An example module to reproduce this is jdk.compiler. For that module, run for JDK 21 (with bin and source distributions in the according paths) (tested on Linux):

      .../jdk-21/bin/javadoc -sourcepath .../jdk-jdk-21-ga/src/jdk.compiler/share/classes -subpackages com:jdk:sun --module jdk.compiler -verbose


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected result is the behavior one gets from the command above after out-commenting the import statements in the module-info.java file of jdk.compiler. That is, javadoc of the module is generated in the current working directory.
      ACTUAL -
      [parsing started SimpleFileObject[.../jdk-jdk-21-ga/src/jdk.compiler/share/classes/module-info.java]]
      [parsing completed 38ms]
      error: module jdk.compiler not found on source path
      1 error

      CUSTOMER SUBMITTED WORKAROUND :
      Out-commenting all import statements from the affected module-info.java file.

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              prappo Pavel Rappo
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: