RFR: 8331535: Incorrect prompt for Console.readLine [v5]
Adam Sotona
asotona at openjdk.org
Fri May 10 15:09:11 UTC 2024
On Fri, 10 May 2024 11:00:55 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> 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:
>
> Fixing the '%' prompt problem for JShell tools' console.
test/jdk/java/io/Console/ConsolePromptTest.java line 30:
> 28: * @library /test/lib
> 29: * @run main/othervm --limit-modules java.base ConsolePromptTest
> 30: * @run main/othervm -Djdk.console=java.base java.base ConsolePromptTest
Suggestion:
* @run main/othervm -Djdk.console=java.base ConsolePromptTest
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19081#discussion_r1596875588
More information about the core-libs-dev
mailing list