Affects PMD Version:
PMD version: 6.38.0
Rule:
https://pmd.github.io/pmd-6.39.0/pmd_rules_java_errorprone.html#invalidlogmessageformat
Description:
In case, we want to log a message the corresponding exception inside a block within a lambda, PMD sees it as a violation while it accepts it directly at the root level of the lambda.
Code Sample demonstrating the issue:
public static Consumer<Throwable> build() {
return e -> {
if (e instanceof RuntimeException) {
LOGGER.warn("Unexpected RuntimeException", e);
}
};
}
Expected outcome:
PMD reports a violation at line 4, but that's wrong. That's a false positive.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Using the maven plugin version 3.15.0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4