forked from phoedos/pmd
#1410 DefaultPackage triggers on field annotated with @VisibleForTesting
This commit is contained in:
@ -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']
|
||||
|
@ -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>
|
||||
|
@ -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:**
|
||||
|
||||
|
Reference in New Issue
Block a user