openrewrite / rewrite-static-analysis

OpenRewrite recipes for identifying and fixing static analysis issues.
Apache License 2.0
27 stars 43 forks source link

Do not rewrite String.replaceAll with special chars in replacement string #306

Closed protocol7 closed 6 days ago

protocol7 commented 6 days ago

If the replacement string of String.replaceAll contains $ or \, we should not rewrite it as these indicate special replacements: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/Matcher.html#replaceAll(java.lang.String)