RFR: 8279598: Provide adapter from RandomGenerator to Random [v10]
Yasser Bazzi
duke at openjdk.java.net
Fri Feb 25 23:33:58 UTC 2022
On Fri, 25 Feb 2022 23:05:48 GMT, Marcono1234 <duke at openjdk.java.net> wrote:
>> Yasser Bazzi has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Use var instead of ArrayList raw
>>
>> Co-authored-by: liach <7806504+liach at users.noreply.github.com>
>
> src/java.base/share/classes/java/util/Random.java line 93:
>
>> 91:
>> 92: @SuppressWarnings("serial")
>> 93: private static class RandomWrapper extends Random implements RandomGenerator {
>
> Isn't ` implements RandomGenerator` redundant because `Random` already implements `RandomGenerator`?
I prefered to keep the interface explicit to the reader
> src/java.base/share/classes/java/util/Random.java line 107:
>
>> 105: return rand;
>> 106:
>> 107: return (Random) new Random.RandomWrapper(random);
>
> Isn't the `(Random)` cast redundant?
Eclipse did not complain about it being redundant, also it does not impact the reading of it and it shows the reader it is a Random instance that is returning
-------------
PR: https://git.openjdk.java.net/jdk/pull/7001
More information about the core-libs-dev
mailing list