ExplicitInitialization added to checkstyle's style. Fixed problems it found.
This commit is contained in:
parent
1bb0fb09a3
commit
984eb8d742
|
|
@ -132,5 +132,6 @@
|
|||
<property name="max" value="3"/>
|
||||
</module>
|
||||
<module name="NestedTryDepth"/>
|
||||
<module name="ExplicitInitialization"/>
|
||||
</module>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ public class CheckStyleTask
|
|||
private String mConfigLocation;
|
||||
|
||||
/** contains package names */
|
||||
private File mPackageNamesFile = null;
|
||||
private File mPackageNamesFile;
|
||||
|
||||
/** whether to fail build on violations */
|
||||
private boolean mFailOnViolation = true;
|
||||
|
||||
/** property to set on violations */
|
||||
private String mFailureProperty = null;
|
||||
private String mFailureProperty;
|
||||
|
||||
/** contains the filesets to process */
|
||||
private final List mFileSets = new ArrayList();
|
||||
|
|
@ -455,9 +455,9 @@ public class CheckStyleTask
|
|||
public static class Formatter
|
||||
{
|
||||
/** the formatter type */
|
||||
private FormatterType mFormatterType = null;
|
||||
private FormatterType mFormatterType;
|
||||
/** the file to output to */
|
||||
private File mToFile = null;
|
||||
private File mToFile;
|
||||
|
||||
/**
|
||||
* Set the type of the formatter.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class Checker extends AutomaticBean
|
|||
private class ErrorCounter implements AuditListener
|
||||
{
|
||||
/** keeps track of the number of errors */
|
||||
private int mCount = 0;
|
||||
private int mCount;
|
||||
|
||||
/** @see AuditListener */
|
||||
public void addError(AuditEvent aEvt)
|
||||
|
|
@ -334,8 +334,8 @@ public class Checker extends AutomaticBean
|
|||
if (!onNetWare) {
|
||||
if (!aPath.startsWith(File.separator)
|
||||
&& !(aPath.length() >= 2
|
||||
&& Character.isLetter(aPath.charAt(0))
|
||||
&& colon == 1))
|
||||
&& Character.isLetter(aPath.charAt(0))
|
||||
&& colon == 1))
|
||||
{
|
||||
String msg = aPath + " is not an absolute path";
|
||||
throw new IllegalArgumentException(msg);
|
||||
|
|
|
|||
|
|
@ -143,14 +143,14 @@ public final class ConfigurationLoader
|
|||
}
|
||||
|
||||
/** the SAX document handler */
|
||||
private InternalLoader mSaxHandler = null;
|
||||
private InternalLoader mSaxHandler;
|
||||
|
||||
/** property resolver **/
|
||||
private final PropertyResolver mOverridePropsResolver;
|
||||
/** the loaded configurations **/
|
||||
private final Stack mConfigStack = new Stack();
|
||||
/** the Configuration that is being built */
|
||||
private Configuration mConfiguration = null;
|
||||
private Configuration mConfiguration;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ final class StringArrayReader extends Reader
|
|||
private final String[] mUnderlyingArray;
|
||||
|
||||
/** the index of the currently read String */
|
||||
private int mArrayIdx = 0;
|
||||
private int mArrayIdx;
|
||||
|
||||
/** the index of the next character to be read */
|
||||
private int mStringIdx = 0;
|
||||
private int mStringIdx;
|
||||
|
||||
/** flag to tell whether an implicit newline has to be reported */
|
||||
private boolean mUnreportedNewline = false;
|
||||
private boolean mUnreportedNewline;
|
||||
|
||||
/** flag to tell if the reader has been closed */
|
||||
private boolean mClosed = false;
|
||||
private boolean mClosed;
|
||||
|
||||
/**
|
||||
* Creates a new StringArrayReader.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public abstract class AbstractFileSetCheck
|
|||
implements FileSetCheck
|
||||
{
|
||||
/** The dispatcher errors are fired to. */
|
||||
private MessageDispatcher mDispatcher = null;
|
||||
private MessageDispatcher mDispatcher;
|
||||
|
||||
/** the file extensions that are accepted by this filter */
|
||||
private String[] mFileExtensions = {};
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public abstract class Check extends AbstractViolationReporter
|
|||
private static final int DEFAULT_TAB_WIDTH = 8;
|
||||
|
||||
/** the current file contents */
|
||||
private FileContents mFileContents = null;
|
||||
private FileContents mFileContents;
|
||||
|
||||
/** the tokens the check is interested in */
|
||||
private final Set mTokens = new HashSet();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ package com.puppycrawl.tools.checkstyle.api;
|
|||
public class CheckstyleException extends Exception
|
||||
{
|
||||
/** the cause of this exception */
|
||||
private Throwable mCause = null;
|
||||
private Throwable mCause;
|
||||
|
||||
/**
|
||||
* Creates a new <code>CheckstyleException</code> instance.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public final class DetailAST
|
|||
* Token 'x' (where x is an int) is in this branch
|
||||
* if mBranchTokenTypes.get(x) is true.
|
||||
*/
|
||||
private BitSet mBranchTokenTypes = null;
|
||||
private BitSet mBranchTokenTypes;
|
||||
|
||||
/** @see antlr.CommonAST **/
|
||||
public void initialize(Token aTok)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public abstract class AbstractTypeAwareCheck
|
|||
private Set mImports = new HashSet();
|
||||
|
||||
/** full identifier for package of the method **/
|
||||
private FullIdent mPackageFullIdent = null;
|
||||
private FullIdent mPackageFullIdent;
|
||||
|
||||
/** <code>ClassResolver</code> instance for current tree. */
|
||||
private ClassResolver mClassResolver;
|
||||
|
|
|
|||
|
|
@ -167,13 +167,13 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
|||
public class DescendantTokenCheck extends Check
|
||||
{
|
||||
/** minimum depth */
|
||||
private int mMinimumDepth = 0;
|
||||
private int mMinimumDepth;
|
||||
|
||||
/** maximum depth */
|
||||
private int mMaximumDepth = Integer.MAX_VALUE;
|
||||
|
||||
/** minimum number */
|
||||
private int mMinimumNumber = 0;
|
||||
private int mMinimumNumber;
|
||||
|
||||
/** maximum number */
|
||||
private int mMaximumNumber = Integer.MAX_VALUE;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class GenericIllegalRegexpCheck extends AbstractFormatCheck
|
|||
private String mMessage = "";
|
||||
|
||||
/** case insensitive? **/
|
||||
private boolean mIgnoreCase = false;
|
||||
private boolean mIgnoreCase;
|
||||
|
||||
/**
|
||||
* Setter for message property.
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class HeaderCheck
|
|||
private static final int[] EMPTY_INT_ARRAY = new int[0];
|
||||
|
||||
/** the lines of the header file */
|
||||
private String[] mHeaderLines = null;
|
||||
private String[] mHeaderLines;
|
||||
|
||||
/** the header lines to ignore in the check, sorted */
|
||||
private int[] mIgnoreLines = EMPTY_INT_ARRAY;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ import com.puppycrawl.tools.checkstyle.api.Utils;
|
|||
public class RegexpHeaderCheck extends HeaderCheck
|
||||
{
|
||||
/** the compiled regular expressions */
|
||||
private RE[] mHeaderRegexps = null;
|
||||
private RE[] mHeaderRegexps;
|
||||
|
||||
/**
|
||||
* Sets the file that contains the header to check against.
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class AvoidNestedBlocksCheck extends Check
|
|||
* Whether nested blocks are allowed if they are the
|
||||
* only child of a switch case.
|
||||
*/
|
||||
private boolean mAllowInSwitchCase = false;
|
||||
private boolean mAllowInSwitchCase;
|
||||
|
||||
/** @see Check */
|
||||
public int[] getDefaultTokens()
|
||||
|
|
|
|||
|
|
@ -82,13 +82,13 @@ public class HiddenFieldCheck
|
|||
private LinkedList mFieldsStack = new LinkedList();
|
||||
|
||||
/** the regexp to match against */
|
||||
private RE mRegexp = null;
|
||||
private RE mRegexp;
|
||||
|
||||
/** controls whether to check the parameter of a property setter method */
|
||||
private boolean mIgnoreSetter = false;
|
||||
private boolean mIgnoreSetter;
|
||||
|
||||
/** controls whether to check the parameter of a constructor */
|
||||
private boolean mIgnoreConstructorParameter = false;
|
||||
private boolean mIgnoreConstructorParameter;
|
||||
|
||||
/** @see com.puppycrawl.tools.checkstyle.api.Check */
|
||||
public int[] getDefaultTokens()
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class IllegalInstantiationCheck
|
|||
private final Set mIllegalClasses = new HashSet();
|
||||
|
||||
/** name of the package */
|
||||
private String mPkgName = null;
|
||||
private String mPkgName;
|
||||
|
||||
/** the imports for the file */
|
||||
private final Set mImports = new HashSet();
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ public class RedundantThrowsCheck
|
|||
* whether unchecked exceptions in throws
|
||||
* are allowed or not
|
||||
*/
|
||||
private boolean mAllowUnchecked = false;
|
||||
private boolean mAllowUnchecked;
|
||||
|
||||
/**
|
||||
* whether subclass of another declared
|
||||
* exception is allowed in throws clause
|
||||
*/
|
||||
private boolean mAllowSubclasses = false;
|
||||
private boolean mAllowSubclasses;
|
||||
|
||||
/**
|
||||
* Getter for allowUnchecked property.
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ public class VisibilityModifierCheck
|
|||
extends Check
|
||||
{
|
||||
/** whether protected members are allowed */
|
||||
private boolean mProtectedAllowed = false;
|
||||
private boolean mProtectedAllowed;
|
||||
|
||||
/** whether package visible members are allowed */
|
||||
private boolean mPackageAllowed = false;
|
||||
private boolean mPackageAllowed;
|
||||
|
||||
/**
|
||||
* pattern for public members that should be ignored. Note:
|
||||
|
|
@ -61,7 +61,7 @@ public class VisibilityModifierCheck
|
|||
private String mPublicMemberPattern = "^serialVersionUID$";
|
||||
|
||||
/** regexp for public members that should be ignored */
|
||||
private RE mPublicMemberRE = null;
|
||||
private RE mPublicMemberRE;
|
||||
|
||||
/** Create an instance. */
|
||||
public VisibilityModifierCheck()
|
||||
|
|
|
|||
|
|
@ -172,10 +172,10 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck
|
|||
private int mLoc;
|
||||
|
||||
/** number of chache misses */
|
||||
private long mCacheMisses = 0;
|
||||
private long mCacheMisses;
|
||||
|
||||
/** number of cache hits */
|
||||
private long mCacheHits = 0;
|
||||
private long mCacheHits;
|
||||
|
||||
/** Creates a new instance of this class. */
|
||||
public StrictDuplicateCodeCheck()
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class IndentationCheck extends Check
|
|||
private int mCaseIndentationAmount = DEFAULT_INDENTATION;
|
||||
|
||||
/** how far brace should be indented when on next line */
|
||||
private int mBraceAdjustment = 0;
|
||||
private int mBraceAdjustment;
|
||||
|
||||
/** handlers currently in use */
|
||||
private ArrayStack mHandlers = new ArrayStack();
|
||||
|
|
|
|||
|
|
@ -143,35 +143,35 @@ public class JavadocMethodCheck
|
|||
* are not declared if they are a subclass of
|
||||
* java.lang.RuntimeException.
|
||||
**/
|
||||
private boolean mAllowUndeclaredRTE = false;
|
||||
private boolean mAllowUndeclaredRTE;
|
||||
|
||||
/**
|
||||
* controls whether to allow documented exceptions that
|
||||
* are subclass of one of declared exception.
|
||||
* Defaults to false (backward compatibility).
|
||||
**/
|
||||
private boolean mAllowThrowsTagsForSubclasses = false;
|
||||
private boolean mAllowThrowsTagsForSubclasses;
|
||||
|
||||
/**
|
||||
* controls whether to ignore errors when a method has parameters
|
||||
* but does not have matching param tags in the javadoc.
|
||||
* Defaults to false.
|
||||
**/
|
||||
private boolean mAllowMissingParamTags = false;
|
||||
private boolean mAllowMissingParamTags;
|
||||
|
||||
/**
|
||||
* controls whether to ignore errors when a method declares that
|
||||
* it throws exceptions but does not have matching throws tags
|
||||
* in the javadoc. Defaults to false.
|
||||
**/
|
||||
private boolean mAllowMissingThrowsTags = false;
|
||||
private boolean mAllowMissingThrowsTags;
|
||||
|
||||
/**
|
||||
* controls whether to ignore errors when a method returns
|
||||
* non-void type but does not have a return tag in the javadoc.
|
||||
* Defaults to false.
|
||||
**/
|
||||
private boolean mAllowMissingReturnTag = false;
|
||||
private boolean mAllowMissingReturnTag;
|
||||
|
||||
/**
|
||||
* Set the scope.
|
||||
|
|
|
|||
|
|
@ -84,13 +84,13 @@ public class JavadocTypeCheck
|
|||
/** the scope to check for */
|
||||
private Scope mScope = Scope.PRIVATE;
|
||||
/** compiled regexp to match author tag **/
|
||||
private RE mAuthorTagRE = null;
|
||||
private RE mAuthorTagRE;
|
||||
/** compiled regexp to match author tag content **/
|
||||
private RE mAuthorFormatRE = null;
|
||||
private RE mAuthorFormatRE;
|
||||
/** compiled regexp to match version tag **/
|
||||
private RE mVersionTagRE = null;
|
||||
private RE mVersionTagRE;
|
||||
/** compiled regexp to match version tag content **/
|
||||
private RE mVersionFormatRE = null;
|
||||
private RE mVersionFormatRE;
|
||||
/** regexp to match author tag content */
|
||||
private String mAuthorFormat;
|
||||
/** regexp to match version tag content */
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public abstract class AbstractUsageCheck
|
|||
extends Check
|
||||
{
|
||||
/** the regexp to match against */
|
||||
private RE mRegexp = null;
|
||||
private RE mRegexp;
|
||||
/** the format string of the regexp */
|
||||
private String mIgnoreFormat;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class NoWhitespaceBeforeCheck
|
|||
extends Check
|
||||
{
|
||||
/** Whether whitespace is allowed if the AST is at a linebreak */
|
||||
private boolean mAllowLineBreaks = false;
|
||||
private boolean mAllowLineBreaks;
|
||||
|
||||
/** @see com.puppycrawl.tools.checkstyle.api.Check */
|
||||
public int[] getDefaultTokens()
|
||||
|
|
|
|||
|
|
@ -55,16 +55,16 @@ public class SuppressElement
|
|||
private String mCheckPattern;
|
||||
|
||||
/** line number filter */
|
||||
private CSVFilter mLineFilter = null;
|
||||
private CSVFilter mLineFilter;
|
||||
|
||||
/** CSV for line number filter */
|
||||
private String mLinesCSV = null;
|
||||
private String mLinesCSV;
|
||||
|
||||
/** column number filter */
|
||||
private CSVFilter mColumnFilter = null;
|
||||
private CSVFilter mColumnFilter;
|
||||
|
||||
/** CSV for column number filter */
|
||||
private String mColumnsCSV = null;
|
||||
private String mColumnsCSV;
|
||||
|
||||
/**
|
||||
* Constructs a <code>SuppressElement</code> for a
|
||||
|
|
|
|||
|
|
@ -290,9 +290,9 @@ field!
|
|||
| v:variableDefinitions[#mods,#t] s6:SEMI
|
||||
// {#field = #(#[VARIABLE_DEF,"VARIABLE_DEF"], v);}
|
||||
{
|
||||
#field = #v;
|
||||
#v.addChild(#s6);
|
||||
}
|
||||
#field = #v;
|
||||
#v.addChild(#s6);
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue