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

Alan Bateman alanb at openjdk.org
Thu Dec 1 15:11:23 UTC 2022

On Wed, 30 Nov 2022 20:44:30 GMT, Naoto Sato <naoto 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.
> Naoto Sato has updated the pull request incrementally with two additional commits since the last revision:
>  - Adds a test
>  - Removed JavaIOAccess.charset() which is no longer needed

src/java.base/share/classes/java/io/Console.java line 604:

> 602:                             GetPropertyAction.privilegedGetProperty("jdk.console",
> 603:                                     JdkConsoleProvider.DEFAULT_PROVIDER);
> 604:                     cons = ServiceLoader.load(JdkConsoleProvider.class).stream()

We might need a test to verify that this works when running with a security manager? That execution mode is still supported.


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

More information about the security-dev mailing list