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

Magnus Ihse Bursie ihse at openjdk.org
Fri Apr 4 14:27:53 UTC 2025


On Thu, 3 Apr 2025 18:12:54 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> 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 with a new target base due to a merge or a rebase. The pull request now contains six commits:
> 
>  - Merge branch 'master' into JDK-8352693
>  - Using control characters to get backspace control character.
>  - If there's no native library available, fall back to the standard provider.
>  - Reflecting review feedback.
>  - Removing trailing whitespace
>  - 8352693: Use a simpler console reader instead of JLine for System.console()

make/modules/jdk.internal.le/Lib.gmk line 31:

> 29: 
> 30: ifeq ($(call isTargetOs, linux macosx windows), true)
> 31: 

Can you please insert the standardized header we use for native libraries? (These are extremely helpful to find/locate where certain libraries are built, since there is no existing proper IDE support for makefiles.)

Suggestion:

  ##############################################################################
  ## Build lible
  ##############################################################################

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

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


More information about the build-dev mailing list