RFR: 8356441: IllegalStateException in RichDiagnosticFormatter after JDK-8355065
Liam Miller-Cushon
cushon at openjdk.org
Thu May 8 16:12:52 UTC 2025
On Thu, 8 May 2025 16:03:09 GMT, Chen Liang <liach at openjdk.org> wrote:
>> [JDK-8355065](https://bugs.openjdk.org/browse/JDK-8355065) fixed an issue where if RichDiagnosticFormatter was used recursively, it would overwrite instance state. That fix added guards to prevent the logic from being used recursively. As reported in [JDK-8356441](https://bugs.openjdk.org/browse/JDK-8356441) there are other situations where RichDiagnosticFormatter is used recursively. This fixes updates it to support being used recursively, by saving and restoring instance state on recursive calls.
>
> test/langtools/tools/javac/annotations/typeAnnotations/RichFormatterWithTypeAnnotationsReentrantTest.java line 126:
>
>> 124: "^",
>> 125: "1 error",
>> 126: "1 warning");
>
> These messages are locale specific. I don't know if we can detect the keys for these messages instead.
Thanks! For the purposes of the test the diagnostic text doesn't matter as long as the compiler isn't crashing. I'll look to see if there's a good way to get the diagnostic codes here, another option might be to just relax the assertion to not match on the output.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25105#discussion_r2080038165
More information about the compiler-dev
mailing list