RFR: 8348212: Need to add warn() step to JavacTaskImpl after JDK-8344148 [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jan 24 16:52:48 UTC 2025


On Fri, 24 Jan 2025 16:23:15 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

>> In [JDK-8344148](https://bugs.openjdk.org/browse/JDK-8344148) a new `warn()` compiler phase was added and `JavaCompiler.java` was updated accordingly.
>> 
>> However, the class `JavacTaskImpl` also walks through the compiler phases step-by-step, but the new `warn()` step was never added there. This will cause some warnings to not be emitted when that API is used.
>> 
>> This PR adds the missing `warn()` calls.
>
> Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add a regression test.

test/langtools/tools/javac/api/TestJavacTaskWithWarning.java line 74:

> 72: 
> 73:         // Verify warning was generated
> 74:         if (!buf.toString().contains("compiler.warn.possible.this.escape"))

This strategy is good - as an alternative (maybe for more complex tests in the future) you also have the option to register a so called "diagnostic listener".

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23223#discussion_r1928973693


More information about the compiler-dev mailing list