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

Switches with 'case null:' should be exhaustive

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      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

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

                  Dates

                  Created:
                  Updated:
                  Resolved: