Summary
Clarify the condition of System.console() about standard input/output
Problem
JDK-8361613 restricts the JLine based Console implementation to return the instance from System.console() only when both standard input and output are attached to the terminal. It is desirable to clarify the java.io.Console specification regarding the Console
availability when standard input / output may not be connected to a terminal.
Solution
Modify the class description in the java.io.Console
where System.console()
is mentioned to include the condition about the standard input/output.
Specification
Change the last sentence of the second paragraph of the class description of java.io.Console
as follows:
@@ -43,12 +43,13 @@
* machine is invoked. If the virtual machine is started from an
* interactive command line without redirecting the standard input and
* output streams then its console will exist and will typically be
* connected to the keyboard and display from which the virtual machine
* was launched. If the virtual machine is started automatically, for
- * example by a background job scheduler, then it may not
- * have a console.
+ * example by a background job scheduler, then it may not have a
+ * console. Regardless of how the virtual machine was created, it may not
+ * have a console if either the standard input or output stream is
+ * redirected.
* <p>
* If this virtual machine has a console then it is represented by a
* unique instance of this class which can be obtained by invoking the
* {@link java.lang.System#console()} method. If no console device is
* available then an invocation of that method will return {@code null}.
- csr of
-
JDK-8361972 Clarify the condition of System.console() about standard input/output
-
- In Progress
-