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

Jan Lahoda jlahoda at openjdk.org
Tue Sep 20 10:07:35 UTC 2022

> 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.


  - all: https://git.openjdk.org/jdk/pull/10348/files
  - new: https://git.openjdk.org/jdk/pull/10348/files/a719a34f..4a2459b0

 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10348&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10348&range=00-01

  Stats: 20 lines in 1 file changed: 17 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/10348.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10348/head:pull/10348

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

More information about the compiler-dev mailing list