RFR: 8331535: Incorrect prompt for Console.readLine
Naoto Sato
naoto at openjdk.org
Fri May 3 17:10:54 UTC 2024
On Fri, 3 May 2024 11:12:48 GMT, Pavel Rappo <prappo 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.
>
> test/jdk/jdk/internal/jline/JLineConsoleProviderTest.java line 27:
>
>> 25: * @test
>> 26: * @bug 8331535
>> 27: * @summary Verify the jdk.internal.le's console provider works properly.
>
> There's a hidden assumption in this test below that the _default_ console is `jdk.internal.le`. Is there any way to assert that?
Or maybe we could explicitly specify `-Djdk.console=jdk.internal.le` to the test.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19081#discussion_r1589477775
More information about the core-libs-dev
mailing list