[eradicate] record false positive when testing the return on an assignment

Reviewed By: ngorogiannis

Differential Revision: D15321693

fbshipit-source-id: a6aa7068a
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent 80ecc959a4
commit 8d36c33d20

@ -337,14 +337,21 @@ public class NullMethodCall {
void nullabilityNotPreservedAfterAssignment() {
if (getNullable() != null) {
Object t = getNullable();
t.toString();
t.toString(); // Should not warn here
}
}
void nullabilityStoredInBooleanFP() {
boolean isNotNull = getNullable() != null;
if (isNotNull) {
getNullable().toString();
getNullable().toString(); // Should not warn here
}
}
void testInAssignmentFP(@Nullable Object object) {
Object t;
while ((t = getNullable()) != null) {
t.toString(); // Should not warn here
}
}
}

@ -58,6 +58,7 @@ codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.N
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.nullabilityStoredInBooleanFP():void, 3, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `getNullable()` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to getNullable() at line 345)]
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.testExceptionPerInstruction(int):void, 6, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `s` in the call to `length()` is nullable and is not locally checked for null. (Origin: null constant at line 180)]
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.testFieldAssignmentIfThenElse(java.lang.String):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `s` in the call to `length()` is nullable and is not locally checked for null. (Origin: null constant at line 171)]
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.testInAssignmentFP(java.lang.Object):void, 3, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `t` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to getNullable() at line 353)]
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.testMapGetBad(java.util.Map,java.util.HashMap,java.util.concurrent.ConcurrentHashMap):void, 2, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `m.get(...)` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to get(...) modelled in modelTables.ml at line 259)]
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.testMapGetBad(java.util.Map,java.util.HashMap,java.util.concurrent.ConcurrentHashMap):void, 3, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `hm.get(...)` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to get(...) modelled in modelTables.ml at line 260)]
codetoanalyze/java/eradicate/NullMethodCall.java, codetoanalyze.java.eradicate.NullMethodCall.testMapGetBad(java.util.Map,java.util.HashMap,java.util.concurrent.ConcurrentHashMap):void, 4, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [The value of `chm.get(...)` in the call to `toString()` is nullable and is not locally checked for null. (Origin: call to get(...) modelled in modelTables.ml at line 261)]

Loading…
Cancel
Save