[jdk17] RFR: 8270006: Switches with 'case null:' should be exhaustive

Jan Lahoda jlahoda at openjdk.java.net
Wed Jul 7 11:52:03 UTC 2021


Code like:

    void exhaustiveAndNull(String s) {
        switch (s) {
            case null: break;
        }
    }


should be rejected, because the switch is no exhaustive, but it is a "new" switch. (Note that this not a problem for switch expressions, which always have to be exhaustive.)

-------------

Commit messages:
 - 8270006: Switches with 'case null:' should be exhaustive

Changes: https://git.openjdk.java.net/jdk17/pull/224/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=224&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8270006
  Stats: 13 lines in 3 files changed: 10 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/224.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/224/head:pull/224

PR: https://git.openjdk.java.net/jdk17/pull/224


More information about the compiler-dev mailing list