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

Switches with 'case null:' should be exhaustive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 17
    • 17
    • tools
    • None
    • b31

        As noted here:
        https://mail.openjdk.java.net/pipermail/compiler-dev/2021-July/017505.html

        For switches like:
        void test(String s) {
          switch (s) {
            case null:
              break;
          }
        }

        javac should produce a compile-time error, as the switch is not exhaustive.

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

                Created:
                Updated:
                Resolved: