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

Missing complaint about unreachable cases/default in pattern switch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: repo-amber
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      (With or without a break at end of the prior case)

      public class X {
          public static void main(String [] args) {
              Object [] o = args;
              switch (10) {
                  case Integer i:
                      System.out.println("i = " + i);
                  default:
                      System.out.println("Unreachable");
                      break;
              }
          }
      }

      this code fails to elicit a diagnostic about unreachable default clause.



        Attachments

          Activity

            People

            Assignee:
            jlahoda Jan Lahoda
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: