On Fri, 17 Jun 2022 06:50:24 GMT, Johannes Kuhn <jk...@openjdk.org> wrote:

>> src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java 
>> line 165:
>> 
>>> 163:                 onlyBuiltIn = p -> 
>>> VM.isSystemDomainLoader(p.type().getClassLoader());
>>> 164:             } else {
>>> 165:                 onlyBuiltIn = p -> true;
>> 
>> Should this variable be renamed to something else? Because right now it does 
>> the opposite of it's name. i.e. When `onlyBuiltIn` is set to `true`, like 
>> here, the code a few lines below which filters the stream accepts all 
>> `RandomGeneratorFactory` implementations that have been found.
>
> Good idea. Naming is hard - and I don't have a good name. Maybe `allowType`?
> 
> On second thought, I could change it to `Stream<...> s = ...; if (...) {s = 
> s.filter(...)}`.

I think what you have with the filter call is fine. I think just renaming the 
`onlyBuiltIn` variable should be enough. Perhaps rename it to 
`acceptedProviders`?

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

PR: https://git.openjdk.org/jdk/pull/9180

Reply via email to