On Tue, 25 Nov 2025 17:13:50 GMT, Chen Liang <[email protected]> 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

Reply via email to