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

Alan Bateman alanb at openjdk.org
Sun Dec 4 17:17:02 UTC 2022


On Sat, 3 Dec 2022 19:18:48 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 one additional commit since the last revision:
> 
>   Changed the expected behavior when the SecurityManager is enabled

This is well done. I've been through all the latest src changes.

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

> 625:         });
> 626:     }
> 627:     private static Console cons;

The initialization of cons is replaced in this PR so maybe we can make it final at the same time.

src/java.base/share/classes/jdk/internal/io/JdkConsole.java line 33:

> 31: /**
> 32:  * Delegate interface for custom Console implementations.
> 33:  * Methods defined here are duplicating ones in Console class.

There's a typo here, probably should be be "duplicates the" or "are duplicates of the methods".

src/java.base/share/classes/jdk/internal/io/JdkConsoleProvider.java line 40:

> 38:      * The default provider of JdkConsole.
> 39:      */
> 40:     String DEFAULT_PROVIDER = "jdk.internal.le";

This is really the module name of the preferred provider, maybe it should have _MODULE_NAME as the suffix.

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

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



More information about the security-dev mailing list