#1410 DefaultPackage triggers on field annotated with @VisibleForTesting

This commit is contained in:
Andreas Dangel
2015-09-20 20:24:46 +02:00
parent 3fb43a060a
commit 365e7a1f68
3 changed files with 13 additions and 0 deletions

View File

@ -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']

View File

@ -53,6 +53,16 @@ bad
public class Foo {
void bar() {
}
}
]]></code>
</test-code>
<test-code>
<description>#1410 DefaultPackage triggers on field annotated with @VisibleForTesting</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Foo {
@VisibleForTesting static final int[] ints = {};
}
]]></code>
</test-code>

View File

@ -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:**