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.)
test1
above, where the comment meant to represent a package modifier is after the annotation on that method, a CommentDefaultAccessModifier
rule violation is flagged up.test2
, where that comment is before the annotation.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