RFR: 8331535: Incorrect prompt for Console.readLine [v4]

Jan Lahoda jlahoda at openjdk.org
Tue May 7 07:13:23 UTC 2024


> When JLine reads a line, there may be a prompt provided. However, JLine will not interpret the prompt literally, it will handle `%` specially. As a consequence, doing:
> 
> System.console().readLine("%%s");
> 
> 
> will not print `%s`, as first `String.format` is used, which will convert `%%s` to `%s`, and then JLine will interpret the `%`. The proposed solution is to duplicate the `%`, so that JLine will print it.

Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:

  Adding another test run with -Djdk.console=java.base, as suggested.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19081/files
  - new: https://git.openjdk.org/jdk/pull/19081/files/05592871..a138981e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19081&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19081&range=02-03

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/19081.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19081/head:pull/19081

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


More information about the core-libs-dev mailing list