RFR: 8224228: No way to locally suppress lint warnings in parser/tokenizer or preview features [v14]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Feb 28 18:30:54 UTC 2025
On Fri, 28 Feb 2025 17:27:33 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
>> This PR updates the `DeferredLintHandler` so that deferred warnings can be registered during parsing, before any `JCTree` nodes have been created, and it uses this new capability to update the `"preview"` and `"text-blocks"` Lint warnings so that they can be suppressed via `@SuppressWarnings` annotations. More details are provided in additional comments.
>>
>> Note: This PR depends on (i.e., includes and extends) these other "cleanup" PR's:
>> * #23167
>> * #23281
>> * #23400
>> * #23730
>
> Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:
>
> Refactor to map positions to declarations all within the parser.
Some interesting (and extreme) cases:
class Test1 {
@interface A {
String value();
}
@SuppressWarnings("text-blocks")
@A("""
trailing space here:\u0020
""")
void m() { }
}
Or, even
class Test2 {
@SuppressWarnings("""
text-blocks\u0020
""")
void m() { }
}
I'm not saying we should handle them -- more pointing out that, perhaps, trying to come up with the "perfect"/"most general" scheme here might be very difficult (if at all possible).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23237#issuecomment-2691295561
More information about the compiler-dev
mailing list