diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java index b8352c477..ac3694a29 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java @@ -308,12 +308,12 @@ public class CheckStyleTask extends Task // Process the files long startTime = System.currentTimeMillis(); - final File[] files = scanFileSets(); + final List files = scanFileSets(); long endTime = System.currentTimeMillis(); log("To locate the files took " + (endTime - startTime) + " ms.", Project.MSG_VERBOSE); - log("Running Checkstyle " + version + " on " + files.length + log("Running Checkstyle " + version + " on " + files.size() + " files", Project.MSG_INFO); log("Using configuration " + mConfigLocation, Project.MSG_VERBOSE); @@ -478,7 +478,7 @@ public class CheckStyleTask extends Task * returns the list of files (full path name) to process. * @return the list of files included via the filesets. */ - protected File[] scanFileSets() + protected List scanFileSets() { final List list = new ArrayList(); if (mFileName != null) { @@ -503,7 +503,7 @@ public class CheckStyleTask extends Task } } - return list.toArray(new File[0]); + return list; } /** diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/Checker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/Checker.java index 3e293ab95..5ee893964 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/Checker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/Checker.java @@ -232,7 +232,7 @@ public class Checker extends AutomaticBean * @return the total number of errors found * @see #destroy() */ - public int process(File[] aFiles) + public int process(List aFiles) { fireAuditStarted(); for (FileSetCheck fsc : mFileSetChecks) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/Main.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/Main.java index 49bc12383..d8534ee9d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/Main.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/Main.java @@ -118,10 +118,7 @@ public final class Main final AuditListener listener = createListener(line, out, closeOut); final List files = getFilesToProcess(line); final Checker c = createChecker(config, moduleFactory, listener); - - final File[] processedFiles = new File[files.size()]; - files.toArray(processedFiles); - final int numErrs = c.process(processedFiles); + final int numErrs = c.process(files); c.destroy(); System.exit(numErrs); } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/StringArrayReader.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/StringArrayReader.java index 55f8d32a0..15bf0ae4e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/StringArrayReader.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/StringArrayReader.java @@ -71,6 +71,7 @@ final class StringArrayReader extends Reader } /** @see Reader */ + @Override public void close() { mClosed = true; @@ -83,6 +84,7 @@ final class StringArrayReader extends Reader } /** {@inheritDoc} */ + @Override public int read(char[] aCbuf, int aOff, int aLen) throws IOException { ensureOpen(); @@ -120,6 +122,7 @@ final class StringArrayReader extends Reader } /** {@inheritDoc} */ + @Override public int read() throws IOException { if (mUnreportedNewline) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/TreeWalker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/TreeWalker.java index b4e89781b..7d2c1360d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/TreeWalker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/TreeWalker.java @@ -575,9 +575,9 @@ public final class TreeWalker } /** {@inheritDoc} */ - public void process(File[] aFiles) + public void process(List aFiles) { - final File[] javaFiles = filter(aFiles); + final List javaFiles = filter(aFiles); for (File element : javaFiles) { process(element); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java index 64e5aba22..56d5c540c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java @@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.api; import java.io.File; import java.io.UnsupportedEncodingException; +import java.util.List; /** * Provides common functionality for many FileSetChecks. @@ -105,7 +106,7 @@ public abstract class AbstractFileSetCheck * @return the subset of aFiles that this FileSetCheck should process * @see FileSetCheck#process */ - protected final File[] filter(File[] aFiles) + protected final List filter(List aFiles) { return Utils.filterFilesByExtension(aFiles, mFileExtensions); } @@ -152,6 +153,7 @@ public abstract class AbstractFileSetCheck * {@link #getMessageCollector message collector}. * {@inheritDoc} */ + @Override protected final void log(int aLine, String aKey, Object aArgs[]) { log(aLine, 0, aKey, aArgs); @@ -162,6 +164,7 @@ public abstract class AbstractFileSetCheck * {@link #getMessageCollector message collector}. * {@inheritDoc} */ + @Override protected final void log(int aLineNo, int aColNo, String aKey, Object[] aArgs) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java index e73b54c8c..03caf5505 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/DetailAST.java @@ -60,6 +60,7 @@ public final class DetailAST extends CommonAST private BitSet mBranchTokenTypes; /** {@inheritDoc} */ + @Override public void initialize(Token aTok) { super.initialize(aTok); @@ -68,6 +69,7 @@ public final class DetailAST extends CommonAST } /** {@inheritDoc} */ + @Override public void initialize(AST aAST) { final DetailAST da = (DetailAST) aAST; @@ -81,6 +83,7 @@ public final class DetailAST extends CommonAST * Sets this AST's first Child. * @param aAST the new first child */ + @Override public void setFirstChild(AST aAST) { mChildCount = NOT_INITIALIZED; @@ -94,6 +97,7 @@ public final class DetailAST extends CommonAST * Sets AST's next sibling. * @param aAST the new next sibling */ + @Override public void setNextSibling(AST aAST) { super.setNextSibling(aAST); @@ -118,6 +122,7 @@ public final class DetailAST extends CommonAST * Adds new child to AST. * @param aAST the new child */ + @Override public void addChild(AST aAST) { super.addChild(aAST); @@ -298,6 +303,7 @@ public final class DetailAST extends CommonAST } /** {@inheritDoc} */ + @Override public String toString() { return super.toString() + "[" + getLineNo() + "x" + getColumnNo() + "]"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java index 6fff0afc9..5b3f48046 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java @@ -19,6 +19,7 @@ package com.puppycrawl.tools.checkstyle.api; import java.io.File; +import java.util.List; /** * Interface for Checking a set of files for some criteria. @@ -49,7 +50,7 @@ public interface FileSetCheck * @param aFiles the files to be audited. * @see #destroy() */ - void process(File[] aFiles); + void process(List aFiles); /** Cleans up the object. **/ void destroy(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java index ebef29a05..246de37b8 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java @@ -143,6 +143,7 @@ public final class FullIdent } /** {@inheritDoc} */ + @Override public String toString() { return getText() + "[" + getLineNo() + "x" + getColumnNo() + "]"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Utils.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Utils.java index f62148319..908695387 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Utils.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Utils.java @@ -281,8 +281,8 @@ public final class Utils * @return aFiles if aFileExtensions is null or empty, * the subset of aFiles that have extensions in aFileExtensions otherwise */ - public static File[] filterFilesByExtension( - File[] aFiles, String[] aFileExtensions) + public static List filterFilesByExtension( + List aFiles, String[] aFileExtensions) { if ((aFileExtensions == null) || (aFileExtensions.length == 0)) { return aFiles; @@ -300,7 +300,7 @@ public final class Utils } } - final List files = new ArrayList(aFiles.length); + final List files = new ArrayList(aFiles.size()); for (final File f : aFiles) { final String fileName = f.getName(); for (final String fileExtension : withDotExtensions) { @@ -309,7 +309,7 @@ public final class Utils } } } - return files.toArray(new File[files.size()]); + return files; } } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java index 98bd1fc10..313d81842 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java @@ -36,12 +36,14 @@ public class ArrayTypeStyleCheck extends Check private boolean mJavaStyle = true; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.ARRAY_DECLARATOR}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST typeAST = aAST.getParent(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java index df657e61b..43e68a4f9 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java @@ -36,6 +36,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; public class FinalParametersCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -45,6 +46,7 @@ public class FinalParametersCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return new int[] { @@ -56,6 +58,7 @@ public class FinalParametersCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // don't flag interfaces diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java index 4af20b8f4..0a6b51984 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java @@ -110,12 +110,14 @@ public class GenericIllegalRegexpCheck extends AbstractFormatCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[0]; } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { final String[] lines = getLines(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java index 42cf0ddd7..ed6f1710a 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; +import java.util.List; import com.puppycrawl.tools.checkstyle.Defn; import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; @@ -69,9 +70,9 @@ public class NewlineAtEndOfFileCheck /** * {@inheritDoc} */ - public void process(File[] aFiles) + public void process(List aFiles) { - final File[] files = filter(aFiles); + final List files = filter(aFiles); final MessageDispatcher dispatcher = getMessageDispatcher(); for (final File file : files) { final String path = file.getPath(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RequiredRegexpCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RequiredRegexpCheck.java index aeb8ce958..31399f838 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RequiredRegexpCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RequiredRegexpCheck.java @@ -49,12 +49,14 @@ public class RequiredRegexpCheck extends AbstractFormatCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[0]; } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { final Pattern pattern = getRegexp(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java index debcd852b..64126051e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java @@ -31,6 +31,7 @@ import java.io.InputStream; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -90,7 +91,7 @@ public class TranslationCheck * @return a Map object which holds the arranged property file sets */ private static Map> arrangePropertyFiles( - File[] aPropFiles) + List aPropFiles) { final Map> propFileMap = new HashMap>(); @@ -254,9 +255,9 @@ public class TranslationCheck * @param aFiles {@inheritDoc} * @see com.puppycrawl.tools.checkstyle.api.FileSetCheck */ - public void process(File[] aFiles) + public void process(List aFiles) { - final File[] propertyFiles = filter(aFiles); + final List propertyFiles = filter(aFiles); final Map> propFilesMap = arrangePropertyFiles(propertyFiles); checkPropertyFileSets(propFilesMap); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java index 92e77a2cc..87e402c80 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java @@ -76,6 +76,7 @@ public class UncommentedMainCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -86,12 +87,14 @@ public class UncommentedMainCheck } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { mPackage = FullIdent.createFullIdent(null); @@ -100,6 +103,7 @@ public class UncommentedMainCheck } /** {@inheritDoc} */ + @Override public void leaveToken(DetailAST aAst) { if (aAst.getType() == TokenTypes.CLASS_DEF) { @@ -111,6 +115,7 @@ public class UncommentedMainCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAst) { switch (aAst.getType()) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java index 025ffb951..249debc06 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java @@ -49,12 +49,14 @@ import com.puppycrawl.tools.checkstyle.api.Check; public class UpperEllCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.NUM_LONG}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (aAST.getText().endsWith("l")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AbstractNestedDepthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AbstractNestedDepthCheck.java index 645f49178..e6c28b8d3 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AbstractNestedDepthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AbstractNestedDepthCheck.java @@ -43,12 +43,14 @@ public abstract class AbstractNestedDepthCheck extends Check } /** {@inheritDoc} */ + @Override public final int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { mDepth = 0; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java index 9fcd51b00..3d53c16a1 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java @@ -41,12 +41,14 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; public class ArrayTrailingCommaCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.ARRAY_INIT}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aArrayInit) { final DetailAST rcurly = aArrayInit.findFirstToken(TokenTypes.RCURLY); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java index 2b7de6f24..d3ed03679 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java @@ -40,18 +40,21 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; public class AvoidInlineConditionalsCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.QUESTION}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // the only place a QUESTION token can occur is in inline conditionals diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java index 0ce761f22..245f1bf60 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java @@ -49,6 +49,7 @@ public class DefaultComesLastCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -57,12 +58,14 @@ public class DefaultComesLastCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST defaultGroupAST = aAST.getParent(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheck.java index 6e089961d..3e900f72c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheck.java @@ -38,12 +38,14 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; public class DoubleCheckedLockingCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.LITERAL_IF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST synchronizedAST = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java index 03880f78d..a303fbd67 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java @@ -46,12 +46,14 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; public class EmptyStatementCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.EMPTY_STAT}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { log(aAST.getLineNo(), aAST.getColumnNo(), "empty.statement"); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java index 0357de7e9..364eb2b19 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java @@ -51,18 +51,21 @@ import com.puppycrawl.tools.checkstyle.checks.CheckUtils; public class ExplicitInitializationCheck extends Check { /** {@inheritDoc} */ + @Override public final int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } /** {@inheritDoc} */ + @Override public final int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // do not check local variables and diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java index 66e4a385b..46e2d1a45 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java @@ -81,12 +81,14 @@ public class FallThroughCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.CASE_GROUP}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); @@ -113,6 +115,7 @@ public class FallThroughCheck extends Check } /** {@inheritDoc} */ + @Override public void init() { super.init(); @@ -120,6 +123,7 @@ public class FallThroughCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST nextGroup = (DetailAST) aAST.getNextSibling(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java index 26316cf6b..9a03add2e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java @@ -43,18 +43,21 @@ public final class IllegalCatchCheck extends AbstractIllegalCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_CATCH}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aDetailAST) { final DetailAST paramDef = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java index 7010183ca..cf7a33e79 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java @@ -41,18 +41,21 @@ public final class IllegalThrowsCheck extends AbstractIllegalCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_THROWS}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aDetailAST) { DetailAST token = (DetailAST) aDetailAST.getFirstChild(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java index 087e5a19b..0a344a817 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java @@ -93,6 +93,7 @@ public class InnerAssignmentCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -112,6 +113,7 @@ public class InnerAssignmentCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (isInContext(aAST, ALLOWED_ASSIGMENT_CONTEXT)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheck.java index eb10444e6..35af5d9eb 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheck.java @@ -45,18 +45,21 @@ public final class JUnitTestCaseCheck extends Check private static final String SUITE_METHOD_NAME = "suite"; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.METHOD_DEF}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { switch (aAST.getType()) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java index 69b500f3d..900a137a5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java @@ -70,6 +70,7 @@ public class MagicNumberCheck extends Check private double[] mIgnoreNumbers = {-1, 0, 1, 2}; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -81,6 +82,7 @@ public class MagicNumberCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (inIgnoreList(aAST)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java index ca76e915e..709f470fd 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java @@ -51,18 +51,21 @@ public class MissingCtorCheck extends DescendantTokenCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.CLASS_DEF}; } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java index 7750e2d52..f8d31b1ea 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java @@ -56,12 +56,14 @@ public class MissingSwitchDefaultCheck extends DescendantTokenCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.LITERAL_SWITCH}; } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return getDefaultTokens(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java index c0fa9c891..6963f8f94 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java @@ -51,12 +51,14 @@ public class MultipleVariableDeclarationsCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { DetailAST nextNode = (DetailAST) aAST.getNextSibling(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java index 746d87a8a..245401ac9 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java @@ -39,12 +39,14 @@ public final class NestedIfDepthCheck extends AbstractNestedDepthCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_IF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { switch (aAST.getType()) { @@ -57,6 +59,7 @@ public final class NestedIfDepthCheck extends AbstractNestedDepthCheck } /** {@inheritDoc} */ + @Override public void leaveToken(DetailAST aAST) { switch (aAST.getType()) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java index 87b6ce91d..ed186f245 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java @@ -37,12 +37,14 @@ public final class NestedTryDepthCheck extends AbstractNestedDepthCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_TRY}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { switch (aAST.getType()) { @@ -55,6 +57,7 @@ public final class NestedTryDepthCheck extends AbstractNestedDepthCheck } /** {@inheritDoc} */ + @Override public void leaveToken(DetailAST aAST) { switch (aAST.getType()) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java index ec26713a8..e22e3ff3f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java @@ -35,24 +35,28 @@ public final class PackageDeclarationCheck extends Check private boolean mDefined; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.PACKAGE_DEF}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aAST) { mDefined = false; } /** {@inheritDoc} */ + @Override public void finishTree(DetailAST aAST) { if (!mDefined) { @@ -61,6 +65,7 @@ public final class PackageDeclarationCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { mDefined = true; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java index 0e612312d..2219081a0 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java @@ -98,6 +98,7 @@ public class RequireThisCheck extends DeclarationCollector } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -114,12 +115,14 @@ public class RequireThisCheck extends DeclarationCollector } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { super.visitToken(aAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java index 1ba2499bd..5b3636e7e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java @@ -43,6 +43,7 @@ public class SimplifyBooleanExpressionCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_TRUE, TokenTypes.LITERAL_FALSE}; @@ -53,18 +54,21 @@ public class SimplifyBooleanExpressionCheck * @see com.puppycrawl.tools.checkstyle.api.Check * @return an empty array. */ + @Override public int[] getAcceptableTokens() { return new int[] {}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return new int[] {TokenTypes.LITERAL_TRUE, TokenTypes.LITERAL_FALSE}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST parent = aAST.getParent(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java index 7c329a847..c44fe4c6b 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java @@ -42,12 +42,14 @@ public class SimplifyBooleanReturnCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_IF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // LITERAL_IF has the following four or five children: diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java index dfaa17230..821d96bd5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java @@ -38,12 +38,14 @@ import antlr.collections.AST; public class StringLiteralEqualityCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.EQUAL, TokenTypes.NOT_EQUAL}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // no need to check for nulls here, == and != always have two children diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java index 34f5d8cbe..910181f3b 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java @@ -43,6 +43,7 @@ public class SuperCloneCheck extends AbstractSuperCheck /** * {@inheritDoc} */ + @Override protected String getMethodName() { return "clone"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java index 3a115f92d..aa12357e7 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java @@ -43,6 +43,7 @@ public class SuperFinalizeCheck extends AbstractSuperCheck /** * {@inheritDoc} */ + @Override protected String getMethodName() { return "finalize"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java index 0f327954e..5a439184c 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java @@ -95,6 +95,7 @@ public class UnnecessaryParenthesesCheck extends Check private int mAssignDepth; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int [] { @@ -124,6 +125,7 @@ public class UnnecessaryParenthesesCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final int type = aAST.getType(); @@ -168,6 +170,7 @@ public class UnnecessaryParenthesesCheck extends Check } /** {@inheritDoc} */ + @Override public void leaveToken(DetailAST aAST) { final int type = aAST.getType(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java index 40ddfa786..802bed45c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java @@ -59,12 +59,14 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; public class DesignForExtensionCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.METHOD_DEF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // nothing to do for Interfaces diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java index fb313777a..43c6b87f9 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java @@ -36,12 +36,14 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; public class HideUtilityClassConstructorCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.CLASS_DEF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST objBlock = aAST.findFirstToken(TokenTypes.OBJBLOCK); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java index 2a7ea6ca6..9ee71294c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java @@ -48,18 +48,21 @@ public final class InterfaceIsTypeCheck private boolean mAllowMarkerInterfaces = true; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.INTERFACE_DEF}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST objBlock = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java index e891c42f6..e021d5891 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java @@ -55,6 +55,7 @@ public final class ThrowsCountCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -63,6 +64,7 @@ public final class ThrowsCountCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); @@ -87,6 +89,7 @@ public final class ThrowsCountCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { switch (aAST.getType()) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheck.java index 79f79217b..0362ed295 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheck.java @@ -24,6 +24,7 @@ import com.puppycrawl.tools.checkstyle.api.Utils; import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.List; import java.util.Map; import org.apache.commons.collections.MultiHashMap; import org.apache.commons.collections.MultiMap; @@ -183,7 +184,7 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck private ChecksumInfo[] mChecksumInfo; /** files that are currently checked */ - private File[] mFiles; + private List mFiles; /** * A SoftReference cache for the trimmed lines of a file path, @@ -224,20 +225,20 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck /** * {@inheritDoc} */ - public synchronized void process(File[] aFiles) + public synchronized void process(List aFiles) { final long start = System.currentTimeMillis(); mDuplicates = 0; mFiles = filter(aFiles); - mLineBlockChecksums = new int[mFiles.length][]; - mChecksumInfo = new ChecksumInfo[mFiles.length]; + mLineBlockChecksums = new int[mFiles.size()][]; + mChecksumInfo = new ChecksumInfo[mFiles.size()]; if (LOG.isDebugEnabled()) { - LOG.debug("Reading " + mFiles.length + " input files"); + LOG.debug("Reading " + mFiles.size() + " input files"); } - for (int i = 0; i < mFiles.length; i++) { - final File file = mFiles[i]; + for (int i = 0; i < mFiles.size(); i++) { + final File file = mFiles.get(i); try { final String[] lines = getTrimmedLines(file); final ChecksumGenerator transformer = @@ -291,7 +292,7 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck if (LOG.isDebugEnabled()) { final long initTime = aEndReading - aStart; final long workTime = aEndSearching - aEndReading; - LOG.debug("files = " + mFiles.length); + LOG.debug("files = " + mFiles.size()); LOG.debug("duplicates = " + mDuplicates); LOG.debug("Runtime = " + initTime + " + " + workTime); } @@ -330,10 +331,10 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck // It may be possible to do this *much* smarter, // but I don't have the Knuth bible at hand right now :-) - final int len = mFiles.length; + final int len = mFiles.size(); for (int i = 0; i < len; i++) { - final String path = mFiles[i].getPath(); + final String path = mFiles.get(i).getPath(); getMessageCollector().reset(); final MessageDispatcher dispatcher = getMessageDispatcher(); dispatcher.fireFileStarted(path); @@ -431,7 +432,7 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck int duplicateLines = verifiyDuplicateLines(aI, aJ, aILine, jLine); if (duplicateLines >= mMin) { - reportDuplicate(duplicateLines, aILine, mFiles[aJ], jLine); + reportDuplicate(duplicateLines, aILine, mFiles.get(aJ), jLine); int extend = duplicateLines - mMin; for (int i = 0; i < extend; i++) { final int offset = (i + 1); @@ -456,8 +457,8 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck private int verifiyDuplicateLines( int aI, int aJ, int aIStartLine, int aJStartLine) { - final File iFile = mFiles[aI]; - final File jFile = mFiles[aJ]; + final File iFile = mFiles.get(aI); + final File jFile = mFiles.get(aJ); try { final String[] iLines = getTrimmedLines(iFile); final String[] jLines = getTrimmedLines(jFile); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java index 9e37bb99e..c014f9c18 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java @@ -88,6 +88,7 @@ public abstract class AbstractHeaderCheck extends Check * @throws CheckstyleException {@inheritDoc} * @see com.puppycrawl.tools.checkstyle.api.AutomaticBean#finishLocalSetup */ + @Override protected final void finishLocalSetup() throws CheckstyleException { if (mHeaderInfo.getHeaderLines() == null) { @@ -98,6 +99,7 @@ public abstract class AbstractHeaderCheck extends Check } /** {@inheritDoc} */ + @Override public final int[] getDefaultTokens() { return new int[0]; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/CrossLanguageRegexpHeaderCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/CrossLanguageRegexpHeaderCheck.java index 78f50155e..ac38b9051 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/CrossLanguageRegexpHeaderCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/CrossLanguageRegexpHeaderCheck.java @@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.header; import java.io.File; import java.io.IOException; +import java.util.List; import org.apache.commons.beanutils.ConversionException; @@ -64,7 +65,7 @@ public final class CrossLanguageRegexpHeaderCheck extends AbstractFileSetCheck } /** information about the expected header file. */ - private RegexpHeaderInfo mHeaderInfo = new RegexpHeaderInfo(); + private final RegexpHeaderInfo mHeaderInfo = new RegexpHeaderInfo(); /** * Creates a new instance and initializes the file extentions @@ -117,6 +118,7 @@ public final class CrossLanguageRegexpHeaderCheck extends AbstractFileSetCheck * @throws CheckstyleException {@inheritDoc} * @see com.puppycrawl.tools.checkstyle.api.AutomaticBean#finishLocalSetup */ + @Override protected void finishLocalSetup() throws CheckstyleException { if (mHeaderInfo.getHeaderLines() == null) { @@ -127,14 +129,14 @@ public final class CrossLanguageRegexpHeaderCheck extends AbstractFileSetCheck } /** {@inheritDoc} */ - public void process(File[] aFiles) + public void process(List aFiles) { final MessageDispatcher msgDispatcher = getMessageDispatcher(); final RegexpHeaderChecker regexpHeaderChecker = new RegexpHeaderChecker( mHeaderInfo, new FileSetCheckViolationMonitor()); - File[] files = filter(aFiles); + List files = filter(aFiles); for (final File file : files) { final String path = file.getPath(); msgDispatcher.fireFileStarted(path); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java index d6237eb48..d289b1bfb 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java @@ -75,6 +75,7 @@ public class HeaderCheck extends AbstractHeaderCheck } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { if (getHeaderLines().length > getLines().length) { @@ -91,6 +92,7 @@ public class HeaderCheck extends AbstractHeaderCheck } /** {@inheritDoc} */ + @Override protected HeaderInfo createHeaderInfo() { return new HeaderInfo(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java index beca8f3dd..cfac60a0b 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java @@ -81,6 +81,7 @@ public class RegexpHeaderCheck extends AbstractHeaderCheck /** * @see com.puppycrawl.tools.checkstyle.api.Check#init() */ + @Override public void init() { super.init(); @@ -89,6 +90,7 @@ public class RegexpHeaderCheck extends AbstractHeaderCheck } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { final String[] lines = getLines(); @@ -96,6 +98,7 @@ public class RegexpHeaderCheck extends AbstractHeaderCheck } /** {@inheritDoc} */ + @Override protected HeaderInfo createHeaderInfo() { return new RegexpHeaderInfo(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderInfo.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderInfo.java index 280c0feba..10c9d5c1d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderInfo.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderInfo.java @@ -85,6 +85,7 @@ final class RegexpHeaderInfo extends HeaderInfo * Initializes {@link #mHeaderRegexps} from * {@link HeaderInfo#getHeaderLines()}. */ + @Override protected void postprocessHeaderLines() { final String[] headerLines = getHeaderLines(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java index 57b111957..6f6db5f77 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java @@ -58,6 +58,7 @@ public class AvoidStarImportCheck private String[] mExcludes = new String[0]; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.IMPORT}; @@ -81,6 +82,7 @@ public class AvoidStarImportCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final FullIdent name = FullIdent.createFullIdentBelow(aAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java index a633b9eba..abde4af8e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java @@ -82,12 +82,14 @@ public class IllegalImportCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final FullIdent imp; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java index 02060dd2d..df9a72394 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java @@ -53,6 +53,7 @@ public class ImportControlCheck extends Check private PkgControl mCurrentLeaf; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.PACKAGE_DEF, TokenTypes.IMPORT, @@ -60,12 +61,14 @@ public class ImportControlCheck extends Check } /** {@inheritDoc} */ + @Override public void beginTree(final DetailAST aRootAST) { mCurrentLeaf = null; } /** {@inheritDoc} */ + @Override public void visitToken(final DetailAST aAST) { if (aAST.getType() == TokenTypes.PACKAGE_DEF) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java index 9084cc80d..e145cc14f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java @@ -145,12 +145,14 @@ public class ImportOrderCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); @@ -176,6 +178,7 @@ public class ImportOrderCheck extends Check } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { mLastGroup = Integer.MIN_VALUE; @@ -186,6 +189,7 @@ public class ImportOrderCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final FullIdent ident; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java index db4fa10a5..aa4334985 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java @@ -47,6 +47,7 @@ public class ArrayInitHandler extends BlockParentHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { final DetailAST parentAST = getMainAst().getParent(); @@ -68,6 +69,7 @@ public class ArrayInitHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getToplevelAST() { return null; @@ -78,6 +80,7 @@ public class ArrayInitHandler extends BlockParentHandler * * @return the left curly brace expression */ + @Override protected DetailAST getLCurly() { return getMainAst(); @@ -88,6 +91,7 @@ public class ArrayInitHandler extends BlockParentHandler * * @return the right curly brace expression */ + @Override protected DetailAST getRCurly() { return getMainAst().findFirstToken(TokenTypes.RCURLY); @@ -98,6 +102,7 @@ public class ArrayInitHandler extends BlockParentHandler * * @return false */ + @Override protected boolean rcurlyMustStart() { return false; @@ -108,6 +113,7 @@ public class ArrayInitHandler extends BlockParentHandler * * @return true */ + @Override protected boolean childrenMayNest() { return true; @@ -118,12 +124,14 @@ public class ArrayInitHandler extends BlockParentHandler * * @return the statement list child */ + @Override protected DetailAST getListChild() { return getMainAst(); } /** {@inheritDoc} */ + @Override protected IndentLevel getChildrenExpectedLevel() { // now we accept diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/AssignHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/AssignHandler.java index e34e062f4..be2c84252 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/AssignHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/AssignHandler.java @@ -45,6 +45,7 @@ public class AssignHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { final IndentLevel expectedLevel = getChildrenExpectedLevel(); @@ -80,12 +81,14 @@ public class AssignHandler extends BlockParentHandler * fisrt line in checkLinesIndent() * false otherwise */ + @Override protected boolean shouldIncreaseIndent() { return false; } /** {@inheritDoc} */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { final DetailAST assign = getMainAst(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java index c0c8f6e3a..d6af0194d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java @@ -281,6 +281,7 @@ public class BlockParentHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkToplevelToken(); @@ -331,6 +332,7 @@ public class BlockParentHandler extends ExpressionHandler } /** {@inheritDoc} */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { return getChildrenExpectedLevel(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java index 390e87f11..d5f4315d9 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java @@ -55,6 +55,7 @@ public class CaseHandler extends ExpressionHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { return new IndentLevel(getParent().getLevel(), @@ -78,6 +79,7 @@ public class CaseHandler extends ExpressionHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { return getLevel(); @@ -86,6 +88,7 @@ public class CaseHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkCase(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java index d852f93e8..f2a42cdc4 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java @@ -47,6 +47,7 @@ public class CatchHandler extends BlockParentHandler * * @return false */ + @Override protected boolean toplevelMustStartLine() { return false; @@ -65,6 +66,7 @@ public class CatchHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { super.checkIndentation(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java index b3095d505..1e3f1a1b4 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java @@ -52,6 +52,7 @@ public class ClassDefHandler extends BlockParentHandler * * @return the left curly brace expression */ + @Override protected DetailAST getLCurly() { return getMainAst().findFirstToken(TokenTypes.OBJBLOCK) @@ -63,6 +64,7 @@ public class ClassDefHandler extends BlockParentHandler * * @return the right curly brace expression */ + @Override protected DetailAST getRCurly() { return getMainAst().findFirstToken(TokenTypes.OBJBLOCK) @@ -74,6 +76,7 @@ public class ClassDefHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getToplevelAST() { return null; @@ -85,6 +88,7 @@ public class ClassDefHandler extends BlockParentHandler * * @return the statement list child */ + @Override protected DetailAST getListChild() { return getMainAst().findFirstToken(TokenTypes.OBJBLOCK); @@ -93,6 +97,7 @@ public class ClassDefHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { // TODO: still need to better deal with the modifiers and "class" @@ -129,6 +134,7 @@ public class ClassDefHandler extends BlockParentHandler } /** {@inheritDoc} */ + @Override protected int[] getCheckedChildren() { return new int[] { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java index 7e163eb59..04f7470a4 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java @@ -55,6 +55,7 @@ public class DoWhileHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { super.checkIndentation(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java index e7d548520..edef2c945 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java @@ -45,6 +45,7 @@ public class ElseHandler extends BlockParentHandler /** * Check the indent of the top level token. */ + @Override protected void checkToplevelToken() { // check if else is nested with rcurly of if: @@ -72,6 +73,7 @@ public class ElseHandler extends BlockParentHandler * * @return the non-list child element */ + @Override protected DetailAST getNonlistChild() { return (DetailAST) getMainAst().getFirstChild(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java index d45194c3a..87c7bd7d9 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java @@ -46,6 +46,7 @@ public class FinallyHandler extends BlockParentHandler * * @return false */ + @Override protected boolean toplevelMustStartLine() { return false; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java index cc6b3831c..9131e7501 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java @@ -73,6 +73,7 @@ public class ForHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkForParams(); @@ -88,6 +89,7 @@ public class ForHandler extends BlockParentHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { if (aChild instanceof ElseHandler) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java index 5f5afd0a5..54a00f8c6 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java @@ -51,6 +51,7 @@ public class IfHandler extends BlockParentHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { if (aChild instanceof ElseHandler) { @@ -64,6 +65,7 @@ public class IfHandler extends BlockParentHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { if (isIfAfterElse()) { @@ -89,6 +91,7 @@ public class IfHandler extends BlockParentHandler /** * Check the indentation of the top level token. */ + @Override protected void checkToplevelToken() { if (isIfAfterElse()) { @@ -113,6 +116,7 @@ public class IfHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { super.checkIndentation(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java index 0337e54a0..df331512c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java @@ -45,6 +45,7 @@ public class ImportHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { final int lineStart = getMainAst().getLineNo(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java index e28de04f7..ab948e393 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java @@ -222,6 +222,7 @@ public class IndentationCheck extends Check * * @return the array of tokens that this check handles */ + @Override public int[] getDefaultTokens() { return mHandlerFactory.getHandledTypes(); @@ -230,6 +231,7 @@ public class IndentationCheck extends Check /** * {@inheritDoc} */ + @Override public void beginTree(DetailAST aAst) { mHandlerFactory.clearCreatedHandlers(); @@ -240,6 +242,7 @@ public class IndentationCheck extends Check /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if ((aAST.getType() == TokenTypes.VARIABLE_DEF) @@ -263,6 +266,7 @@ public class IndentationCheck extends Check /** * {@inheritDoc} */ + @Override public void leaveToken(DetailAST aAST) { if ((aAST.getType() == TokenTypes.VARIABLE_DEF) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java index 9671ef116..394fc0715 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java @@ -54,6 +54,7 @@ public class LabelHandler extends ExpressionHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { return new IndentLevel(super.getLevelImpl(), -getBasicOffset()); @@ -70,6 +71,7 @@ public class LabelHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkLabel(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java index 93f22fe27..04a99ffc0 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java @@ -70,6 +70,7 @@ public class MemberDefHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkModifiers(); @@ -78,6 +79,7 @@ public class MemberDefHandler extends ExpressionHandler } /** {@inheritDoc} */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { return getLevel(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java index f596ccf17..4079fa6f5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java @@ -51,6 +51,7 @@ public class MethodCallHandler extends ExpressionHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { // if inside a method call's params, this could be part of @@ -141,6 +142,7 @@ public class MethodCallHandler extends ExpressionHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { // for whatever reason a method that crosses lines, like asList @@ -162,6 +164,7 @@ public class MethodCallHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { final DetailAST methodName = (DetailAST) getMainAst().getFirstChild(); @@ -198,6 +201,7 @@ public class MethodCallHandler extends ExpressionHandler * fisrt line in checkLinesIndent() * false otherwise */ + @Override protected boolean shouldIncreaseIndent() { return false; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java index 805487b19..3a4ef33e3 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java @@ -48,6 +48,7 @@ public class MethodDefHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getToplevelAST() { // we check this stuff ourselves below @@ -114,6 +115,7 @@ public class MethodDefHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkModifiers(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java index 51e18334f..aef5fb94b 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java @@ -44,6 +44,7 @@ public class NewHandler extends ExpressionHandler } /** {@inheritDoc} */ + @Override public void checkIndentation() { final DetailAST type = (DetailAST) getMainAst().getFirstChild(); @@ -78,6 +79,7 @@ public class NewHandler extends ExpressionHandler } /** {@inheritDoc} */ + @Override protected IndentLevel getLevelImpl() { // if our expression isn't first on the line, just use the start @@ -89,6 +91,7 @@ public class NewHandler extends ExpressionHandler } /** {@inheritDoc} */ + @Override protected boolean shouldIncreaseIndent() { return false; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java index 7529fc117..43b31cdb4 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java @@ -47,6 +47,7 @@ public class ObjectBlockHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getToplevelAST() { return null; @@ -57,6 +58,7 @@ public class ObjectBlockHandler extends BlockParentHandler * * @return the left curly brace expression */ + @Override protected DetailAST getLCurly() { return getMainAst().findFirstToken(TokenTypes.LCURLY); @@ -67,6 +69,7 @@ public class ObjectBlockHandler extends BlockParentHandler * * @return the right curly brace expression */ + @Override protected DetailAST getRCurly() { return getMainAst().findFirstToken(TokenTypes.RCURLY); @@ -77,6 +80,7 @@ public class ObjectBlockHandler extends BlockParentHandler * * @return the statement list child */ + @Override protected DetailAST getListChild() { return getMainAst(); @@ -87,6 +91,7 @@ public class ObjectBlockHandler extends BlockParentHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { final DetailAST parentAST = getMainAst().getParent(); @@ -103,6 +108,7 @@ public class ObjectBlockHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { // if we have a class or interface as a parent, don't do anything, diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java index 5c8f121ff..c371c7a83 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java @@ -45,6 +45,7 @@ public class PackageDefHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { final int columnNo = expandedTabsColumnNo(getMainAst()); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java index 00c6f4b8f..c07245065 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java @@ -38,6 +38,7 @@ public class PrimordialHandler extends ExpressionHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { // nothing to check @@ -52,6 +53,7 @@ public class PrimordialHandler extends ExpressionHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { return new IndentLevel(0); @@ -62,6 +64,7 @@ public class PrimordialHandler extends ExpressionHandler * * @return the expected indentation amount */ + @Override protected IndentLevel getLevelImpl() { return new IndentLevel(0); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java index 9dbf7ee6b..32488476d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java @@ -51,6 +51,7 @@ public class SlistHandler extends BlockParentHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { // this is: @@ -78,6 +79,7 @@ public class SlistHandler extends BlockParentHandler * * @return the non-list child element */ + @Override protected DetailAST getNonlistChild() { // blocks always have either block children or they are transparent @@ -92,6 +94,7 @@ public class SlistHandler extends BlockParentHandler * * @return the statement list child */ + @Override protected DetailAST getListChild() { return getMainAst(); @@ -102,6 +105,7 @@ public class SlistHandler extends BlockParentHandler * * @return the left curly brace expression */ + @Override protected DetailAST getLCurly() { return getMainAst(); @@ -112,6 +116,7 @@ public class SlistHandler extends BlockParentHandler * * @return the right curly brace expression */ + @Override protected DetailAST getRCurly() { return getMainAst().findFirstToken(TokenTypes.RCURLY); @@ -122,6 +127,7 @@ public class SlistHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getToplevelAST() { return null; @@ -151,6 +157,7 @@ public class SlistHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { // only need to check this if parent is not diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java index 11e833f6c..319b5a3ea 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java @@ -46,6 +46,7 @@ public class StaticInitHandler extends BlockParentHandler * * @return false */ + @Override protected boolean toplevelMustStartLine() { return false; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java index ddabf9c91..c96ac116f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java @@ -47,6 +47,7 @@ public class SwitchHandler extends BlockParentHandler * * @return the left curly brace expression */ + @Override protected DetailAST getLCurly() { return getMainAst().findFirstToken(TokenTypes.LCURLY); @@ -57,6 +58,7 @@ public class SwitchHandler extends BlockParentHandler * * @return the right curly brace expression */ + @Override protected DetailAST getRCurly() { return getMainAst().findFirstToken(TokenTypes.RCURLY); @@ -67,6 +69,7 @@ public class SwitchHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getListChild() { // all children should be taken care of by case handler (plus @@ -81,6 +84,7 @@ public class SwitchHandler extends BlockParentHandler * * @return null */ + @Override protected DetailAST getNonlistChild() { return null; @@ -102,6 +106,7 @@ public class SwitchHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkSwitchExpr(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java index cf00e423b..6a6c6d522 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java @@ -50,6 +50,7 @@ public class TryHandler extends BlockParentHandler * * @return suggested indentation for child */ + @Override public IndentLevel suggestedChildLevel(ExpressionHandler aChild) { if ((aChild instanceof CatchHandler) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java index f6b9c5712..c48fd204a 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java @@ -56,6 +56,7 @@ public class WhileHandler extends BlockParentHandler /** * Check the indentation of the expression we are handling. */ + @Override public void checkIndentation() { checkCondExpr(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractBeanCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractBeanCheck.java index 1b8db7188..530850bc3 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractBeanCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractBeanCheck.java @@ -41,6 +41,7 @@ public abstract class AbstractBeanCheck /** * {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.CLASS_DEF}; @@ -49,6 +50,7 @@ public abstract class AbstractBeanCheck /** * {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractInterfaceCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractInterfaceCheck.java index e28dc5c69..45e063879 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractInterfaceCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/AbstractInterfaceCheck.java @@ -30,6 +30,7 @@ public class AbstractInterfaceCheck /** * {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.INTERFACE_DEF}; @@ -38,6 +39,7 @@ public class AbstractInterfaceCheck /** * {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanManagedMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanManagedMethodChecker.java index 8627194b0..701e1f8d5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanManagedMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanManagedMethodChecker.java @@ -44,6 +44,7 @@ public class BeanManagedMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethods(DetailAST aAST) { mHasEjbFindByPrimaryKey = false; @@ -60,6 +61,7 @@ public class BeanManagedMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { super.checkMethod(aMethodAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanMethodChecker.java index cfa00ecb9..249c36468 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/BeanMethodChecker.java @@ -40,6 +40,7 @@ public abstract class BeanMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { // every kind of a bean has ejbCreate(...) requirements diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ContainerManagedMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ContainerManagedMethodChecker.java index 0bede05ad..148a3001d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ContainerManagedMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ContainerManagedMethodChecker.java @@ -41,6 +41,7 @@ public class ContainerManagedMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { super.checkMethod(aMethodAST); @@ -77,6 +78,7 @@ public class ContainerManagedMethodChecker * entity bean satisfies requirements. * @param aMethodAST the AST for the method definition. */ + @Override protected void checkCreateMethod(DetailAST aMethodAST) { super.checkCreateMethod(aMethodAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanCheck.java index da63b2e62..451283763 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanCheck.java @@ -105,6 +105,7 @@ public class EntityBeanCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasImplements(aAST, "javax.ejb.EntityBean")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/FinalStaticCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/FinalStaticCheck.java index 468c49898..f875bb7ac 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/FinalStaticCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/FinalStaticCheck.java @@ -35,6 +35,7 @@ public class FinalStaticCheck /** * {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; @@ -43,6 +44,7 @@ public class FinalStaticCheck /** * {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); @@ -51,6 +53,7 @@ public class FinalStaticCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.isInEJB(aAST) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/HomeInterfaceMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/HomeInterfaceMethodChecker.java index 3cbdcbf20..a0c3377db 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/HomeInterfaceMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/HomeInterfaceMethodChecker.java @@ -40,6 +40,7 @@ public abstract class HomeInterfaceMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { // every kind of a home interface has create(...) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceCheck.java index 6afa17e64..ad80c6efe 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceCheck.java @@ -44,6 +44,7 @@ public class LocalHomeInterfaceCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasExtends(aAST, "javax.ejb.EJBLocalHome")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceMethodChecker.java index bfa40d7d2..185f36f3f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalHomeInterfaceMethodChecker.java @@ -46,6 +46,7 @@ public class LocalHomeInterfaceMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { super.checkMethod(aMethodAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceCheck.java index 1305f2589..e301344b6 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceCheck.java @@ -39,6 +39,7 @@ public class LocalInterfaceCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasExtends(aAST, "javax.ejb.EJBLocalObject")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceMethodChecker.java index bf96649ee..1740109b2 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/LocalInterfaceMethodChecker.java @@ -42,6 +42,7 @@ public class LocalInterfaceMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { // every method must not throw java.rmi.RemoteException diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanCheck.java index 3c12b11ac..16a36a2db 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanCheck.java @@ -50,6 +50,7 @@ public class MessageBeanCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasImplements(aAST, "javax.ejb.MessageDrivenBean") diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanMethodChecker.java index 57cfbaf71..f62184bc0 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/MessageBeanMethodChecker.java @@ -44,6 +44,7 @@ public class MessageBeanMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethods(DetailAST aAST) { mHasEjbCreate = false; @@ -62,6 +63,7 @@ public class MessageBeanMethodChecker /** * {@inheritDoc} */ + @Override protected void checkCreateMethod(DetailAST aMethodAST) { final DetailAST nameAST = aMethodAST.findFirstToken(TokenTypes.IDENT); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceCheck.java index d1c1f7f82..a99c6bab5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceCheck.java @@ -40,6 +40,7 @@ public class RemoteHomeInterfaceCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasExtends(aAST, "javax.ejb.EJBHome")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceMethodChecker.java index e858f12c3..a6d574a84 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteHomeInterfaceMethodChecker.java @@ -42,6 +42,7 @@ public class RemoteHomeInterfaceMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { super.checkMethod(aMethodAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceCheck.java index 7995c9449..f5029ba9f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceCheck.java @@ -40,6 +40,7 @@ public class RemoteInterfaceCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasExtends(aAST, "javax.ejb.EJBObject")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceMethodChecker.java index 0591e0c32..3896062a7 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/RemoteInterfaceMethodChecker.java @@ -41,6 +41,7 @@ public class RemoteInterfaceMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethod(DetailAST aMethodAST) { // every method must throw java.rmi.RemoteException diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanCheck.java index 0c8255052..e02a263df 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanCheck.java @@ -48,6 +48,7 @@ public class SessionBeanCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.hasImplements(aAST, "javax.ejb.SessionBean")) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanMethodChecker.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanMethodChecker.java index 18c9c430d..4dca9fd3a 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanMethodChecker.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/SessionBeanMethodChecker.java @@ -44,6 +44,7 @@ public class SessionBeanMethodChecker /** * {@inheritDoc} */ + @Override public void checkMethods(DetailAST aAST) { mHasEjbCreate = false; @@ -65,6 +66,7 @@ public class SessionBeanMethodChecker /** * {@inheritDoc} */ + @Override protected void checkCreateMethod(DetailAST aMethodAST) { super.checkCreateMethod(aMethodAST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisParameterCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisParameterCheck.java index 02ebc52b6..f851a905e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisParameterCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisParameterCheck.java @@ -36,6 +36,7 @@ public class ThisParameterCheck /** * {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_THIS}; @@ -44,6 +45,7 @@ public class ThisParameterCheck /** * {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); @@ -52,6 +54,7 @@ public class ThisParameterCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.isInEJB(aAST)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisReturnCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisReturnCheck.java index 1083d2c50..45dc96958 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisReturnCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/ThisReturnCheck.java @@ -35,6 +35,7 @@ public class ThisReturnCheck /** * {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_THIS}; @@ -43,6 +44,7 @@ public class ThisReturnCheck /** * {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); @@ -51,6 +53,7 @@ public class ThisReturnCheck /** * {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (Utils.isInEJB(aAST)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java index f09cdf4ba..0e0f3e158 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java @@ -131,6 +131,7 @@ class HtmlTag * Used for displaying a Checkstyle error. * @return the String text of this tag. */ + @Override public String toString() { final int startOfText = mPosition; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java index 6e67992b3..5151354f9 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java @@ -22,6 +22,7 @@ import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; import com.puppycrawl.tools.checkstyle.api.MessageDispatcher; import java.io.File; import java.util.HashSet; +import java.util.List; import java.util.Set; /** @@ -45,9 +46,9 @@ public class JavadocPackageCheck extends AbstractFileSetCheck } /** {@inheritDoc} */ - public void process(File[] aFiles) + public void process(List aFiles) { - final File[] javaFiles = filter(aFiles); + final List javaFiles = filter(aFiles); final Set directories = getParentDirs(javaFiles); for (File dir : directories) { // Check for the preferred file. @@ -82,7 +83,7 @@ public class JavadocPackageCheck extends AbstractFileSetCheck * @param aFiles s set of files * @return the set of parent directories of the given files */ - protected final Set getParentDirs(File[] aFiles) + protected final Set getParentDirs(List aFiles) { final Set directories = new HashSet(); for (File element : aFiles) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.java index 890a92f5d..ea7b45650 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.java @@ -84,6 +84,7 @@ class JavadocTag } /** @return a string representation of the object **/ + @Override public String toString() { return "{Tag = '" + getTag() + "', lineNo = " + getLineNo() diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java index 9f0f2df03..b8e70ba47 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java @@ -61,6 +61,7 @@ public class JavadocVariableCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -70,6 +71,7 @@ public class JavadocVariableCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (shouldCheck(aAST)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java index a6544925f..96b905502 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java @@ -126,12 +126,14 @@ public class WriteTagCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.INTERFACE_DEF, TokenTypes.CLASS_DEF, }; } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return new int[] {TokenTypes.INTERFACE_DEF, @@ -141,6 +143,7 @@ public class WriteTagCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final FileContents contents = getFileContents(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck.java index 4fe940757..f5be1fdaa 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck.java @@ -41,6 +41,7 @@ public final class ClassDataAbstractionCouplingCheck } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return new int[] { @@ -53,6 +54,7 @@ public final class ClassDataAbstractionCouplingCheck } /** {@inheritDoc} */ + @Override protected String getLogMessageId() { return "classDataAbstractionCoupling"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheck.java index af996650b..052972d3c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheck.java @@ -40,6 +40,7 @@ public final class ClassFanOutComplexityCheck extends AbstractClassCouplingCheck } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return new int[] { @@ -55,6 +56,7 @@ public final class ClassFanOutComplexityCheck extends AbstractClassCouplingCheck } /** {@inheritDoc} */ + @Override protected String getLogMessageId() { return "classFanOutComplexity"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java index 75f394860..021a3df60 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java @@ -47,6 +47,7 @@ public class CyclomaticComplexityCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -67,12 +68,14 @@ public class CyclomaticComplexityCheck } /** {@inheritDoc} */ + @Override protected final void visitTokenHook(DetailAST aAST) { incrementCurrentValue(BigInteger.ONE); } /** {@inheritDoc} */ + @Override protected final String getMessageID() { return "cyclomaticComplexity"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java index 291bf99d0..18c46b5d2 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java @@ -47,6 +47,7 @@ public final class NPathComplexityCheck extends AbstractComplexityCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -68,6 +69,7 @@ public final class NPathComplexityCheck extends AbstractComplexityCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { switch (aAST.getType()) { @@ -91,6 +93,7 @@ public final class NPathComplexityCheck extends AbstractComplexityCheck } /** {@inheritDoc} */ + @Override public void leaveToken(DetailAST aAST) { switch (aAST.getType()) { @@ -114,6 +117,7 @@ public final class NPathComplexityCheck extends AbstractComplexityCheck } /** {@inheritDoc} */ + @Override protected String getMessageID() { return "npathComplexity"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java index dccc5a0c6..31a8af690 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java @@ -33,6 +33,7 @@ public class RedundantModifierCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -43,12 +44,14 @@ public class RedundantModifierCheck } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return new int[] {}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (ScopeUtils.inInterfaceOrAnnotationBlock(aAST)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java index 037ce8e3e..dc7f61856 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java @@ -47,18 +47,21 @@ public final class AbstractClassNameCheck extends AbstractFormatCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[]{TokenTypes.CLASS_DEF}; } /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return getDefaultTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { switch (aAST.getType()) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractNameCheck.java index 274216475..e845e1098 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/AbstractNameCheck.java @@ -54,6 +54,7 @@ public abstract class AbstractNameCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (mustCheckName(aAST)) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java index 5d23103bd..79baa61c6 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java @@ -64,12 +64,14 @@ public class ConstantNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } /** {@inheritDoc} */ + @Override protected final boolean mustCheckName(DetailAST aAST) { boolean retVal = false; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java index 442519cda..a9a420813 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java @@ -59,6 +59,7 @@ public class LocalFinalVariableNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -68,6 +69,7 @@ public class LocalFinalVariableNameCheck } /** {@inheritDoc} */ + @Override protected final boolean mustCheckName(DetailAST aAST) { final DetailAST modifiersAST = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java index e486389fb..acda0118f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java @@ -59,6 +59,7 @@ public class LocalVariableNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -68,6 +69,7 @@ public class LocalVariableNameCheck } /** {@inheritDoc} */ + @Override protected final boolean mustCheckName(DetailAST aAST) { final DetailAST modifiersAST = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java index 90bcc8f72..7021f8cce 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java @@ -68,12 +68,14 @@ public class MemberNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } /** {@inheritDoc} */ + @Override protected final boolean mustCheckName(DetailAST aAST) { final DetailAST modifiersAST = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java index 5c31a6892..10f4d957e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java @@ -56,6 +56,7 @@ public class MethodNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.METHOD_DEF}; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java index 0504ed1a8..07b8b651d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java @@ -75,12 +75,14 @@ public class PackageNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.PACKAGE_DEF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST nameAST = aAST.getLastChild().getPreviousSibling(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java index 12bc47fbe..7432c7f90 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java @@ -59,12 +59,14 @@ public class ParameterNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.PARAMETER_DEF}; } /** {@inheritDoc} */ + @Override protected boolean mustCheckName(DetailAST aAST) { return !( diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java index 85ec46e8f..1df864011 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java @@ -57,12 +57,14 @@ public class StaticVariableNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } /** {@inheritDoc} */ + @Override protected final boolean mustCheckName(DetailAST aAST) { final DetailAST modifiersAST = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java index 647ee6643..eed0e21f0 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java @@ -57,6 +57,7 @@ public class TypeNameCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.CLASS_DEF, diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.java index 00943ef1d..44c33f4b4 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.java @@ -64,12 +64,14 @@ public class AnonInnerLengthCheck extends Check private int mMax = DEFAULT_MAX; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_NEW}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST openingBrace = aAST.findFirstToken(TokenTypes.OBJBLOCK); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.java index 5bf3a83a4..6dfb8e730 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.java @@ -61,12 +61,14 @@ public class FileLengthCheck extends Check private int mMaxFileLength = DEFAULT_MAX_LINES; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[0]; } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { final String[] lines = getLines(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java index 7cde4ee13..1a8cb7931 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java @@ -96,12 +96,14 @@ public class LineLengthCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[0]; } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { final String[] lines = getLines(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java index 7469d847a..d6115cdc6 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java @@ -65,12 +65,14 @@ public class MethodLengthCheck extends Check private int mMax = DEFAULT_MAX_LINES; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST openingBrace = aAST.findFirstToken(TokenTypes.SLIST); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java index 87cdd704e..83651e7df 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java @@ -66,12 +66,14 @@ public class ParameterNumberCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF}; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST params = aAST.findFirstToken(TokenTypes.PARAMETERS); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheck.java index ed2b21991..d3dabe36d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheck.java @@ -60,6 +60,7 @@ public class EmptyForInitializerPadCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.FOR_INIT, @@ -67,6 +68,7 @@ public class EmptyForInitializerPadCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (aAST.getChildCount() == 0) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheck.java index 090ccf0ac..76808bb11 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheck.java @@ -59,6 +59,7 @@ public class EmptyForIteratorPadCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.FOR_ITERATOR, @@ -66,6 +67,7 @@ public class EmptyForIteratorPadCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (aAST.getChildCount() == 0) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java index ddf7f4f5d..51c87b8c3 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java @@ -78,6 +78,7 @@ public class MethodParamPadCheck private boolean mAllowLineBreaks; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -90,6 +91,7 @@ public class MethodParamPadCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final DetailAST parenAST; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java index 492ab19f6..4acc7bd5d 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java @@ -67,6 +67,7 @@ public class NoWhitespaceAfterCheck extends Check private boolean mAllowLineBreaks = true; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -82,6 +83,7 @@ public class NoWhitespaceAfterCheck extends Check } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return new int[] { @@ -98,6 +100,7 @@ public class NoWhitespaceAfterCheck extends Check } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { DetailAST targetAST = aAST; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java index 9483edc88..93c8ae2f0 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java @@ -65,6 +65,7 @@ public class NoWhitespaceBeforeCheck private boolean mAllowLineBreaks; /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -75,6 +76,7 @@ public class NoWhitespaceBeforeCheck } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return new int[] { @@ -86,6 +88,7 @@ public class NoWhitespaceBeforeCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final String[] lines = getLines(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java index 9a2e9a5ae..cde9c8945 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java @@ -100,6 +100,7 @@ public class OperatorWrapCheck } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -129,6 +130,7 @@ public class OperatorWrapCheck } /** {@inheritDoc} */ + @Override public int[] getAcceptableTokens() { return new int[] { @@ -170,6 +172,7 @@ public class OperatorWrapCheck }; } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { if (aAST.getType() == TokenTypes.COLON) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java index c4d592e63..06619bbe0 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java @@ -65,6 +65,7 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; public class ParenPadCheck extends AbstractParenPadCheck { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] {TokenTypes.RPAREN, @@ -76,6 +77,7 @@ public class ParenPadCheck extends AbstractParenPadCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // Strange logic in this method to guard against checking RPAREN tokens diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TabCharacterCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TabCharacterCheck.java index c3c7c8def..f7fedbcbc 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TabCharacterCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TabCharacterCheck.java @@ -50,12 +50,14 @@ public class TabCharacterCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[0]; } /** {@inheritDoc} */ + @Override public void beginTree(DetailAST aRootAST) { final String[] lines = getLines(); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheck.java index f4078f891..cdc5760d0 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheck.java @@ -51,18 +51,21 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; public class TypecastParenPadCheck extends AbstractParenPadCheck { /** {@inheritDoc} */ + @Override public int[] getRequiredTokens() { return new int[] {TokenTypes.RPAREN, TokenTypes.TYPECAST}; } /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return getRequiredTokens(); } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { // Strange logic in this method to guard against checking RPAREN tokens diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java index e09b649ab..acc419c68 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java @@ -56,6 +56,7 @@ public class WhitespaceAfterCheck extends Check { /** {@inheritDoc} */ + @Override public int[] getDefaultTokens() { return new int[] { @@ -66,6 +67,7 @@ public class WhitespaceAfterCheck } /** {@inheritDoc} */ + @Override public void visitToken(DetailAST aAST) { final Object[] message; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntMatchFilter.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntMatchFilter.java index 13a7391ac..ce6bd36e5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntMatchFilter.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntMatchFilter.java @@ -43,18 +43,21 @@ class IntMatchFilter implements IntFilter } /** {@inheritDoc} */ + @Override public String toString() { return "IntMatchFilter[" + mMatchValue + "]"; } /** {@inheritDoc} */ + @Override public int hashCode() { return mMatchValue.hashCode(); } /** {@inheritDoc} */ + @Override public boolean equals(Object aObject) { if (aObject instanceof IntMatchFilter) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntRangeFilter.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntRangeFilter.java index af2c0791f..02bfc41fd 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntRangeFilter.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/IntRangeFilter.java @@ -53,12 +53,14 @@ class IntRangeFilter implements IntFilter } /** {@inheritDoc} */ + @Override public int hashCode() { return HASH_MULT * mLowerBound.intValue() + mUpperBound.intValue(); } /** {@inheritDoc} */ + @Override public boolean equals(Object aObject) { if (aObject instanceof IntRangeFilter) { @@ -69,6 +71,7 @@ class IntRangeFilter implements IntFilter return false; } /** {@inheritDoc} */ + @Override public String toString() { return "IntRangeFilter[" + mLowerBound + "," + mUpperBound + "]"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressElement.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressElement.java index f5a434d21..79ec4b2bd 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressElement.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressElement.java @@ -174,6 +174,7 @@ public class SuppressElement } /** {@inheritDoc} */ + @Override public String toString() { return "SupressElement[files=" + mFilePattern + ",checks=" @@ -182,6 +183,7 @@ public class SuppressElement } /** {@inheritDoc} */ + @Override public int hashCode() { int result = HASH_MULT * mFilePattern.hashCode(); @@ -201,6 +203,7 @@ public class SuppressElement } /** {@inheritDoc} */ + @Override public boolean equals(Object aObject) { if (aObject instanceof SuppressElement) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressionFilter.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressionFilter.java index 1e9855ab9..ea0e52b61 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressionFilter.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/filters/SuppressionFilter.java @@ -56,18 +56,21 @@ public class SuppressionFilter } /** {@inheritDoc} */ + @Override public String toString() { return mFilters.toString(); } /** {@inheritDoc} */ + @Override public int hashCode() { return mFilters.hashCode(); } /** {@inheritDoc} */ + @Override public boolean equals(Object aObject) { if (aObject instanceof SuppressionFilter) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/JTreeTable.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/JTreeTable.java index 0af64c5ca..ed12cd064 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/JTreeTable.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/JTreeTable.java @@ -129,6 +129,7 @@ public class JTreeTable extends JTable * Since the tree is not actually in the component hierarchy it will * never receive this unless we forward it in this manner. */ + @Override public void updateUI() { super.updateUI(); @@ -147,6 +148,7 @@ public class JTreeTable extends JTable * is not the right thing to do for an editor. Returning -1 for the * editing row in this case, ensures the editor is never painted. */ + @Override public int getEditingRow() { final Class editingClass = getColumnClass(editingColumn); @@ -156,6 +158,7 @@ public class JTreeTable extends JTable /** * Overridden to pass the new rowHeight to the tree. */ + @Override public void setRowHeight(int newRowHeight) { super.setRowHeight(newRowHeight); @@ -191,6 +194,7 @@ public class JTreeTable extends JTable * updateUI is overridden to set the colors of the Tree's renderer * to match that of the table. */ + @Override public void updateUI() { super.updateUI(); @@ -214,6 +218,7 @@ public class JTreeTable extends JTable * Sets the row height of the tree, and forwards the row height to * the table. */ + @Override public void setRowHeight(int newRowHeight) { if (newRowHeight > 0) { @@ -229,6 +234,7 @@ public class JTreeTable extends JTable /** * This is overridden to set the height to match that of the JTable. */ + @Override public void setBounds(int x, int y, int w, int h) { super.setBounds(x, 0, w, JTreeTable.this.getHeight()); @@ -238,6 +244,7 @@ public class JTreeTable extends JTable * Sublcassed to translate the graphics such that the last visible * row will be drawn at 0,0. */ + @Override public void paint(Graphics g) { g.translate(0, -visibleRow * getRowHeight()); @@ -301,6 +308,7 @@ public class JTreeTable extends JTable * * @see TableCellEditor */ + @Override public boolean isCellEditable(EventObject e) { if (e instanceof MouseEvent) { @@ -359,6 +367,7 @@ public class JTreeTable extends JTable * and message super. This is the only place DefaultTreeSelectionModel * alters the ListSelectionModel. */ + @Override public void resetRowSelection() { if (!updatingListSelectionModel) { diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeInfoPanel.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeInfoPanel.java index cd1444f0f..f89f1c479 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeInfoPanel.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeInfoPanel.java @@ -64,6 +64,7 @@ public class ParseTreeInfoPanel extends JPanel private static class JavaFileFilter extends FileFilter { + @Override public boolean accept(File f) { if (f == null) { @@ -72,6 +73,7 @@ public class ParseTreeInfoPanel extends JPanel return f.isDirectory() || f.getName().endsWith(".java"); } + @Override public String getDescription() { return "Java Source Code"; diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeModel.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeModel.java index 014fae537..6e00ed753 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeModel.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/ParseTreeModel.java @@ -69,6 +69,7 @@ public class ParseTreeModel extends AbstractTreeTableModel return COLUMN_NAMES[column]; } + @Override public Class getColumnClass(int column) { switch (column) { @@ -104,6 +105,7 @@ public class ParseTreeModel extends AbstractTreeTableModel return null; } + @Override public void setValueAt(Object aValue, Object node, int column) { } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.java index d12e0f47a..58dd22d70 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.java @@ -113,11 +113,13 @@ public class TreeTableModelAdapter extends AbstractTableModel return mTreeTableModel.getColumnCount(); } + @Override public String getColumnName(int column) { return mTreeTableModel.getColumnName(column); } + @Override public Class getColumnClass(int column) { return mTreeTableModel.getColumnClass(column); @@ -139,11 +141,13 @@ public class TreeTableModelAdapter extends AbstractTableModel return mTreeTableModel.getValueAt(nodeForRow(row), column); } + @Override public boolean isCellEditable(int row, int column) { return mTreeTableModel.isCellEditable(nodeForRow(row), column); } + @Override public void setValueAt(Object value, int row, int column) { mTreeTableModel.setValueAt(value, nodeForRow(row), column); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java b/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java index 1c98437c3..b1588c353 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java @@ -10,6 +10,9 @@ import java.io.InputStreamReader; import java.io.LineNumberReader; import java.io.OutputStream; import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Locale; import java.util.Properties; import junit.framework.TestCase; @@ -109,7 +112,9 @@ public abstract class BaseCheckTestCase throws Exception { mStream.flush(); - final int errs = aC.process(aProcessedFiles); + final List theFiles = new ArrayList(); + Collections.addAll(theFiles, aProcessedFiles); + final int errs = aC.process(theFiles); // process each of the lines final ByteArrayInputStream bais = diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java index 1371c3561..bb6e13e1f 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java @@ -1,6 +1,7 @@ package com.puppycrawl.tools.checkstyle.checks; import java.io.File; +import java.util.List; import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; @@ -32,7 +33,7 @@ public class FileSetCheckLifecycleTest return destroyed; } - public void process(File[] aFiles) + public void process(List aFiles) { } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java index 33e5ed7e9..03492ffa5 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java @@ -7,6 +7,9 @@ import java.io.File; import java.io.ByteArrayInputStream; import java.io.LineNumberReader; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @author Daniel Grenner @@ -14,7 +17,7 @@ import java.io.InputStreamReader; public class WriteTagCheckTest extends BaseCheckTestCase { private DefaultConfiguration mCheckConfig; - + public void setUp() { mCheckConfig = createCheckConfig(WriteTagCheck.class); } @@ -141,6 +144,7 @@ public class WriteTagCheckTest extends BaseCheckTestCase verify(mCheckConfig, getPath("InputWriteTag.java"), expected); } + @Override protected void verify(Checker aC, File[] aProcessedFiles, String aMessageFileName, @@ -148,7 +152,9 @@ public class WriteTagCheckTest extends BaseCheckTestCase throws Exception { mStream.flush(); - final int errs = aC.process(aProcessedFiles); + final List theFiles = new ArrayList(); + Collections.addAll(theFiles, aProcessedFiles); + final int errs = aC.process(theFiles); // process each of the lines final ByteArrayInputStream bais = diff --git a/suppressions.xml b/suppressions.xml index 136de74e9..b4ad56e5d 100755 --- a/suppressions.xml +++ b/suppressions.xml @@ -13,7 +13,7 @@ lines="176"/> + lines="27"/>