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

Hannes Wallnöfer hannesw at openjdk.org
Fri Feb 21 15:23:54 UTC 2025


On Fri, 21 Feb 2025 15:13:08 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

>> Some javadoc snippets can match multiple links to the same content, leading to different results in different javadoc runs.
>> This patch proposes emitting an error when such cases are encountered.
>> 
>> There is a very trivial, unrelated change in `TestGlobalHtml.java` because I noticed some whitespace wasn't right.
>
> 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!

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

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


More information about the javadoc-dev mailing list