-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
In the following code example, there is an INEFFICIENT_KEYSET_ITERATOR
issue at line 8. However, Infer fails to report this warning, resulting in a false negative.
Minimized Code Example
import java.util.HashMap;
public class Main {
public static void main(String[] args) {
HashMap<String, String> map = new HashMap<>();
map.keySet()
.forEach(
key -> {
String s = map.get(key); // should report a warning, but no warnings
if (s.equals("foo")) {
System.out.println("true");
}
});
}
}
Analysis Log
Capturing in javac mode...
Found 1 source file to analyze in /.../infer-out
0/8 [................................................................................] 0% 116ms
⊢ [ 0.1s][ 8.8M] idle
⊢ [ 0.1s][ 8.8M] idle
4/8 [########################################........................................] 50% 184ms
⊢ [ 0.0s][ 8.8M] Main.java
⊢ [ 0.2s][ 8.8M] idle
8/8 [################################################################################] 100% 192ms
⊢ [ 0.0s][ 8.8M] idle
⊢ [ 0.0s][ 8.8M] idle
⊢ [ 0.0s][10.2M] idle
No issues found
Metadata
Metadata
Assignees
Labels
No labels