[infer][eradicate] example where the non-nullability is not correctly propagated

Reviewed By: sblackshear

Differential Revision: D6442398

fbshipit-source-id: a4b158b
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 10eef3bb1f
commit 7dd78f4135

@ -280,4 +280,18 @@ public class NullMethodCall {
chm.remove("foo").toString(); chm.remove("foo").toString();
} }
@Nullable Object nullableField;
void FP_propagatesNonNullAfterComparisonFieldOkay(Object nonNullObject) {
if (nullableField == nonNullObject) {
nullableField.toString();
}
}
void FP_propagatesNonNullAfterComparisonParameterOkay(
@Nullable Object nullableParameter, Object nonNullParameter) {
if (nullableParameter == nonNullParameter) {
nullableParameter.toString();
}
}
} }

@ -40,6 +40,8 @@ codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.useZ(), 2
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.fld at line 74)] codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.fld at line 74)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerPrivateField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.pfld at line 85)] codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerPrivateField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.pfld at line 85)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall.testSystemGetenvBad(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `envValue` in the call to `length()` could be null. (Origin: call to getenv(...) modelled in modelTables.ml at line 246)] codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall.testSystemGetenvBad(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `envValue` in the call to `length()` could be null. (Origin: call to getenv(...) modelled in modelTables.ml at line 246)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.FP_propagatesNonNullAfterComparisonFieldOkay(Object), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `NullMethodCall.nullableField` in the call to `toString()` could be null. (Origin: field NullMethodCall.nullableField at line 286)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.FP_propagatesNonNullAfterComparisonParameterOkay(Object,Object), 3, ERADICATE_NULL_METHOD_CALL, [The value of `nullableParameter` in the call to `toString()` could be null. (Origin: method parameter nullableParameter)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.callOnNull(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 25)] codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.callOnNull(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 25)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testExceptionPerInstruction(int), 6, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 186)] codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testExceptionPerInstruction(int), 6, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 186)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testFieldAssignmentIfThenElse(String), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 177)] codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testFieldAssignmentIfThenElse(String), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 177)]

Loading…
Cancel
Save