[lworld] RFR: 8330583: [lworld] javac doesn't set ACC_STRICT to final synthetic fields in value classes

Vicente Romero vromero at openjdk.org
Mon Apr 22 20:56:50 UTC 2024


javac is not setting the ACC_STRICT flag to final synthetic fields in value classes. The code below reproduces the issue:


class NestedTest {
    value class MyValue {
        int i = 0;

        public String toString() {
            return "MyValue("+i+","+outerInt+")";
        }
    }

    int outerInt = 42;
    MyValue v = new MyValue();

    public static void main(String[] args) {
        NestedTest nt = new NestedTest();
    }
}

in this case class MyValue has an outer this field of type NestedTest which is final and synthetic but in the case of value classes should also be strict.

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

Commit messages:
 - 8330583: [lworld] javac doesn't set ACC_STRICT to final synthetic fields in value classes

Changes: https://git.openjdk.org/valhalla/pull/1080/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1080&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8330583
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/valhalla/pull/1080.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1080/head:pull/1080

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



More information about the valhalla-dev mailing list