Skip to content

Commit

Permalink
Issue #46: public empty array has been moved to another class and bec…
Browse files Browse the repository at this point in the history
…ome private
  • Loading branch information
sabaka authored and romani committed Sep 16, 2015
1 parent ca15d3d commit e29dc4d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 6 additions & 1 deletion config/pmd.xml
Expand Up @@ -242,7 +242,12 @@
</rule> </rule>


<rule ref="rulesets/java/strings.xml"/> <rule ref="rulesets/java/strings.xml"/>
<rule ref="rulesets/java/sunsecure.xml"/> <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
<properties>
<!--It's not imoprtant when array is empty-->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='JavadocNodeImpl']"/>
</properties>
</rule>
<rule ref="rulesets/java/typeresolution.xml"/> <rule ref="rulesets/java/typeresolution.xml"/>
<rule ref="rulesets/java/unnecessary.xml"/> <rule ref="rulesets/java/unnecessary.xml"/>
<rule ref="rulesets/java/unusedcode.xml"/> <rule ref="rulesets/java/unusedcode.xml"/>
Expand Down
Expand Up @@ -31,6 +31,12 @@
* *
*/ */
public class JavadocNodeImpl implements DetailNode { public class JavadocNodeImpl implements DetailNode {

/**
* Empty array of {@link DetailNode} type.
*/
private static final DetailNode[] EMPTY_DETAIL_NODE_ARRAY = new DetailNode[0];

/** /**
* Node index among parent's children. * Node index among parent's children.
*/ */
Expand Down Expand Up @@ -89,7 +95,7 @@ public int getColumnNumber() {
@Override @Override
public DetailNode[] getChildren() { public DetailNode[] getChildren() {
if (children == null) { if (children == null) {
return JavadocUtils.EMPTY_DETAIL_NODE_ARRAY; return EMPTY_DETAIL_NODE_ARRAY;
} }
else { else {
return Arrays.copyOf(children, children.length); return Arrays.copyOf(children, children.length);
Expand Down
Expand Up @@ -43,10 +43,6 @@
* @author Lyle Hanson * @author Lyle Hanson
*/ */
public final class JavadocUtils { public final class JavadocUtils {
/**
* Empty array of {@link DetailNode} type.
*/
public static final DetailNode[] EMPTY_DETAIL_NODE_ARRAY = new DetailNode[0];
/** Maps from a token name to value. */ /** Maps from a token name to value. */
private static final ImmutableMap<String, Integer> TOKEN_NAME_TO_VALUE; private static final ImmutableMap<String, Integer> TOKEN_NAME_TO_VALUE;
/** Maps from a token value to name. */ /** Maps from a token value to name. */
Expand Down

0 comments on commit e29dc4d

Please sign in to comment.