RFR: 8295803: Console should be usable in jshell and other environments

Naoto Sato naoto at openjdk.org
Wed Nov 30 18:49:02 UTC 2022


On Wed, 30 Nov 2022 17:07:35 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> This is to allow Console to be used even when it is not attached to the platform provided terminal, such as the case when the standard input is redirected. `System.console()` now returns a Console implementation based on `jdk.internal.le` terminal by default, or jshell implementation if available. A corresponding CSR has been drafted.
>
> src/java.base/share/classes/java/io/Console.java line 617:
> 
>> 615: 
>> 616:             public Charset charset() {
>> 617:                 return cons.charset();
> 
> What happens when cons is null?

Turned out that `JavaIOAccess.charset()` is not used anywhere. Will remove this method. Will also add a test.

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

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


More information about the security-dev mailing list