On Tue, Feb 23, 2016 at 7:20 AM, Ivan Gerasimov <[email protected]> wrote: > While writing this, I just noticed that I actually made a mistake when did > newCapacity < 0 check. > This wouldn't catch the overflow when the oldCapacity happens to be > Integer.MAX_VALUE (which is not possible with the current hotspot, but may > become an issue one day).
Well done! One interesting way that capacity may end up being Integer.MAX_VALUE is if we switch to char[] for storage. Then in LATIN1 mode you could store Integer.MAX_VALUE elements even without help from hotspot!
