fix and suppressions for Findbugs violations UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR. Issue #912

This commit is contained in:
Roman Ivanov 2015-04-12 23:45:56 -07:00
parent 674176022a
commit 032faf4eb4
2 changed files with 21 additions and 1 deletions

View File

@ -87,4 +87,20 @@
<Class name="com.puppycrawl.tools.checkstyle.api.DetailAST" />
<Bug pattern="BC_UNCONFIRMED_CAST" />
</Match>
<Match>
<!-- false positive, beginTree is a kind of constructor for Checks -->
<Or>
<Class name="com.puppycrawl.tools.checkstyle.checks.DeclarationCollector" />
<Class name="com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck" />
<Class name="com.puppycrawl.tools.checkstyle.checks.RegexpCheck" />
<!-- createJavadocNode is private and can not be launched without visitToken-->
<Class name="com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck" />
<!-- has only one public method and all nitialized inthat method-->
<Class name="com.puppycrawl.tools.checkstyle.checks.regexp.MultilineDetector" />
<!-- beginProcessing() is kind of c-tor -->
<Class name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck" />
<Class name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck" />
</Or>
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" />
</Match>
</FindBugsFilter>

View File

@ -93,7 +93,11 @@ public class JavadocNodeImpl implements DetailNode
@Override
public DetailNode[] getChildren()
{
return Arrays.copyOf(children, children.length);
if (children == null) {
return children;
} else {
return Arrays.copyOf(children, children.length);
}
}
@Override