RFR: 8294431: jshell reports error on initialisation of static final field of anonymous class
Jan Lahoda
jlahoda at openjdk.org
Thu Sep 29 13:59:00 UTC 2022
When variable with an inferred type (i.e. `var`) is initialized with an anonymous class, the inferred type of the variable is the actual anonymous type. To implement this in JShell, JShell will unroll the anonymous class into a normal class, and to do this, it needs to initialize fields inside a constructor.
But, as we can have static fields in the anonymous class now, it is necessary to not try to initialize static fields in the constructor, as we would initialize them too often.
-------------
Commit messages:
- 8294431: jshell reports error on initialisation of static final field of anonymous class
Changes: https://git.openjdk.org/jdk/pull/10489/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10489&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8294431
Stats: 9 lines in 2 files changed: 5 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/10489.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10489/head:pull/10489
PR: https://git.openjdk.org/jdk/pull/10489
More information about the kulla-dev
mailing list