On Wed, 26 Feb 2025 08:46:07 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:

>> Nizar Benalla has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   trim error message
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java
>  line 151:
> 
>> 149:                                 var body = tag.getBody().toString();
>> 150:                                 var pos = ((DCSnippet) 
>> tag).getStartPosition()
>> 151:                                         + 
>> Math.max(body.indexOf(linkTarget), body.indexOf(l.target()));
> 
> Doing a `String.indexOf` on the snippet body is not a good way to do this. It 
> will often return the wrong result, especially if the link target is a class 
> name. 
> 
> Sorry Nizar, I was not aware that we don't have any position information 
> anymore at this point when I suggested to look into this. After reading the 
> code, it seems we'd have to check for this condition earlier in the 
> `snippet.Parser` code in order to get a reliable position within the snippet.
> 
> I suggest to for now go back to the previous version that just reports the 
> start of the snippet tag, and maybe file a bug to find a better solution, but 
> I would say it isn't a high priority issue.

I've reverted those changes. If the current error message appears to not be 
clear enough then I'll revisit it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23328#discussion_r1971826323

Reply via email to