diff --git a/infer/tests/build_systems/buck/issues.exp b/infer/tests/build_systems/buck/issues.exp index e8cdfc294..59ed64edf 100644 --- a/infer/tests/build_systems/buck/issues.exp +++ b/infer/tests/build_systems/buck/issues.exp @@ -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()] diff --git a/infer/tests/build_systems/genrule/module1/Class1.java b/infer/tests/build_systems/genrule/module1/Class1.java index 2b5f77ae4..9698942cd 100644 --- a/infer/tests/build_systems/genrule/module1/Class1.java +++ b/infer/tests/build_systems/genrule/module1/Class1.java @@ -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(); + } diff --git a/infer/tests/build_systems/genrule/module2/Class2.java b/infer/tests/build_systems/genrule/module2/Class2.java index ffa3333e2..95116431f 100644 --- a/infer/tests/build_systems/genrule/module2/Class2.java +++ b/infer/tests/build_systems/genrule/module2/Class2.java @@ -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(); }