JDK-8202617 : javadoc generates broken links to undocumented (e.g. private) members
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-05-03
  • Updated: 2024-11-19
  • Resolved: 2024-11-12
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 24
24 b24Fixed
Related Reports
Relates :  
Description
The doclet generates (broken) links to undocumented members, such as private members.

See test test/langtools/jdk/javadoc/doclet/5093723/T5093723.java
with JavadocTester.checkLinks
Comments
Changeset: b53ee053 Branch: master Author: Nizar Benalla <nbenalla@openjdk.org> Date: 2024-11-12 09:26:49 +0000 URL: https://git.openjdk.org/jdk/commit/b53ee053f7f7ffcf02ff47e1895ce7be4bc32486
12-11-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21802 Date: 2024-10-31 11:48:27 +0000
31-10-2024

Bug is still confirmed - October 14 2024
14-10-2024

Can you make sure that this is no longer an issue in the latest release?
10-10-2024

The warning is a red herrying ... here is the code if (ch.getText(see).trim().startsWith("#") && ! (utils.isPublic(containing) || utils.isLinkable(containing))) { // Since the link is relative and the holder is not even being // documented, this must be an inherited link. Redirect it. // The current class either overrides the referenced member or // inherits it automatically. if (this instanceof ClassWriterImpl) { containing = ((ClassWriterImpl) this).getTypeElement(); } else if (!utils.isPublic(containing)) { messages.warning( ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible", tagName, utils.getFullyQualifiedName(containing)); } else { messages.warning( ch.getDocTreePath(see), "doclet.see.class_or_package_not_found", tagName, seetext); } } It would be better to use ElementsTable.isIncluded when evaluating the tag.
09-11-2018

Presumably, the code for @see/{@link} should check whether the reference is included. The check must be partially present because of the warnings that were generated. $ grep -r "reference not accessible" open/src/jdk.javadoc open/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties:doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1} $ grep -r "class.or.package.not.accessible" open/src/jdk.javadoc open/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java: ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible", [deleted localizations] open/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties:doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
09-11-2018

The .jtr file contains the following (abridged) output: Creating destination directory: "out/" Standard Doclet version 12-internal Building tree for all the packages and classes... Generating out/DocumentedClass.html... Generating out/package-summary.html... Generating out/package-tree.html... Generating out/constant-values.html... Building index for all the packages and classes... Generating out/overview-tree.html... Generating out/index-all.html... .../test/langtools/jdk/javadoc/doclet/5093723/DocumentedClass.java:26: warning - Tag link: reference not accessible: UndocumentedClass .../test/langtools/jdk/javadoc/doclet/5093723/DocumentedClass.java:28: warning - Tag link: reference not accessible: UndocumentedClass .../test/langtools/jdk/javadoc/doclet/5093723/DocumentedClass.java:30: warning - Tag link: reference not accessible: UndocumentedClass /w/jjg/work/jdk.closed.dev/open/test/langtools/jdk/javadoc/doclet/5093723/DocumentedClass.java:32: warning - Tag link: reference not accessible: UndocumentedClass Building index for all classes... Generating out/allclasses-index.html... Generating out/allpackages-index.html... Generating out/deprecated-list.html... Building index for all classes... Generating out/index.html... Generating out/help-doc.html... 4 warnings Starting subtest 1.1: Check links out/DocumentedClass.html:188: id not found: out/DocumentedClass.html#privateMethod() out/DocumentedClass.html:282: id not found: out/DocumentedClass.html#privateMethod() out/DocumentedClass.html:167: id not found: out/DocumentedClass.html#method() out/DocumentedClass.html:252: id not found: out/DocumentedClass.html#method() External URLs: javascript:show(2); javascript:show(8); Checked 11 files. Found 183 references to 46 anchors in 13 files and 2 other URIs. 0 missing files 0 duplicate ids * 2 missing ids Schemes 2 javascript FAILED: 4 errors found when checking links at JavadocTester.checkLinks(JavadocTester.java:540) at JavadocTester.javadoc(JavadocTester.java:399) at T5093723.test(T5093723.java:44)
09-11-2018

Bug still confirmed 9 Nov 2018.
09-11-2018