IDEA-97313 @Nullable inspection does not warn on dereferencing @Nullable variable declared in foreach loop

This commit is contained in:
peter
2012-12-19 19:36:33 +01:00
parent 4341bc7222
commit e9b67cad4c
3 changed files with 40 additions and 13 deletions
@@ -0,0 +1,20 @@
import foo.Nullable;
import java.util.ArrayList;
import java.util.List;
public class Foo {
void foo1(List<Integer> list) {
for (@Nullable Integer i : list) {
System.out.println(<warning descr="Method invocation 'i.intValue()' may produce 'java.lang.NullPointerException'">i.intValue()</warning>);
}
}
void foo2(List<@Nullable Integer> list) {
for (@Nullable Integer i : list) {
System.out.println(<warning descr="Method invocation 'i.intValue()' may produce 'java.lang.NullPointerException'">i.intValue()</warning>);
}
}
}