[java] record HashMap get from `KeySet()` FP from #128

Summary: For posterity. See https://github.com/facebook/infer/issues/128

Reviewed By: dulmarod

Differential Revision: D8443764

fbshipit-source-id: f784e6067
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent b23449a7d2
commit 2761a62e94

@ -109,4 +109,13 @@ public class HashMapExample {
map.get(key).toString(); // NPE here
}
void getFromKeySetGood_FP(HashMap<String, String> map) {
for (String key : map.keySet()) {
String s = map.get(key);
if (s.equals("foo")) {
System.out.println("true");
}
}
}
}

@ -94,6 +94,7 @@ codetoanalyze/java/infer/GuardedByExample.java, void GuardedByExample.writeFBadW
codetoanalyze/java/infer/HashMapExample.java, int HashMapExample.getOneIntegerWithoutCheck(), 6, NULL_DEREFERENCE, B1, ERROR, [start of procedure getOneIntegerWithoutCheck()]
codetoanalyze/java/infer/HashMapExample.java, void HashMapExample.getAfterClearBad(), 5, NULL_DEREFERENCE, B1, ERROR, [start of procedure getAfterClearBad()]
codetoanalyze/java/infer/HashMapExample.java, void HashMapExample.getAfterRemovingTheKeyBad(), 5, NULL_DEREFERENCE, B1, ERROR, [start of procedure getAfterRemovingTheKeyBad()]
codetoanalyze/java/infer/HashMapExample.java, void HashMapExample.getFromKeySetGood_FP(HashMap), 3, NULL_DEREFERENCE, B2, ERROR, [start of procedure getFromKeySetGood_FP(...),Taking true branch]
codetoanalyze/java/infer/HashMapExample.java, void HashMapExample.getTwoIntegersWithOneCheck(Integer,Integer), 11, NULL_DEREFERENCE, B2, ERROR, [start of procedure getTwoIntegersWithOneCheck(...),Taking true branch,Taking true branch]
codetoanalyze/java/infer/IntegerExample.java, void IntegerExample.testIntegerEqualsBad(), 6, NULL_DEREFERENCE, B1, ERROR, [start of procedure testIntegerEqualsBad(),Taking true branch]
codetoanalyze/java/infer/InvokeDynamic.java, int InvokeDynamic.lambda$npeInLambdaBad$1(String,String), 1, NULL_DEREFERENCE, B1, ERROR, [start of procedure lambda$npeInLambdaBad$1(...)]

Loading…
Cancel
Save