Skip to content

Commit 9533f12

Browse files
committed
Add explanatory commented for MapIterator model
1 parent 2ba41df commit 9533f12

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

java/ql/src/semmle/code/java/frameworks/apache/Collections.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ private class ApacheCollectionsModel extends SummaryModelCsv {
8484
"org.apache.commons.collections4;IterableGet;true;mapIterator;;;MapValue of Argument[-1];MapValue of ReturnValue;value",
8585
"org.apache.commons.collections4;KeyValue;true;getKey;;;MapKey of Argument[-1];ReturnValue;value",
8686
"org.apache.commons.collections4;KeyValue;true;getValue;;;MapValue of Argument[-1];ReturnValue;value",
87+
// Note that MapIterator<K, V> implements Iterator<K>, so it iterates over the keys of the map.
88+
// In order for the models of Iterator to work we have to use Element instead of MapKey for key data.
8789
"org.apache.commons.collections4;MapIterator;true;getKey;;;Element of Argument[-1];ReturnValue;value",
8890
"org.apache.commons.collections4;MapIterator;true;getValue;;;MapValue of Argument[-1];ReturnValue;value",
8991
"org.apache.commons.collections4;MapIterator;true;next;;;Element of Argument[-1];ReturnValue;value",

0 commit comments

Comments
 (0)