A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/957 below:

False positive with compile-time constant arguments · Issue #957 · pmd/pmd · GitHub

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

andrewparmet, Lesurglesum, php-coder and Vampire


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