RFR: 8352693: Use a simpler console reader instead of JLine for System.console()

Jan Lahoda jlahoda at openjdk.org
Mon Mar 31 17:08:10 UTC 2025


On Thu, 27 Mar 2025 20:48:22 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> src/jdk.internal.le/share/classes/jdk/internal/console/SimpleConsoleReader.java line 198:
>> 
>>> 196: 
>>> 197:             if (it.hasNext()) {
>>> 198:                 out.append("\n\r");
>> 
>> I understand this is a simple console, but do we want to CR/LF/CRLF based on the platform?
>
> `line.seprator` system property can be used here

When the terminal is in the raw/unprocessed mode, I believe `\n` is only moving the cursor to the next line (without changing the column), and `\r` is doing carriage return. So, to move the cursor to the first character of the next line, both are needed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24242#discussion_r2021410890


More information about the build-dev mailing list