RFR: 8361255: CTW: Tolerate more NCDFE problems [v3]
Vladimir Kozlov
kvn at openjdk.org
Mon Jul 7 23:37:41 UTC 2025
On Fri, 4 Jul 2025 05:58:51 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java line 89:
>>
>>> 87: UNSAFE.ensureClassInitialized(aClass);
>>> 88: } catch (NoClassDefFoundError e) {
>>> 89: CompileTheWorld.OUT.printf("[%d]\t%s\tNOTE unable to init class : %s%n",
>>
>> Do you mean `\n` here and in all other outputs? `%n` needs local variable to store size of output.
>
> I meant `%n` :)
>
> You are probably thinking about C printf? In Java [formatters](https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html), `%n` is the "platform-specific line separator". It is more compatible than just `\n`, which runs into platform-specific `CR` vs `LF` vs `CRLF` line separator mess.
>
> See:
>
>
> jshell> System.out.printf("Hello\nthere,\nVladimir!\n")
> Hello
> there,
> Vladimir!
> $6 ==> java.io.PrintStream at 34c45dca
>
> jshell> System.out.printf("Hello%nthere,%nVladimir!%n")
> Hello
> there,
> Vladimir!
> $7 ==> java.io.PrintStream at 34c45dca
Now you know that I am not expert Java programmer :(
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26090#discussion_r2191193030
More information about the hotspot-compiler-dev
mailing list