RFR: Fix negative index OOB exception in string dedup stress test

Aleksey Shipilev shade at redhat.com
Thu Oct 18 06:52:56 UTC 2018


On 10/18/2018 02:09 AM, Zhengyu Gu wrote:
> It is indeed the result of Math.abs(Integer.MIN_VALUE) = Integer.MIN_VALUE, which is a negative
> value (-2147483648).
> 
> Webrev: http://cr.openjdk.java.net/~zgu/shenandoah/dedup_neg_index/webrev.00/

Consider using nextInt(int) instead:
 https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextInt-int-

There are two another nextInt usages in the same file that need to be fixed as well.

Also, un-quarantine the test, if you believe that is the last bug there.

-Aleksey



More information about the shenandoah-dev mailing list