Issue #1555: Fix false-positive in mismatched array read write rule

False-positive reported to JetBrains as [IDEA-144521](https://youtrack.jetbrains.com/issue/IDEA-144521).

Fixes `MismatchedArrayReadWrite` inspection violations.

Description:
>Reports any array fields or variables whose contents are read but not written, or written but not read. Such mismatched reads and writes are pointless, and probably indicate dead, incomplete or erroneous code.
This commit is contained in:
Michal Kordas 2015-08-28 23:58:10 +02:00 committed by Roman Ivanov
parent 8985e645a8
commit f58f92adf6
2 changed files with 5 additions and 6 deletions

View File

@ -32,11 +32,6 @@ import com.puppycrawl.tools.checkstyle.utils.JavadocUtils;
*
*/
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
*/
@ -95,7 +90,7 @@ public class JavadocNodeImpl implements DetailNode {
@Override
public DetailNode[] getChildren() {
if (children == null) {
return EMPTY_DETAIL_NODE_ARRAY.clone();
return JavadocUtils.EMPTY_DETAIL_NODE_ARRAY;
}
else {
return Arrays.copyOf(children, children.length);

View File

@ -43,6 +43,10 @@ import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTags;
* @author Lyle Hanson
*/
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 */
private static final ImmutableMap<String, Integer> TOKEN_NAME_TO_VALUE;
/** Maps from a token value to name */