JDK-8205593 : Javadoc -link makes broken links if module name matches package name
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 9,10,11
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2018-06-24
  • Updated: 2019-04-21
  • Resolved: 2018-09-25
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.2Fixed 12 b13Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Found on Java 10.0.1 on linux x86_64. Reproduced on Java 11 build 19.

A DESCRIPTION OF THE PROBLEM :
Where a class references a class in another module, and that module's javadoc is referenced with -link on the javadoc command line, the javadoc link for the other class has an incorrect href attribute, which points to the correct module but does not contain the path elements corresponding to the class's package. This bug only occurs if the target class is in a package which has the same name as the module it is part of.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a module a.b.c with a package a.b.c and a class a.b.c.MyClass. Compile the module to lib/abc.jar and create javadoc for it in /javadocs/abc

Create a second module d.e.f which depends on module a.b.c and uses a.b.c.MyClass. Run javadoc -link /javadocs/a.b.c --module-path lib  --source-path src/def src/def/d/e/f/MyClassClient.java



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The javadoc for MyClassClient will link references to MyClass to its javadoc at /javadoc/abc/a.b.c/a/b/c/MyClass.html

ACTUAL -
The javadoc for MyClassClient links references to MyClass to /javadoc/abc/MyClass.html . The package elements are missing from the URL path.

---------- BEGIN SOURCE ----------
git clone https://github.com/andrewmcguinness/javadoc_issue.git && cd javadoc_issue && ./build.sh

The master branch displays the bug. the "working" branch renames the target module to be different from the package name, and works correctly.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
If the module name a.b.c is changed to be different from the package name a.b.c, in the module-info.java files, everything works correctly

FREQUENCY : always



Comments
please - Never (Ever!) push changesets using backport IDs. This one will be let through. ---- 8211916: Javadoc -link makes broken links if module name matches package name Reviewed-by: jjg Contributed-by: priya.lakshmi.muthuswamy@oracle.com ----
16-10-2018

Fix Request: If we create documentation with JDK 11 javadoc and link it to exteral documentation(JDK 10/JDK 11 api), it creates broken links. Kindly refer https://bugs.openjdk.java.net/browse/JDK-8211194. This patch fixes the issue. We also got a request for backport regarding this issue(http://mail.openjdk.java.net/pipermail/javadoc-dev/2018-October/000669.html). Low risk. Sufficient tests are added. The Patch applies cleanly on JDK11u.
12-10-2018

In JDK 9 we have proper link created for DbClass, but no links generated for CoreClass. But this is also an issue.
25-06-2018

This issue is reproducible on 11 ea b19 == Broken link for CoreClass - javadoc/core/example/myproj/CoreClass.html?is-external=true Broken link for DbClass - javadoc/db/DbClass.html?is-external=true
25-06-2018