Summary
-------
Make `JLine` the default `Console` provider
Problem
-------
The initial intention for using `JLine` module for the `Console` was for a better user experience (JDK-8295803). However, the implementation was spawning native OS commands in Linux/macOS environments and caused performance degradation on some app's startup time (JDK-8299137), thus the use of `JLine` was made optional (JDK-8299689) for `Console`. So unless the user opt-in for using `JLine` via the system property, `Console` defaults to the built-in implementation.
Solution
--------
JLine implementation no longer spawns native commands with the fix to JDK-8306983, it is desirable to make the `JLine` implementation the default `Console` provider. By lazily instantiating JLine instance, the performance regression can be improved down from >4% (as in JDK-8299137) to 2%.
Also, introduce a new public method for applications which need to know whether the Console instance is a TTY environment or not, which has been simulated by `System.console() != null`.
Specification
-------------
Add the following new public method in `java.io.Console` class:
/**
* {@return if the {@code Console} instance is a terminal}
* <p>
* This method returns {@code true} if the console device, associated with the current
* Java virtual machine, is a terminal, typically an interactive command line
* connected to a keyboard and display.
*
* @implNote The default implementation returns the value equivalent to calling
* {@code isatty(stdin/stdout)} on POSIX platforms, or whether standard in/out file
* descriptors are character devices or not on Windows.
*
* @since 22
*/
public boolean isTerminal()