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`
This commit is contained in:
Edward Minnix III
2023-12-19 12:10:34 -05:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added the `Map#replace` and `Map#replaceAll` methods to the `MapMutator` class in `semmle.code.java.Maps`.

View File

@@ -40,7 +40,9 @@ class MapMethod extends Method {
/** A method that mutates the map it belongs to. */
class MapMutator extends MapMethod {
MapMutator() { pragma[only_bind_into](this).getName().regexpMatch("(put.*|remove|clear)") }
MapMutator() {
pragma[only_bind_into](this).getName().regexpMatch("(put.*|remove|clear|replace.*)")
}
}
/** The `size` method of `java.util.Map`. */