[lworld] Integrated: 8341061: [lworld] final field initialization bug with instance block initializers

Vicente Romero vromero at openjdk.org
Tue Oct 1 13:22:26 UTC 2024


javac is allowing final fields of a value class to be assigned in an instance initialization block. But those are executed after the `super()` invocation, so code like:

value class V {
    int f;
    {
        f = 1;
    }
}

should be rejected as `f` would be initialized after the implicit `super` invocation

-------------

Commit messages:
 - 8341061: [lworld] final field initialization bug with instance block initializers

Changes: https://git.openjdk.org/valhalla/pull/1262/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1262&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341061
  Stats: 26 lines in 3 files changed: 14 ins; 1 del; 11 mod
  Patch: https://git.openjdk.org/valhalla/pull/1262.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1262/head:pull/1262

PR: https://git.openjdk.org/valhalla/pull/1262


More information about the valhalla-dev mailing list