Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8317300 javac erroneously allows "final" in front of a record pattern
  3. JDK-8320871

Release Note: Align `javac` with the Java Language Specification by Rejecting `final` in Record Patterns

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Delivered
    • P4
    • 21.0.3, 22
    • 21.0.3-oracle, 22
    • tools

    Backports

      Description

        JDK 21 introduced pattern matching in the Java language. However, `javac` allowed `final` in front of a record pattern, such as (`case final R(...) ->`), something which is not allowed by the Java Language Specification.

        Programs that could be compiled erroneously in JDK21 with `final` will now fail to compile. This change fixes the issue in the compiler. Impacted users will need to remove the `final` keyword.

        Attachments

          Issue Links

            Activity

              People

                abimpoudis Angelos Bimpoudis
                abimpoudis Angelos Bimpoudis
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: