Affects PMD Version: 7.14.0
Rule: InvalidLogMessageFormat
Description:
If there is no argument but only the log message and the exception then pmd reports InvalidLogMessageFormat
Code Sample demonstrating the issue:
@Slf4j
public class Main {
public static void main(String[] args) {
var abcd = new AClass(new Exception("abcd"));
log.error("Hello World", abcd.getT());
}
@Value
private static class AClass {
Throwable t;
}
}
Expected outcome:
PMD reports a violation at line ..., but that's wrong. That's a false positive.
Running PMD through: Maven