[records] Javac thinks compact constructor parameters are final

Tagir Valeev amaembo at gmail.com
Thu Jan 9 03:21:42 UTC 2020


Tried with build 14-ea+30-1385

record Test(int x) {
  public Test {
    x++;
  }
}

>"C:\Program Files\Java\jdk-14\bin\javac.exe" --enable-preview --release=14 Test.java
Test.java:3: error: final parameter x may not be assigned
    x++;
    ^
Note: Test.java uses preview language features.
Note: Recompile with -Xlint:preview for details.
1 error

(thanks to Nicolai Parlog for spotting this)

With best regards,
Tagir Valeev


More information about the amber-dev mailing list