[patterns] Null handling
Gavin Bierman
gavin.bierman at oracle.com
Thu Oct 19 10:07:56 UTC 2017
Hi Tagir.
Sorry for the slow response. This is actually a bug.
Thanks,
Gavin
> On 14 Oct 2017, at 10:34, Tagir Valeev <amaembo at gmail.com> wrote:
>
> Hello!
>
> Sorry if I'm missing something. Is this behavior difference intended
> or just implementation is not complete yet?
>
> static void testSwitchInteger(Integer i) {
> switch(i) {
> case 1: System.out.println("One");break;
> default: System.out.println("Other");break;
> }
> }
>
> static void testSwitchNumber(Number i) {
> switch(i) {
> case 1: System.out.println("One");break;
> default: System.out.println("Other");break;
> }
> }
>
> testSwitchNumber(null); // prints "Other"
> testSwitchInteger(null); // NPE
>
> WIth best regards,
> Tagir Valeev.
More information about the amber-dev
mailing list