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

Vicente Romero vromero at openjdk.java.net
Wed Jul 7 15:05:49 UTC 2021


On Wed, 7 Jul 2021 11:45:11 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> 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.)

lgtm

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

Marked as reviewed by vromero (Reviewer).

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


More information about the compiler-dev mailing list