RFR: 8202617: javadoc generates broken links to undocumented (e.g. private) members [v2]
Nizar Benalla
nbenalla at openjdk.org
Thu Nov 7 14:44:30 UTC 2024
On Tue, 5 Nov 2024 14:55:40 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
>> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
>>
>> whitespace
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java line 253:
>
>> 251: if (refSignature.trim().startsWith("#") &&
>> 252: ! (utils.isPublic(containing) || utils.isLinkable(containing)) &&
>> 253: ! (utils.isPrivate(refMem) || utils.isPackagePrivate(refMem))) {
>
> While this fixes the problem in the common case, it hard-codes the accessibility level for linked members to protected and public, and also prevents us from printing a warning for private/package private members a few lines below.
>
> What I suggest to do instead of this is to add a check if `refMem` is **selected** in line 257/258:
>
> if (utils.configuration.docEnv.isSelected(refMem)
> && htmlWriter instanceof ClassWriter cw) {
>
> This takes care of the selected access level (`-private`, `-package`, `-protecdted` etc) and also should cause a warning to be generated for unselected private members.
Fixed in [bfc30e0](https://github.com/openjdk/jdk/pull/21802/commits/bfc30e0bdf09fd8e56343262fc123fb3da0a42b2), thanks for the Terminology link.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21802#discussion_r1832799023
More information about the javadoc-dev
mailing list