On Tue, 2 Jun 2026 02:49:40 GMT, Vladimir Petko <[email protected]> wrote:

> The top level type generation order is not deterministic due to the directory 
> listing being non-deterministic.
> Snippet ids are monotonically incremented during the javadoc run. This means 
> that the generated snippet ids are not reproducible. 
> This PR changes Set to the Map so that each page uses a separate snippet id 
> counter. 
> Alternatives:
>  - reset ids set when tagletWriter.htmlWriter changes
>  - list files in sorted order for javadoc generation
> 
> 
> 
> ==============================
> Test summary
> ==============================
>    TEST                                              TOTAL  PASS  FAIL ERROR  
> SKIP   
>    jtreg:test/langtools/jdk/javadoc                    398   397     0     0  
>    1   
> ==============================
> TEST SUCCESS
> 
> Finished building target 'test' in configuration 
> 'linux-x86_64-server-fastdebug'
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java
 line 128:

> 126:             pre.put(HtmlAttr.ID, id);
> 127:         } else {
> 128:             var set = ids.computeIfAbsent(tagletWriter.htmlWriter, k -> 
> new HashSet<>());

It might be better to use an unnamed parameter (`_`) here:
Suggestion:

            var set = ids.computeIfAbsent(tagletWriter.htmlWriter, _ -> new 
HashSet<>());

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31345#discussion_r3338852683

Reply via email to