RFR: 8348427: DeferredLintHandler API should use JCTree instead of DiagnosticPosition [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Feb 6 22:06:11 UTC 2025


On Thu, 6 Feb 2025 21:45:01 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> > learn a little bit more about this. It looks like the only time immediate mode is used explicitly (i.e., other due to `DeferredLintHandler`'s default state) is when resolving imports ([here](https://github.com/openjdk/jdk/blob/89e5e7ab73472b7d02aac5b8b0c7e9f26db6ec32/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L368)). In that case, of course, there can be no enclosing `@SuppressWarnings` so that makes sense.
> 
> Can we use a similar "flush" strategy ? E.g. make the warnings be part of an import declaration, and then process them as part of a flush? While it's good that you knocked one of the two usages off -- it's a bit sad to have this machinery "just" for one case.
> 
> Separately, I wonder if warnings issued from import statements should be suppressible as well (perhaps piggy backing on the toplevel class `@SuppressWarnings` uhmmm). It seems bad that there's some warnings that can't be suppressed programmatically.

I think it would be useful to understand which warnings can be generated during `resolveImports`. @jddarcy  pointed me at:

https://openjdk.org/jeps/211

See related change:

https://hg.openjdk.org/jdk9/jdk9/langtools/rev/82384454947c

Where we explicitly disable deprecation warnings on import since 9. Is there any other?

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

PR Comment: https://git.openjdk.org/jdk/pull/23281#issuecomment-2641160532


More information about the compiler-dev mailing list