I think it's a bug in Eclipse. I tried the same with IntelliJ, and it works as expected there.
When I pass a Null, IntelliJ correctly tells me that nulls are not allowed.
However, when I use the normal i variable, no error pops ups up, which is quite correct.
I even tried this, just for the experiment, so I'm not sure if you're stuck to Eclipse, else I'd recommend using either the free Community version of IntelliJ, or the Ultimate edition.