RFR: 8293897: Synthetic final modifier is part of the AST for a try-with-resource resource [v2]

Athijegannathan Sundararajan sundar at openjdk.org
Tue Sep 20 10:17:40 UTC 2022

On Tue, 20 Sep 2022 10:07:35 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> The resources in try-with-resource are implicitly final (unless they are marked as final in the source code). But, in javac, the `FINAL` modifier is part of the modifiers on the AST, which is in contrary to the usual direction of having the AST closely model the source code.
>> The proposal here is to not add the synthetic `FINAL` modifier to the AST, but add it to the given `VarSymbol`. The positions of the `ModifiersTree` are also tweaked, so that for a synthetic tree, the positions are `NOPOS`.
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>   Adding a test with explicit final modifier.



Marked as reviewed by sundar (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10348

More information about the compiler-dev mailing list