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

Switches with 'case null:' should be exhaustive

    XMLWordPrintable

Details

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

    Backports

      Description

        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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: