On Wed, 26 Mar 2025 07:54:48 GMT, Jan Lahoda <jlah...@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. Can you coordinate with Naoto on this? There is a CSR in progress to switch Console back to using the java.base implementation by default. src/java.base/share/classes/module-info.java line 172: > 170: java.rmi, > 171: jdk.charsets, > 172: jdk.internal.le, What code in JLine is using shared secrets? I wonder what we need to change to avoid this. src/java.base/share/classes/module-info.java line 304: > 302: exports sun.nio.cs to > 303: jdk.charsets, > 304: jdk.internal.le; Same thing here. src/jdk.internal.le/share/classes/jdk/internal/console/SimpleConsoleReader.java line 51: > 49: } > 50: > 51: private static void doReadImpl(Reader reader, Writer out, boolean > password, int firstLineOffset, IntSupplier terminalWidthSupplier, > CleanableBuffer result) throws IOException { These overly long lines make it really hard to see the changes going forward so I think trim back some of these to make it easy to look at diffs in the future. ------------- PR Comment: https://git.openjdk.org/jdk/pull/24242#issuecomment-2753642709 PR Review Comment: https://git.openjdk.org/jdk/pull/24242#discussion_r2013662676 PR Review Comment: https://git.openjdk.org/jdk/pull/24242#discussion_r2013664086 PR Review Comment: https://git.openjdk.org/jdk/pull/24242#discussion_r2013660028