RFR: 8333103: Re-examine the console provider loading

Pavel Rappo prappo at openjdk.org
Wed May 29 21:42:05 UTC 2024


On Wed, 29 May 2024 21:27:30 GMT, Chen Liang <liach at openjdk.org> wrote:

>> There is an initialization code in `Console` class that searches for the Console implementations. Refactoring the init code not to use lambda/stream would reduce the (initial) number of loaded classes by about 100 for java.base implementations. This would become relevant when the java.io.IO (JEP 477) uses Console as the underlying framework.
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19467#discussion_r1619504988


More information about the core-libs-dev mailing list