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

Nizar Benalla nbenalla at openjdk.org
Tue Feb 25 17:45:05 UTC 2025


On Tue, 25 Feb 2025 17:39:24 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:
> 
>   trim error message

Thanks for the hint, I trimmed the line where the links overlapped to only include the first line using a regex.
Besides the regex, the code is now simpler.


nizar-mac! $ javadoc -d ./out One.java
Loading source file One.java...
Constructing Javadoc information...
Building index for all the packages and classes...
Standard Doclet version 25-internal-LTS-2025-02-20-1634195.nizarbenalla...
Building tree for all the packages and classes...
Generating ./out/p/One.html...
One.java:12: warning: no @return
    int a();
        ^
One.java:2: warning: no comment
public interface One {
       ^
One.java:3: warning: no comment
   int j=0;
       ^
One.java:8: error: snippet link tags: One#ab and #a overlap in 
     * // @link substring="ab" target="One#ab" :
                                       ^
One.java:13: warning: no comment
    void ab(int i);
         ^

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

PR Comment: https://git.openjdk.org/jdk/pull/23328#issuecomment-2682826945


More information about the javadoc-dev mailing list