RFR: jsr166 jdk9 integration wave 14

Stuart Marks stuart.marks at oracle.com
Wed Feb 1 21:23:25 UTC 2017

On 2/1/17 12:52 PM, Martin Buchholz wrote:
> Wave 14 now contains a bug fix for a minor mistake in a previous wave.
> https://bugs.openjdk.java.net/browse/JDK-8173706
> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/Vector-setSize/

Hi Martin, thanks for picking this up.

The Vector change and corresponding test change look good.

One observation I have (which might have contributed to the bug) is that the 
method relies on the array access within the for-loop to throw AIOOBE if the new 
size is negative. This is pretty obscure.

Conventionally, the precondition would be checked at the top of the method. (But 
that might increase the method size beyond the inlining limit. (But who cares 
about Vector anyway?))

An alternative might be simply to put a comment noting this at the location of 
the array index. This adds some clutter; I'm not sure it's worth it.

Or maybe do nothing, and let this remain as one of the "things you have to look 
out for" when deailng with collections code.

I don't have strong opinions favoring any of these, but if you have thoughts I'd 
be interested in hearing them.


More information about the core-libs-dev mailing list