On Wed, 29 May 2024 21:39:37 GMT, Pavel Rappo <pra...@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