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

Raffaello Giulietti rgiulietti at openjdk.org
Mon Sep 22 16:02:11 UTC 2025


On Thu, 4 Sep 2025 21:10:52 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> 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

@kieran-farrell Is there a last-minute plan to make use of `nextLong()` as suggested by @RogerRiggs?
Otherwise looks good

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

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


More information about the core-libs-dev mailing list