Affects PMD Version:
6.22 and earlier
Rule:
Description:
When using annotations that require string values, e.g. SuppressWarnings
, and the value should be computed from e.g. an integer constant, empty strings addition is the (only?) way to get a compile time constant string. It is desirable to do so in order to adhere to the DRY principle.
That is, the rule needs to consider its context to determine correctness.
Code Sample demonstrating the issue:
static final int MY_CONST = 23; @SomeAnnotationWithStringValue("" + MY_CONST) Object object;
Running PMD through:
N/A
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