JDK-8240194 : Improve/fix javadoc support for linking to docs for automatic modules
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 9,10,11,12,13,14,15
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2020-02-27
  • Updated: 2020-05-27
  • Resolved: 2020-02-28
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 15
15Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Imagine this scenario:

Write a package-oriented library PL1 (i.e. no module-info.java) and use javadoc to generate documentation. The generated docs will (obviously) have no mention of any module.

Write a second library PL2 that is also package-oriented and which references PL1 on the classpath, run javadoc and -linkoffine to the docs for PL1 All should be OK.

Now write a third library ML3 that *is* a module, that references PL1 as an automatic module on the module path. javac will be quite happy, because PL1 will be treated as an automatic module, synthesizing a module name from the name of the jar file. But javadoc will have trouble, because if you link to the docs for PL1, javadoc will not see any module info, and will thus have problems.

javadoc should be able to handle this case.
Comments
It may be that all we need to do is detect and use the inferred module name when analyzing the package-list given by the -link or -linkoffline option. It seems as though we ought to be able to read one or more package names from the package-list file, use PackageElement.getEnclosingElement to get the module name, and use that. We should allow for and handle the case where the -link option references docs for a package that is not associated with any package in any automatic module on the module path. We can decide whether to ignore the option, or give a warning.
27-02-2020