Summary
An enhancement to the JShell API to support use of System.console()
inside the snippets is proposed.
Problem
Currently, when a JShell snippet uses System.console()
, the returned value is null
.
Solution
The JShell API is enhanced to allow to specify a console backend for the snippet execution. Then, when a snippet runs, System.console()
may return a non-null value, and invoking methods on this value will rely the data to the specified console backend and back.
Not all JShell backends and configurations will support System.console()
. Specifically, JShell will only support System.console()
when it will use a remote agent, and the remote agent will support the console. This is the default when running JShell on the command line.
Specification
The proposed API changes are attached as specdiff.02.zip and are also available for convenience here: https://cr.openjdk.org/~jlahoda/8296454/specdiff.02/overview-summary.html
- csr of
-
JDK-8296454 System.console() shouldn't return null in jshell
-
- Resolved
-