A RetroSearch Logo

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

Search Query:

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

[java] AddEmptyString false positive in annotation value · Issue #2364 · pmd/pmd · GitHub

Affects PMD Version:

6.22 and earlier

Rule:

AddEmptyString

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