Affects PMD Version: 6.1.0 (and other ones I think)
Rule: GuardLogStatement
Description: As stated in the rule's description, the rule is intended for helping programmers to 'skip the associate String creation and manipulation' but currently it triggers at any String + String-like construct even if the resulting value is actually a literal and no Object creation is involved at all.
Code Sample demonstrating the issue:
First, the sample from the rule's description:
log.debug("log something" + " and " + "concat strings"); // the same as "log something and concat strings"
Second, more advanced case:
final String constantPrefix = "log something";
final String constantSuffix = "concat strings";
log.debug(constantPrefix + " and " + constantSuffix ); // the same as "log something and concat strings"
Running PMD through: Doesn't matter
Affects PMD Version: 6.1.0 (and other ones I think)
Rule: GuardLogStatement
Description: As stated in the rule's description, the rule is intended for helping programmers to 'skip the associate String creation and manipulation' but currently it triggers at any
String + String-like construct even if the resulting value is actually a literal and noObjectcreation is involved at all.Code Sample demonstrating the issue:
First, the sample from the rule's description:
Second, more advanced case:
Running PMD through: Doesn't matter