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

Parenthesized pattern with guards does not work

XMLWordPrintable

    • b28

        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....

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

                Created:
                Updated:
                Resolved: