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

Parenthesized pattern with guards does not work

    XMLWordPrintable

Details

    • b28

    Backports

      Description

        Consider code like:
        ```
        case (String s) && !s.isEmpty():
        ```

        This is a guarded pattern, where the nested pattern is parenthesized. But javac won't parse this code:

        $ javac Test.java
        Test.java:4: error: : or -> expected
                    case (String s) && !s.isEmpty():
                                   ^
        ...errors continue....

        Attachments

          Issue Links

            Activity

              People

                jlahoda Jan Lahoda
                jlahoda Jan Lahoda
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: