On Sat, 12 Mar 2022 01:35:23 GMT, XenoAmess <d...@openjdk.java.net> wrote:
>> 8281631: HashMap copy constructor and putAll can over-allocate table > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > refine test There's already a bug for this: [JDK-8186958](https://bugs.openjdk.java.net/browse/JDK-8186958). This includes creating a new API as well as fixing up a bunch of call sites. There's a partial list of call sites in java.base there. Go ahead and open a PR if you like. I've added an initial suggestion at an API as a comment on that bug. There may be some bikeshedding about the API. If it gets too bad, a potential fallback position would be to create a JDK-internal utility method and call it instead, and sidestep the creation of a public API. (However, I do think we need a public API for this.) I'd avoid updating all the individual call sites with the actual computation `(int) (Math.ceil(expectedSize/0.75))` because we might want to change it in the future. ------------- PR: https://git.openjdk.java.net/jdk/pull/7431