an index to detect nulls passed as arguments of method parameters + DataFlowInspection and NullableStuffInspection use it to detect method call failings when one of parameters is null

This commit is contained in:
Dmitry Batkovich
2016-08-18 12:21:51 +03:00
parent 17a7a27274
commit 8a9227543c
23 changed files with 907 additions and 47 deletions
@@ -0,0 +1,24 @@
import org.jetbrains.annotations.NotNull;
class Test {
void someMethod(<warning descr="Parameter annotated @NotNull should not receive null as an argument">@NotNull</warning> Object warn, <warning descr="Parameter annotated @NotNull should not receive null as an argument">@NotNull</warning> Object o2, <warning descr="Parameter annotated @NotNull should not receive null as an argument">@NotNull</warning> Object warn1) {
}
static void someStaticMethod(Object notAnnotated, <warning descr="Parameter annotated @NotNull should not receive null as an argument">@NotNull</warning> Object o2, <warning descr="Parameter annotated @NotNull should not receive null as an argument">@NotNull</warning> Object warn2) {
}
public static void main(String[] args) {
someStaticMethod(null, "", "");
Test.someStaticMethod("", null, null);
new Test().someMethod("", null, null);
Test m = new Test();
m.someMethod(null, "", "");
m.someMethod(null, "", "");
}
}