Summary: The Eradicate backend is reporting nullable type errors, that are not always necessarily leading to null pointer exceptions. For example, the analysis is designed to be consistent with the Java type system and report on the following code: String foo(boolean test) { Object object = test ? new Object() : null; if (test) { return object.toString(); // the analysis reports here } } even though the code will not crash. In order to make this aspect clear, this diff renames the warnings `Null Method Call` and `Null Field Access` into `Nullable Dereference` Reviewed By: ngorogiannis Differential Revision: D14001979 fbshipit-source-id: ff1285283master
parent
14f8c3566f
commit
82c4b716bf
@ -1,22 +1,22 @@
|
|||||||
infer/tests/build_systems/genrule/module1/Class1.java, genrule.module1.Class1.localNPE1():void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: null constant at line 24)]
|
infer/tests/build_systems/genrule/module1/Class1.java, genrule.module1.Class1.localNPE1():void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: null constant at line 24)]
|
||||||
infer/tests/build_systems/genrule/module1/Class1.java, genrule.module1.Class1.localNPE1():void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure localNPE1()]
|
infer/tests/build_systems/genrule/module1/Class1.java, genrule.module1.Class1.localNPE1():void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure localNPE1()]
|
||||||
infer/tests/build_systems/genrule/module1/Class1.java, genrule.module1.Class1.unannotatedReturnNull():java.lang.Object, 0, ERADICATE_RETURN_NOT_NULLABLE, no_bucket, WARNING, [origin,Method `unannotatedReturnNull()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 33)]
|
infer/tests/build_systems/genrule/module1/Class1.java, genrule.module1.Class1.unannotatedReturnNull():java.lang.Object, 0, ERADICATE_RETURN_NOT_NULLABLE, no_bucket, WARNING, [origin,Method `unannotatedReturnNull()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 33)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, no_bucket, WARNING, [First parameter `object` of method `Class2$Sub.subtypingInconsistency(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `Class1$Sub.subtypingInconsistency(...)`.]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, no_bucket, WARNING, [First parameter `object` of method `Class2$Sub.subtypingInconsistency(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `Class1$Sub.subtypingInconsistency(...)`.]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, no_bucket, WARNING, [Method `Class2$Sub.subtypingInconsistency(...)` is annotated with `@Nullable` but overrides unannotated method `Class1$Sub.subtypingInconsistency(...)`.]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, no_bucket, WARNING, [Method `Class2$Sub.subtypingInconsistency(...)` is annotated with `@Nullable` but overrides unannotated method `Class1$Sub.subtypingInconsistency(...)`.]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 1, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `class1.field1` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class1.field1 at line 53)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `class1.field1` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class1.field1 at line 53)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceInterTargetField1Bad(...)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceInterTargetField1Bad(...)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 1, ERADICATE_NULL_FIELD_ACCESS, no_bucket, WARNING, [origin,Object `class1.field2` is nullable and is not locally checked for null when accessing field `Class1.x`. (Origin: field Class1.field2 at line 57)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,Object `class1.field2` is nullable and is not locally checked for null when accessing field `Class1.x`. (Origin: field Class1.field2 at line 57)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceInterTargetField2Bad(...)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceInterTargetField2Bad(...)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 1, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `Class2.field` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class2.field at line 49)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `Class2.field` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class2.field at line 49)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceLocalNullableFieldBad()]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceLocalNullableFieldBad()]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceUnannotatedMethodReturningNullBad(genrule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceUnannotatedMethodReturningNullBad(...),start of procedure unannotatedReturnNull(),return from a call to Object Class1.unannotatedReturnNull()]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceUnannotatedMethodReturningNullBad(genrule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceUnannotatedMethodReturningNullBad(...),start of procedure unannotatedReturnNull(),return from a call to Object Class1.unannotatedReturnNull()]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj2` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to annotatedNullable() at line 39)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj2` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to annotatedNullable() at line 39)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure followMethodDeclarationOnlyBad(...),Skipping annotatedNullable(): unknown method]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure followMethodDeclarationOnlyBad(...),Skipping annotatedNullable(): unknown method]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to abstractMayReturnNull() at line 29)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to abstractMayReturnNull() at line 29)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetAbstractNPEBad(...),Skipping abstractMayReturnNull(): unknown method]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetAbstractNPEBad(...),Skipping abstractMayReturnNull(): unknown method]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to returnsNull() at line 24)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to returnsNull() at line 24)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetNPEBad(),start of procedure returnsNull(),return from a call to String Class1.returnsNull()]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetNPEBad(),start of procedure returnsNull(),return from a call to String Class1.returnsNull()]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to nativeMayReturnNull() at line 34)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to nativeMayReturnNull() at line 34)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetNativeNPEBad(...),Skipping nativeMayReturnNull(): unknown method]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetNativeNPEBad(...),Skipping nativeMayReturnNull(): unknown method]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: null constant at line 19)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: null constant at line 19)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure localNPE2Bad()]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure localNPE2Bad()]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, no_bucket, WARNING, [First parameter `object` of method `Class2$Sub.subtypingInconsistency(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `Class1$Sub.subtypingInconsistency(...)`.]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, no_bucket, WARNING, [First parameter `object` of method `Class2$Sub.subtypingInconsistency(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `Class1$Sub.subtypingInconsistency(...)`.]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, no_bucket, WARNING, [Method `Class2$Sub.subtypingInconsistency(...)` is annotated with `@Nullable` but overrides unannotated method `Class1$Sub.subtypingInconsistency(...)`.]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, no_bucket, WARNING, [Method `Class2$Sub.subtypingInconsistency(...)` is annotated with `@Nullable` but overrides unannotated method `Class1$Sub.subtypingInconsistency(...)`.]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 1, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `class1.field1` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class1.field1 at line 53)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `class1.field1` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class1.field1 at line 53)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 1, ERADICATE_NULL_FIELD_ACCESS, no_bucket, WARNING, [origin,Object `class1.field2` is nullable and is not locally checked for null when accessing field `Class1.x`. (Origin: field Class1.field2 at line 57)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,Object `class1.field2` is nullable and is not locally checked for null when accessing field `Class1.x`. (Origin: field Class1.field2 at line 57)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 1, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `Class2.field` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class2.field at line 49)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `Class2.field` in the call to `toString()` is nullable and is not locally checked for null. (Origin: field Class2.field at line 49)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj2` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to annotatedNullable() at line 39)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj2` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to annotatedNullable() at line 39)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to abstractMayReturnNull() at line 29)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to abstractMayReturnNull() at line 29)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to returnsNull() at line 24)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to returnsNull() at line 24)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to nativeMayReturnNull() at line 34)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to nativeMayReturnNull() at line 34)]
|
||||||
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 2, ERADICATE_NULL_METHOD_CALL, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: null constant at line 19)]
|
infer/tests/build_systems/genrule/module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [origin,The value of `obj` in the call to `toString()` is nullable and is not locally checked for null. (Origin: null constant at line 19)]
|
||||||
|
Loading…
Reference in new issue