RFR: 8361255: CTW: Tolerate more NCDFE problems [v3]
Aleksey Shipilev
shade at openjdk.org
Fri Jul 4 06:04:38 UTC 2025
On Thu, 3 Jul 2025 22:51:02 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Just use printf directly
>
> 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
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26090#discussion_r2184484564
More information about the hotspot-compiler-dev
mailing list