A RetroSearch Logo

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

Search Query:

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

[java] CommentDefaultAccessModifier comment needs to be before annotation if present · Issue #4578 · pmd/pmd · GitHub

Affects PMD Version: 7.0.0-rc2

Rule: CommentDefaultAccessModifier

Description:

Code Sample demonstrating the issue:

    @SuppressWarnings("")
    /* package */ void test1() {
        System.out.println("This triggers CommentDefaultAccessModifier");
    }

    /* package */ @SuppressWarnings("")
    void test2() {
        System.out.println("This does not trigger CommentDefaultAccessModifier");
    }

Expected outcome:

(I'm not sure if this is intended, and it's probably a matter of opinion.)

Since /* package */ seems to be intended to replace a public/private/protected modifier that doesn't exist for default access, it feels it would fit more naturally where those modifiers would be, i.e. between the annotations and the return type (as in test1).
However, this is currently flagged as a CommentDefaultAccessModifier rule violation.

Running PMD through: Maven (using maven-pmd-plugin version 3.20.1-pmd-7-SNAPSHOT configured with PMD 7.0.0-rc2)


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