[records] Javac thinks compact constructor parameters are final

Vicente Romero vicente.romero at oracle.com
Thu Jan 9 04:24:28 UTC 2020


thanks, I have created: https://bugs.openjdk.java.net/browse/JDK-8236841

Vicente

On 1/8/20 10:21 PM, Tagir Valeev wrote:
> 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