JDK-8208269 : Javadoc does not support module-info in a multi-release jar
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 10,11,12
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2018-07-26
  • Updated: 2020-06-11
  • Resolved: 2018-08-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11.0.5Fixed 12 b08Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
java version "11-ea" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11-ea+23)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+23, mixed mode)

macOS 10.13.6

A DESCRIPTION OF THE PROBLEM :
See https://issues.apache.org/jira/browse/LOG4J2-2393. With log4j-api-2.10.0.jar entering
javadoc -verbose --module-path ~/.m2/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar -d temp ./module-info.java results in Javadoc finding the log4j-api module. However, javadoc -verbose --module-path ~/Downloads/log4j-api-2.11.0.jar -d temp ./module-info.java results in
Loading source file ./module-info.java...
./module-info.java:2: error: module not found: org.apache.logging.log4j
    requires org.apache.logging.log4j;

The difference here is that in log4j 2.10.0 module-info.class is at the root of the log4j-api jar. In log4j 2.11.0 module-info.class is located at META-INF/versions/9. This change was made at the advise of the Jigsaw dev list.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Download log4j-api-2.11.0.jar. 
2. Create a module info such as 
module my.test {
    requires org.apache.logging.log4j;
}
3. Run the command javadoc -verbose --module-path ./log4j-api-2.11.0.jar -d temp ./module-info.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Loading source file ./module-info.java...
[parsing started SimpleFileObject[/Users/rgoers/module-info.java]]
[parsing completed 13ms]
[loading /Users/rgoers/.m2/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar(/module-info.class)]
[loading /modules/java.base/module-info.class]
Constructing Javadoc information...
javadoc: error - No public or protected classes found to document.
[search path for source files: .]
[search path for class files: /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/lib/modules,.]
[done in 510 ms]
1 error
ACTUAL -
Loading source file ./module-info.java...
./module-info.java:2: error: module not found: org.apache.logging.log4j
    requires org.apache.logging.log4j;
                               ^
[parsing started SimpleFileObject[/Users/rgoers/module-info.java]]
[parsing completed 10ms]
[loading /modules/java.base/module-info.class]
[done in 326 ms]
1 error

FREQUENCY : always



Comments
Fix Request (11u) See the Log4J bug from the description and two linked bug reports: users need this fix in 11u. Patch applies cleanly to 11u. New test fails without the product patch, passes with it. Patched build passes langtools:tier{1,2}.
26-07-2019

There is a 11u backport request JDK-8222124
08-04-2019

Since javadoc or the standard doclet don't deal directly in multi-release jars, this may more likely be a problem in the underlying support in javac.
08-08-2018

This issue is reproducible, below is the output == -sh-4.2$ /scratch/fairoz/JAVA/jdk12/jdk-12-ea+02/bin/javadoc -verbose --module-path ./log4j-api-2.11.0.jar -d temp ./module-info.java Loading source file ./module-info.java... ./module-info.java:2: error: module not found: org.apache.logging.log4j requires org.apache.logging.log4j; ^ [parsing started SimpleFileObject[/scratch/fairoz/JI/9056228/module-info.java]] [parsing completed 12ms] [loading /modules/java.base/module-info.class] [done in 371 ms] 1 error -sh-4.2$
26-07-2018