[infer][genrule] use Eradicate for the genrule test

Reviewed By: sblackshear

Differential Revision: D6921710

fbshipit-source-id: 911100a
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 91fbe68cc9
commit 5f3c3ee3f9

@ -40,6 +40,7 @@ def create_infer_genrule(
srcs=srcs,
cmd = ' '.join([
os.getenv('INFER_BIN', 'infer'),
'--eradicate-only',
'--results-dir', '$OUT',
'--classpath', '$(classpath :{})'.format(name),
'--sourcepath', '$SRCDIR',

@ -1,6 +1,8 @@
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.dereferenceInterTargetFieldBad(Class1), 1, NULL_DEREFERENCE, [start of procedure dereferenceInterTargetFieldBad(...)]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.dereferenceLocalNullableFieldBad(), 1, NULL_DEREFERENCE, [start of procedure dereferenceLocalNullableFieldBad()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.followMethodDeclarationOnlyBad(SkipImplementationClass1), 2, NULL_DEREFERENCE, [start of procedure followMethodDeclarationOnlyBad(...),Skipping annotatedNullable(): method has no implementation,Definition of annotatedNullable()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetAbstractNPE(Class1), 2, NULL_DEREFERENCE, [start of procedure interTargetAbstractNPE(...),Skipping abstractMayReturnNull(): abstract method,Definition of abstractMayReturnNull()]
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.interTargetNativeNPE(Class1), 2, NULL_DEREFERENCE, [start of procedure interTargetNativeNPE(...),Skipping nativeMayReturnNull(): method has no implementation,Definition of nativeMayReturnNull()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.localNPE2(), 2, NULL_DEREFERENCE, [start of procedure localNPE2()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetAbstractNPEBad(Class1), 2, NULL_DEREFERENCE, [start of procedure interTargetAbstractNPEBad(...),Skipping abstractMayReturnNull(): abstract method,Definition of abstractMayReturnNull()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetNPEBad(), 2, NULL_DEREFERENCE, [start of procedure interTargetNPEBad(),start of procedure returnsNull(),return from a call to String Class1.returnsNull()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetNativeNPEBad(Class1), 2, NULL_DEREFERENCE, [start of procedure interTargetNativeNPEBad(...),Skipping nativeMayReturnNull(): method has no implementation,Definition of nativeMayReturnNull()]
infer/tests/build_systems/genrule/module2/Class2.java, void Class2.localNPE2Bad(), 2, NULL_DEREFERENCE, [start of procedure localNPE2Bad()]

@ -1 +1,3 @@
build_systems/genrule/module2/Class2.java, void Class2.localNPE2(), 2, NULL_DEREFERENCE, [start of procedure localNPE2()]
build_systems/genrule/module2/Class2.java, void Class2.dereferenceInterTargetFieldBad(Class1), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `class1.field1` in the call to `toString()` could be null. (Origin: field Class1.field1 at line 55)]
build_systems/genrule/module2/Class2.java, void Class2.dereferenceLocalNullableFieldBad(), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `Class2.field2` in the call to `toString()` could be null. (Origin: field Class2.field2 at line 51)]
build_systems/genrule/module2/Class2.java, void Class2.localNPE2Bad(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: null constant at line 21)]

@ -13,6 +13,8 @@ import genrule.annotations.Nullable;
public abstract class Class1 {
public @Nullable Object field1;
public static @Nullable String returnsNull() {
return null;
}

@ -2,6 +2,7 @@ java_library(
name='module2',
srcs=glob(["*.java"]),
deps=[
'//infer/tests/build_systems/genrule/module1:module1'
'//infer/tests/build_systems/genrule/module1:module1',
'//infer/tests/build_systems/genrule/annotations:annotations',
]
)

@ -9,27 +9,30 @@
package genrule.module2;
import genrule.annotations.Nullable;
import genrule.module1.Class1;
import genrule.module1.SkipImplementationClass1;
public class Class2 {
void localNPE2() {
@Nullable Object field2;
void localNPE2Bad() {
Object obj = null;
obj.toString();
}
void interTargetNPE() {
void interTargetNPEBad() {
Object obj = Class1.returnsNull();
obj.toString();
}
void interTargetAbstractNPE(Class1 class1) {
void interTargetAbstractNPEBad(Class1 class1) {
Object obj = class1.abstractMayReturnNull();
obj.toString();
}
void interTargetNativeNPE(Class1 class1) {
void interTargetNativeNPEBad(Class1 class1) {
Object obj = class1.nativeMayReturnNull();
obj.toString();
}
@ -44,4 +47,12 @@ public class Class2 {
obj2.toString();
}
void dereferenceLocalNullableFieldBad() {
field2.toString();
}
void dereferenceInterTargetFieldBad(Class1 class1) {
class1.field1.toString();
}
}

Loading…
Cancel
Save