RFR: 8295803: Console should be usable in jshell and other environments [v12]
Alan Bateman
alanb at openjdk.org
Wed Dec 7 19:01:16 UTC 2022
On Wed, 7 Dec 2022 17:09:53 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:
>
> Addressing review comments
src/java.base/share/classes/java/io/PrintWriter.java line 212:
> 210:
> 211: /* package private constructor specific to ProxyingConsole */
> 212: PrintWriter(Writer out, Object lock) {
This constructor looks fine but maybe the comment should just say that it allows the lock object to be provided rather than mentioning ProxyingConsole here.
src/java.base/share/classes/java/io/ProxyingConsole.java line 167:
> 165: @Override
> 166: public void close() throws IOException {
> 167: r.close();
Console specifies that the invoking close on the Reader and Writer does not close the underlying stream. So I think this close (and WrappingWriter::close) need to be a no-op too.
-------------
PR: https://git.openjdk.org/jdk/pull/11421
More information about the security-dev
mailing list