diff --git a/pmd-java/src/main/resources/rulesets/java/controversial.xml b/pmd-java/src/main/resources/rulesets/java/controversial.xml index 18832bf38f..1627cc401d 100644 --- a/pmd-java/src/main/resources/rulesets/java/controversial.xml +++ b/pmd-java/src/main/resources/rulesets/java/controversial.xml @@ -287,6 +287,7 @@ Use explicit scoping instead of the default package private level. //ClassOrInterfaceDeclaration[@Interface='false'] /ClassOrInterfaceBody /ClassOrInterfaceBodyDeclaration +[not(Annotation//Name[ends-with(@Image, 'VisibleForTesting')])] [ FieldDeclaration[@PackagePrivate='true'] or MethodDeclaration[@PackagePrivate='true'] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/DefaultPackage.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/DefaultPackage.xml index cb102dacf3..02611a2c9e 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/DefaultPackage.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/DefaultPackage.xml @@ -53,6 +53,16 @@ bad public class Foo { void bar() { } +} + ]]> + + + + #1410 DefaultPackage triggers on field annotated with @VisibleForTesting + 0 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index b6f371cb17..0d1d45717d 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -16,6 +16,8 @@ **Bugfixes:** +* java-controversial/DefaultPackage: + [#1410](https://sourceforge.net/p/pmd/bugs/1410/): DefaultPackage triggers on field annotated with @VisibleForTesting **API Changes:**