RFR: 8334015: Add Support for UUID Version 7 (UUIDv7) defined in RFC 9562 [v3]

Roger Riggs rriggs at openjdk.org
Thu Sep 4 21:26:27 UTC 2025


On Tue, 20 May 2025 19:25:13 GMT, Philippe Marschall <duke at openjdk.org> wrote:

>> Kieran Farrell has refreshed the contents of this pull request, and previous commits have been removed. Incremental views are not available.
>
> src/java.base/share/classes/java/util/UUID.java line 242:
> 
>> 240:         ns['C'] = 12;
>> 241:         ns['D'] = 13;
>> 242:         ns['E'] = 14;
> 
> It's a bit unfortunate that `SecureRandom#nextBytes(byte[])` does not allow us to pass an offset and length. Here we generate 16 bytes of random data but throw the first 8 bytes away.

In the meantime,  `SecureRandom.nextLong()` has been implemented.
Composing the two longs from the timestamp and the random will take fewer lines of code.
8357915: SecureRandom nextLong memory usage

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25303#discussion_r2323556652


More information about the core-libs-dev mailing list