RFR: 8346659: SnippetTaglet should report an error if provided ambiguous links [v6]

Nizar Benalla nbenalla at openjdk.org
Fri Feb 21 15:23:55 UTC 2025


On Fri, 21 Feb 2025 15:17:04 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:
>> 
>>   fix test bug
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java line 152:
> 
>> 150:                                         linkTarget,
>> 151:                                         l.target(),
>> 152:                                         content.asCharSequence().toString().trim());
> 
> Would have beein interesting to use the error message that takes additional `start`, `pos` and `end` parameters to point to the location of the conflicting link inside the snippet. Worth a try if you're inclined, but not required.
> Thanks for renaming the var!

Will give it another shot, getting a correct end position wasn't very straightforward

> test/langtools/jdk/javadoc/doclet/ReproducibleSnippet/ReproducibleSnippetTest.java line 76:
> 
>> 74:                 "#a",
>> 75:                 "One#ab",
>> 76:                 "overlap in obj1.ab(a());\n     * {@snippet lang = java:\n       ^");
> 
> Why did you revert from using a text block for the whole message?

The error message changes slightly on every run, since the order is different when we read the references.
IIRC it's due to this https://github.com/openjdk/jdk/blob/dfcd0df60c60cf89dc01682264a573ad39e61a17/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java#L147
I left a comment above showing the difference between two javadoc runs

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

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


More information about the javadoc-dev mailing list