[lworld] RFR: 8342575: [lworld] Compiler should reject volatile fields in value classes

Vicente Romero vromero at openjdk.org
Thu Nov 7 21:22:24 UTC 2024


programs like:


value class V {
    volatile int f = 1;
}


should be rejected by javac as instance fields of value classes are implicitly final and according to the `JLS 23`, `8.3.1.4 volatile Fields`:

It is a compile-time error if a final variable is also declared volatile

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

Commit messages:
 - 8342575: [lworld] Compiler should reject volatile fields in value classes

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

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


More information about the valhalla-dev mailing list