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

Jan Lahoda jlahoda at openjdk.java.net
Thu Jul 8 08:06:55 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.)

This pull request has now been integrated.

Changeset: 4f707591
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.java.net/jdk17/commit/4f707591754e5e7f747d1d0a47f78f49060771c2
Stats:     13 lines in 3 files changed: 10 ins; 0 del; 3 mod

8270006: Switches with 'case null:' should be exhaustive

Reviewed-by: vromero

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

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


More information about the compiler-dev mailing list