RFR: 8372055: Fragment link tag does not work in package info [v2]

Hannes Wallnöfer hannesw at openjdk.org
Wed Nov 26 09:08:45 UTC 2025


On Tue, 25 Nov 2025 17:13:50 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review feedback
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java line 166:
> 
>> 164:                 // Unqualified local anchor link
>> 165:                 return htmlWriter.links.createLink(HtmlId.of(refFragment), labelContent);
>> 166:             }
> 
> Why do we need a new if here? Does this not fall into the `else if (refFragment == null) {` block somehow?

`refFragment` is not null here, `ref` is, which is the referenced element. This is necessary for unqualified hash fragment links in doc-files, where the referenced element is set to `null` in `JavacTrees`. We know that local links in doc-files will never be used outside of the doc-file itself (for example in summary or index pages), so we can always create a simple local hash fragment link. 

I've updated the comment to say that this is for doc-files.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28372#discussion_r2564096439


More information about the javadoc-dev mailing list