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

Jan Lahoda jlahoda at openjdk.org
Thu Apr 3 17:59:52 UTC 2025


> The `java.io.Console` has several backends: a simple on in `java.base`, a more convenient one in `jdk.internal.le` (with line-reading based on JLine) and one for JShell.
> 
> The backend based on JLine is proving to be a somewhat problematic - JLine is very powerful, possibly too powerful and complex for the simple task of editing a line with no completion, no history, no variables, no commands, etc. As a consequence, there are inevitable sharp edges in this backend.
> 
> The idea in this PR is to replace the use of JLine in the `jdk.internal.le` backend with a simple escape code interpreter, that only handles a handful of keys/codes (left/right arrow, home, end, delete, backspace, enter), and ignores the rest. The goal is to have something simple with less surprising behavior.

Jan Lahoda has updated the pull request incrementally with three additional commits since the last revision:

 - Using control characters to get backspace control character.
 - If there's no native library available, fall back to the standard provider.
 - Reflecting review feedback.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24242/files
  - new: https://git.openjdk.org/jdk/pull/24242/files/77c41e46..d5176d68

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24242&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24242&range=00-01

  Stats: 152 lines in 11 files changed: 114 ins; 13 del; 25 mod
  Patch: https://git.openjdk.org/jdk/pull/24242.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24242/head:pull/24242

PR: https://git.openjdk.org/jdk/pull/24242


More information about the build-dev mailing list