RFR: 8305457: Implement java.io.IO [v3]

Stuart Marks smarks at openjdk.org
Wed May 8 01:10:55 UTC 2024


On Tue, 7 May 2024 22:12:55 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> src/java.base/share/classes/java/io/IO.java line 37:
>> 
>>> 35:  * is {@code null}; otherwise, the effect is as if a similarly-named method
>>> 36:  * had been called on that console.
>>> 37:  *
>> 
>> Add a note here on encoding (character set), something like
>> 
>> 
>> Output from methods in this class uses the character set of the system console as specified by {@link Console#charset}.
>
> Seems redundant since we express `IO` methods in therms of those of `Console` in the specification, no?

It's strictly redundant in the sense that, if one reads all the specifications and applies reasoning using the right facts, one could already reach that conclusion. However, I think it's a useful clarification, because if you're looking at `java.io.IO` and you ask what charset it uses, you might not know that you need to look at the `Console.charset` method. You might go looking on Console to find the answer, and you might or might not find that method. (Arguably Console's specs should be improved too since the charset is a global property of the Console instance and this should be mentioned in the class specs.)

Anyway Joe asked about Locales in the comments on the CSR [JDK-8331610](https://bugs.openjdk.org/browse/JDK-8331610) and while Locale isn't relevant, charset is, so it seems reasonable to mention it explicitly here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19112#discussion_r1593257656


More information about the core-libs-dev mailing list