Skip to content

Commit 06544e9

Browse files
authored
Merge pull request #15126 from egregius313/egregius313/java/minor/add-replace-to-mapmutator
Java: Add the `Map#replace` and `Map#replaceAll` methods to `MapMutator` in `Maps.qll`
2 parents 4009b42 + a93d6dd commit 06544e9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added the `Map#replace` and `Map#replaceAll` methods to the `MapMutator` class in `semmle.code.java.Maps`.

java/ql/lib/semmle/code/java/Maps.qll

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class MapMethod extends Method {
4040

4141
/** A method that mutates the map it belongs to. */
4242
class MapMutator extends MapMethod {
43-
MapMutator() { pragma[only_bind_into](this).getName().regexpMatch("(put.*|remove|clear)") }
43+
MapMutator() {
44+
pragma[only_bind_into](this).getName().regexpMatch("(put.*|remove|clear|replace.*)")
45+
}
4446
}
4547

4648
/** The `size` method of `java.util.Map`. */

0 commit comments

Comments
 (0)