On Tue, 16 Nov 2021 18:08:08 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> Fixing the default charset for PrintWriter/OutputStreamWriter that wraps a 
>> PrintStream to its charset. This issue was raised during the conversations 
>> in https://github.com/openjdk/jdk/pull/5771
>> A corresponding CSR has also been drafted: 
>> https://bugs.openjdk.java.net/browse/JDK-8277078
>
> Naoto Sato has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Made PrintStream::charset() public, charset field final, and refined 
> wordings.

src/java.base/share/classes/java/io/PrintStream.java line 116:

> 114:     public Charset charset() {
> 115:         return charset;
> 116:     }

This looks good. You could use {@return the charset used ...} to avoid 
repeating the message. Also might be better to move the method to after the 
constructors so that it's with the other instance methods.
The update method descriptions in PS, PW, and OutputStreamWriter look good.
So overall I think we've got to a good place. Wrapping a PS with PW and not 
inheriting the charset is an potential accident that goes back 20+ years.

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

PR: https://git.openjdk.java.net/jdk/pull/6401

Reply via email to