RFR: 8186958: Need method to create pre-sized HashMap [v21]
Stuart Marks
smarks at openjdk.java.net
Thu Apr 14 20:43:44 UTC 2022
On Thu, 14 Apr 2022 19:53:45 GMT, Bradford Wetmore <wetmore at openjdk.org> wrote:
>> XenoAmess has updated the pull request incrementally with one additional commit since the last revision:
>>
>> add `@LastModified: Apr 2022` to DocumentCache
>
> I learned something new about HashMap today...
>
> I looked at java.security.cert and sun.security.* and that part LGTM.
>
> That said, you need to check with @seanjmullan for the java.xml.crypto code. We try to keep the code in sync with the Apache code. As this is a new API, we probably can't push this kind of change to Apache as they need to support older releases.
Thanks @bradfordwetmore and @seanjmullan for looking at this, and @XenoAmess for following up quickly.
To summarize, it sounds like the only issues are with the changes to two files in the `java.xml.crypto` area, as those need to be maintained in sync with Apache Santuario. Right?
In both cases it looks like the HashMap is likely being under-allocated, so the fix would be to inline to capacity computation, something like `new HashMap<>((int) Math.ceil(length / 0.75))` I guess.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7928
More information about the security-dev
mailing list