On Wed, 10 Nov 2021 21:19:30 GMT, Naoto Sato <na...@openjdk.org> wrote:
>> Ichiroh Takiguchi has updated the pull request with a new target base due to >> a merge or a rebase. The pull request now contains five commits: >> >> - 8274544: Langtools command's usage were garbled on Japanese Windows >> - 8274544: Langtools command's usage were garbled on Japanese Windows >> - 8274544: Langtools command's usage were garbled on Japanese Windows >> - 8274544: Langtools command's usage were garbled on Japanese Windows >> - Langtools command's usage were grabled on Japanese Windows > > Good suggestions. Filed a JBS issue: > https://bugs.openjdk.java.net/browse/JDK-8276970 Hello @naotoj . For PrintStream.getCharset(), following changes may be required. +++ src/java.base/share/classes/java/io/OutputStreamWriter.java + Charset getCharset() { + return se.getCharset(); + } +++ src/java.base/share/classes/java/io/PrintStream.java + public Charset getCharset() { + return charOut.getCharset(); + } +++ src/java.base/share/classes/sun/nio/cs/StreamEncoder.java + public Charset getCharset() { + return cs; + } For javac code, we may not use PrintStream.getCharset() directly because javac code is compiled by boot compiler. We need to use reflection, like: +++ src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java + private static Charset getCharset(PrintStream ps) { + try { + Method getCharset = PrintStream.class.getDeclaredMethod("getCharset"); + return (Charset)getCharset.invoke(ps); + } catch (Exception e) { + return Charset.defaultCharset(); + } + } If we add following constructors against PrintWriter, we just change javap and jshell code. But I cannot evaluate this code changes. +++ src/java.base/share/classes/java/io/PrintWriter.java + public PrintWriter(PrintStream ps) { + this((OutputStream)ps, false, ps.getCharset()); + } + public PrintWriter(PrintStream ps, boolean autoFlush) { + this((OutputStream)ps, autoFlush, ps.getCharset()); + } I really appreciate if you handle this kind of code change via JEP-400. ------------- PR: https://git.openjdk.java.net/jdk/pull/5771