Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236841

compact constructor parameters are always final

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 14
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b32

      Backports

        Description

        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

        reported by Tagir at amber-dev: http://mail.openjdk.java.net/pipermail/amber-dev/2020-January/005470.html

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                vromero Vicente Arturo Romero Zaldivar
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: