RFR: 5023614: UUID needs methods to get most/leastSigBits and write to DataOutput [v2]
Richard Fussenegger
github.com+1059453+fleshgrinder at openjdk.java.net
Sat Nov 28 10:12:11 UTC 2020
On Thu, 26 Nov 2020 19:08:54 GMT, Richard Fussenegger <github.com+1059453+Fleshgrinder at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/UUID.java line 168:
>>
>>> 166: /**
>>> 167: * Constructs a new {@code UUID} using the specified data. {@code
>>> 168: * mostSigBits} is used for the most significant 64 bits of the {@code
>>
>> I think you need to agreement first on whether to add this API. Maybe there is a case for a new factory method rather than a constructor? Are there any concerns with creating UUIDs with random bytes.
>>
>> If it goes ahead then I assume the the javadoc will need a bit of work to specify how the byte[] is mapped to the 128-bit value.
>>
>> You might need to tweak a few other things like the javadoc styles and coding style to get it consistent with the existing code. That's for later.
>
> Hey @AlanBateman I figured that most of the PRs I just created for UUID will require a CSR but I what couldn't figure out is/was how _I_ can create a CSR.
>
> 1. Constructor or factory, I would be fine with both and happily change the impl.
> 1. We de-facto already allow the construction from random data through the `UUID(long, long)` constructor.
> 1. No problem either.
> 1. I had a look at the whole (well, sampling) JDK and various documents ([super, super, like 1999 old documents](https://www.oracle.com/java/technologies/javase/codeconventions-introduction.html)) and loaded the Oracle code style in IntelliJ. However, all I get is inconsistent. The existing files in the JDK are inconsistent. The UUID file is inconsistent in itself. The IntelliJ Oracle style is different too… I'm happy to change any line but would prefer it if there is some guidance with what is expected because I cannot figure it out on my own.
1. Changed it to static factory `valueOf`
2. —
3. I extended the documentation.
4. I tried to match the existing formatting as good as possible.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1465
More information about the core-libs-dev
mailing list