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 17:58:53 UTC 2025
On Fri, 28 Feb 2025 17:46:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> > I've take a stab at the refactoring we discussed above. Now all of the work of mapping source code positions to `JCTree` declarations is handled entirely within the parser by a new class `LexicalLintManager`. Fire away :)
>
> Thanks for giving a try. I have an initial question about the code. It seems like it stores all the "reports" and all the "declarations" in flat lists. Then we flush the reports once per compilation unit.
>
> This means we still have to do a lot of work to associate reports with declarations.
>
> What I had in mind was to basically do the association when `endDecl` is called. E.g. once you see a field declaration, at that point you can defer all the lint warnings that have been created for that field. This probably needs some `startDecl` (maybe). I'm sure you considered this alternative -- I'm curious as to why it was rejected?
Separately, I feel we're calling `endDecl` way more than what I had in mind. E.g. in my mental model the start/end of a "decl" is only relevant if it can have some suppression attached to it. I see the code calls out `endDecl` for things like binding variables in patterns and method parameters -- so I'm not sure I follow...
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23237#issuecomment-2691239401
More information about the compiler-dev
mailing list