RFR: 8308803: Improve java/util/UUID/UUIDTest.java [v2]

Aleksey Shipilev shade at openjdk.org
Tue May 30 09:15:15 UTC 2023


On Mon, 29 May 2023 06:48:10 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review comments
>
> test/jdk/java/util/UUID/UUIDTest.java line 40:
> 
>> 38:     private static final int COUNT = 1_000_000;
>> 39: 
>> 40:     static final Random generator = new Random();
> 
> Hello Aleksey, I realize this is unrelated to the changes in this PR, but since we are updating this test, would using `jdk.test.lib.RandomFactory.getRandom()` from test library be a better idea here? That would then print the seed in the logs and could help debug any collisions more easily?

Yes, good idea, added.

> test/jdk/java/util/UUID/UUIDTest.java line 316:
> 
>> 314:             UUID u2 = UUID.fromString(u1.toString());
>> 315:             if (u1.hashCode() != u2.hashCode()) {
>> 316:                 throw new Exception("Equal UUIDs with different hash codes: " + u1 + " and " + u2);
> 
> Perhaps we should even print the hash codes that weren't matching to provide assistance when debugging?

Yes, added.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14134#discussion_r1209976093
PR Review Comment: https://git.openjdk.org/jdk/pull/14134#discussion_r1209978619


More information about the core-libs-dev mailing list