RFR: 8333427: langtools/tools/javac/newlines/NewLineTest.java is failing on Japanese Windows

Jaikiran Pai jpai at openjdk.org
Tue Aug 6 09:15:34 UTC 2024


On Tue, 6 Aug 2024 09:11:31 GMT, KIRIYAMA Takuya <duke at openjdk.org> wrote:

>> test/langtools/tools/javac/newlines/NewLineTest.java line 61:
>> 
>>> 59:                 .run(Task.Expect.FAIL);
>>> 60: 
>>> 61:         String encoding = System.getProperty("native.encoding");
>> 
>> Hello @tkiriyama, I don't have experience in javac area or this test, but I had a brief look at this change. What I understand is that `javac` will print to `STDOUT` using a `PrinterWriter` for `System.out`, which as per the documentation https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/System.html#out will use `stdout.encoding` value for the character encoding. The default value of `stdout.encoding` standard system property https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/System.html#stdout.encoding is currently not mentioned but I checked with people familiar with this area and it defaults to platform specific values. It is not guaranteed that `stdout.encoding` will be the same value as `native.encoding`. So the proposed change here isn't guaranteed to (always) work.
>> 
>> I think to make this deterministic, you might have to update the `javac` launch command (a few lines above) to pass `-J-Dstdout.encoding=UTF-8` and then when reading from the file to which the content was redirected, use `StandardCharsets.UTF_8`.
>> Can you give that change a try on your setup and see if it solves the issue for you?
>
> @jaikiran 
> I'm looking forward to your comments.

Hello @tkiriyama, sorry I hadn't paid attention to this PR. I will take a look soon.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19519#discussion_r1705196105


More information about the compiler-dev mailing list