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

Missing complaint about unreachable cases/default in pattern switch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • None
    • tools
    • generic
    • generic

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



            jlahoda Jan Lahoda
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: