On 2/8/22 5:51 PM, Xeno Amess wrote:
I agree that it would be preferable for the expression to be something like this: (int) Math.ceil(expected / 0.75) Agree. If we don't add a Java SE utility like "newHashMapWithExpectedSize", fallbacks would be to introduce an internal JDK utility method that is called from various places, or just to update the individual call sites to use the more precise calculation. Both seem acceptable. So what should I do next?
OK. I'd say the first thing is to file a bug at bugs.java.com. Include the test cases from your message at the start of the thread. I think they illustrate the issue pretty nicely. At some point this will show up in the main bug database, though with a different number from the one it was initially assigned.
Then, make a fork of the OpenJDK repo on GitHub and start a pull request. I'd suggest initially just changing the internal computations of HashMap et. al. Adding a new API and updating all the callers is a bigger deal and is probably better handled separately.
In the PR, include the reference number from the bug you filed. This is helpful, even though we know it will be different from the eventual bug ID. A bot will wake up and tell you to sign the OCA if you haven't already done so.
This will all take a little time. After that, I can help make sure the PR is linked up properly to the bug report, and then we can go from there.
Further info about the development process is in the Developers' Guide: http://openjdk.java.net/guide/ Thanks, s'marks