RFR: 8202617: javadoc generates broken links to undocumented (e.g. private) members

Nizar Benalla nbenalla at openjdk.org
Thu Oct 31 11:52:36 UTC 2024


Please review this patch to prevent links to private and package-private members to be generated.
The bug happens when you link to private/package-private members, and javadoc used to generated links to them (assuming they were inherited because the holder is unreachable).

Taking the code path I changed is very rare, as it only used by 4 anchors in 4 classes in all the JDK.

if (refSignature.trim().startsWith("#") &&
                    ! (utils.isPublic(containing) || utils.isLinkable(containing))


The classes that used it are `StringBuilder`/`StringBuffer` with `#append(java.lang.String)` and `ZipEntry`/`ZipOutputStream` with `#CENHDR`


I've expanded the test to check whether the links are created when they should be.

The generated documentation before and after the change are identical.

-------------

Commit messages:
 - javadoc no longer generates broken links to undocumented fields

Changes: https://git.openjdk.org/jdk/pull/21802/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21802&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8202617
  Stats: 116 lines in 4 files changed: 45 ins; 63 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/21802.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21802/head:pull/21802

PR: https://git.openjdk.org/jdk/pull/21802


More information about the javadoc-dev mailing list