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

Nizar Benalla nbenalla at openjdk.org
Fri Nov 8 13:52:28 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.

Nizar Benalla has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - change if statement order
 - Merge remote-tracking branch 'upstream/master' into 8202617-javadoc-generates-broken-links-to-undocumented
 - check if refMem is selected
 - Merge remote-tracking branch 'upstream/master' into 8202617-javadoc-generates-broken-links-to-undocumented
 - whitespace
 - javadoc no longer generates broken links to undocumented fields
   expand test
   (C)

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21802/files
  - new: https://git.openjdk.org/jdk/pull/21802/files/bfc30e0b..0f10f99a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21802&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21802&range=02-03

  Stats: 2111 lines in 87 files changed: 1408 ins; 291 del; 412 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