Hello!

When a WeakHashMap is constructed from another Map m, then the initial capacity is calculated as

(int) (m.size() / DEFAULT_LOAD_FACTOR) + 1.

For large values of m.size() this becomes negative due to integer overflow.

The result is that the WeakHashMap is initially constructed with the default initial capacity 16, and then is immediately resized.

Would you please help review a trivial patch?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8207314
WEBREV: http://cr.openjdk.java.net/~igerasim/8207314/00/webrev/

Thanks in advance!

--
With kind regards,
Ivan Gerasimov

Reply via email to