-
Bug
-
Resolution: Fixed
-
P4
-
21, 22
-
b21
-
generic
-
generic
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
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