RFR: 8333103: Re-examine the console provider loading
Pavel Rappo
prappo at openjdk.org
Thu May 30 08:26:02 UTC 2024
On Thu, 30 May 2024 07:44:24 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> 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.
>
> It's only semantically the same if we assume a module can only provide a single `JdkConsoleProvider`, no? The `break;` disallows multiple providers (for disjoint sets of charsets) in a single module.
Claes has described the issue well. Like I said, `break` short-circuits the search. If a module can provide more than one console provider, the suggested stream-less replacement is **not** equivalent.
If a module can provide more than one console provider, not only the code needs to be fixed, but a relevant test should be added too. The test should be in this PR, but tagged with the initial bug, [8295803], not this (performance) bug.
[8295803]: https://bugs.openjdk.org/browse/JDK-8295803
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19467#discussion_r1620237958
More information about the core-libs-dev
mailing list