On Thu, 23 Jun 2022 08:56:08 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:

>> BTW, this can utilize the new `HashMap.newHashMap()`, although I don't think 
>> resizing would be occurring in this case.
>
>> once this fix makes it to the repository, the build will be reproducible
> 
> Yes, we always produce the same source code. Given the same order of 
> modifications, a hashmap will produce the same iteration order.
> 
>> LinkedHashMap could be used to retain the iteration order.
> 
> Just added. The input maps were always sorted in some order (they were either 
> LinkedHashMaps or TreeMaps), and now we preserve that order.
> This means a lot of changes in the generated output files now, but hopefully 
> in the future the changes will be much easier to review.
> 
> TIL: `put` / `putIfAbsent` on an existing entry does not change the iteration 
> order of a `LinkedHashMap` unless `accessOrder` is true.

> BTW, this can utilize the new `HashMap.newHashMap()`, although I don't think 
> resizing would be occurring in this case.

It may occur if there are very few duplicates. Still, the performance impact of 
proper sizing is minimal here.

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

PR: https://git.openjdk.org/jdk/pull/9243

Reply via email to