diff --git a/CHANGELOG.md b/CHANGELOG.md index 21a7ee4bb..727122867 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [#3](https://github.com/green-code-initiative/ecoCode-java/issues/3) Improvement: pattern declaration not only in a static way + ### Deleted ## [1.5.4] - 2024-05-24 diff --git a/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc b/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc index 188b8f648..3295f32a8 100644 --- a/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc +++ b/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc @@ -51,3 +51,14 @@ public class ValidRegexPattern3 { } } ``` + +##Compliant Solution N°4 + +```java +public class ValidRegexPattern { + public boolean foo(String param) { + final Pattern pattern = Pattern.compile("foo" + param); // Compliant + return pattern.matcher("foo").find(); + } +} +``` \ No newline at end of file