[infer][java] add more example of inter-target NPEs for the Buck integration

Summary: This new tests outlines that Infer does not detect inter-target issues involving native methods.

Reviewed By: sblackshear

Differential Revision: D5720873

fbshipit-source-id: cce8193
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 81fbcf7501
commit f814eb40b8

@ -1,3 +1,4 @@
infer/tests/build_systems/genrule/module1/Class1.java, void Class1.localNPE1(), 2, NULL_DEREFERENCE, [start of procedure localNPE1()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetAbstractNPE(Class1), 2, NULL_DEREFERENCE, [start of procedure interTargetAbstractNPE(...),Skipped call: function or method not found]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetNPE(), 2, NULL_DEREFERENCE, [start of procedure interTargetNPE(),start of procedure returnsNull(),return from a call to String Class1.returnsNull()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.localNPE2(), 2, NULL_DEREFERENCE, [start of procedure localNPE2()]

@ -11,10 +11,9 @@ package genrule.module1;
import genrule.annotations.Nullable;
public class Class1 {
public abstract class Class1 {
@Nullable
public static String returnsNull() {
public static @Nullable String returnsNull() {
return null;
}
@ -23,4 +22,8 @@ public class Class1 {
obj.toString();
}
public abstract @Nullable Object abstractMayReturnNull();
public native @Nullable Object nativeMayReturnNull();
}

@ -13,13 +13,23 @@ import genrule.module1.Class1;
public class Class2 {
void localNPE2() {
Object obj = null;
obj.toString();
}
void interTargetNPE() {
Object obj = Class1.returnsNull();
obj.toString();
}
void localNPE2() {
Object obj = null;
void interTargetAbstractNPE(Class1 class1) {
Object obj = class1.abstractMayReturnNull();
obj.toString();
}
void FN_interTargetNativeNPE(Class1 class1) {
Object obj = class1.nativeMayReturnNull();
obj.toString();
}

Loading…
Cancel
Save