RFR: 8279598: Provide adapter from RandomGenerator to Random [v6]
liach
duke at openjdk.java.net
Fri Feb 25 23:01:54 UTC 2022
On Tue, 22 Feb 2022 23:19:14 GMT, Marcono1234 <duke at openjdk.java.net> wrote:
>> Yasser Bazzi has updated the pull request incrementally with one additional commit since the last revision:
>>
>> remove missed whitespace
>
> src/java.base/share/classes/java/util/Random.java line 298:
>
>> 296: */
>> 297: public static Random from(RandomGenerator random) {
>> 298: return RandomWrapper.wrap(random);
>
> Might be good to check here or in the called methods / constructors for `null`. Currently `null` would not be noticed until the first method is called on the created `Random`, which makes it difficult for the user to track down bugs in their code.
Suggestion:
Objects.requireNonNull(random);
return RandomWrapper.wrap(random);
fyi this is the original change suggested by marcono1234. Notice that this might need a csr update; maybe a javadoc update is needed too
-------------
PR: https://git.openjdk.java.net/jdk/pull/7001
More information about the core-libs-dev
mailing list