A RetroSearch Logo

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

Search Query:

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

[java] Allow `@SuppressWarnings` with constants instead of literals · Issue #520 · pmd/pmd · GitHub

Description:
PMD allows violation suppression through the @SuppressWarnings annotation, but such suppression currently only allows for a literal even when constants are valid in the Java grammar.

Edge cases (initialization on a static block with arbitrary code), or calls to static methods can't be properly resolved, but the most basic case can certainly be with the current infrastructure.

Code Sample demonstrating the issue:

public class NewClass {
    private final static String PMD_UNUSED_FORMAL_PARAMETER = "PMD.UnusedFormalParameter";

    @SuppressWarnings(PMD_UNUSED_FORMAL_PARAMETER)
    public void someMethod1(Object param) {
        System.out.println("someMethod1");
    }
}

Running PMD through: any


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