14.11.1 Small slip in fall-through conditions regarding pattern variables in switch blocks

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: specification

      Currently JLS 14.11.1 gives an error condition:

      It is a compile-time error if, in a switch block that consists of switch labeled statement groups, a statement is labeled with a case pattern that declares one or more pattern variables, and either: ...

      Clearly, it was intended that the condition was not restricted to the pattern in the case label, but also to include any guard associated with the label. In other words it should read:

      It is a compile-time error if, in a switch block that consists of switch labeled statement groups, a statement is labeled with a case _label_ that declares one or more pattern variables, and either: ...

      (Along with a reference to 6.3.3 where this is defined)

            Assignee:
            Gavin Bierman
            Reporter:
            Gavin Bierman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: