RFR: 8356985: Use "stdin.encoding" in Console's read*() methods [v3]

Naoto Sato naoto at openjdk.org
Wed May 21 16:57:53 UTC 2025


On Wed, 21 May 2025 08:30:26 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> `stdout.encoding` validity is tested through the public `charset()` mehtod, which is in `CharsetTest.java`
>
> Indeed there *are* `stdout.encoding` tests in `test/jdk/java/io/Console`, yet none<sup>1</sup> that thoroughly tests them with `expect` and a dedicated (mock) `CharsetProvider` as you did here. FWIW, I really liked your new test using a mock `CharsetProvider` in combination with `expect`, hence my question for doing same for stdout and stderr too.
> 
> For the record, AFAICT, there are no tests for `stderr.encoding`.
> 
> <sup>1</sup> There is `script.exp`, but it tests `sun.stdout.encoding`, not `stdout.encoding`.

Actually providing mock charset was a workaround of not having public method for getting the input encoding. I think it would be an overkill to introduce a new public method because it will not be used much, as most cases are suffice with the existing one (Console is used for interactive user enviornment, and I don't believe users would like to see different characters displayed for the input).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25271#discussion_r2100762324


More information about the core-libs-dev mailing list