On Tue, 6 Sep 2022 14:10:16 GMT, Weijun Wang <wei...@openjdk.org> wrote:

>> Both may be null as their javadoc didn't state explicitly what is returned.
>> This is existing code and it returns null upon empty keySet which I keep the 
>> same behavior. 
>> Perhaps for consistency sake, it should also check for the empty keySet 
>> condition and return allProviders.
>
> Sorry, I re-read and maybe the original check is better. If both `keySet` and 
> `allProviders` are empty, then empty is returned. According to the spec, it 
> should be null.
> 
> I still don't think either of them can be null, but adding the `isEmpty` 
> check is probably wrong.

Well, it depends on how you interpret an empty filter map. If an empty table is 
specified, I'd think it means no criteria is set and all providers can be 
returned as the comment above suggested.
As this is a corner case, I am ok with reverting the isEmpty() check to keep 
the same behavior as before. However, I don't get which part of spec states 
about returning null for this case?

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

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

Reply via email to