RFR: 8333103: Re-examine the console provider loading
Naoto Sato
naoto at openjdk.org
Wed May 29 22:28:03 UTC 2024
On Wed, 29 May 2024 21:39:37 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> src/java.base/share/classes/java/io/Console.java line 673:
>>
>>> 671: return new ProxyingConsole(jc);
>>> 672: }
>>> 673: break;
>>
>> Suggestion:
>>
>>
>> The original `findAny` is only after `filter(Objects::nonNull)` meaning we don't return `null` on a null `jcp.console` result.
>
> Yes, `break` guarantees that the search completes one way or another once the module name has been matched. This is not how it used to be done.
Right. Since `findAny` is after the module name matching, there is at most 1 match. In the case we didn't find any, the final `orElse(null)` eventually returns null. So the refactored code is semantically the same.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19467#discussion_r1619537359
More information about the core-libs-dev
mailing list