Only guards of boolean type and value true should be considered to be unguarded

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 19
    • Affects Version/s: 19
    • Component/s: tools
    • None

      Consider:
      ---
      sealed interface Intf permits A, B {}
      final static class A implements Intf {}
      final static class B implements Intf {}
      private int test(Intf selectorParam, Boolean b) {
          return switch (selectorParam) {
                  case A a when b -> 2;
                  case B b -> 1;
              };
      }
      ---

      This used to compile as exhaustive, although it should not.

            Assignee:
            Jan Lahoda
            Reporter:
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: