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

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

        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.

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

                Created:
                Updated:
                Resolved: