Removed a native array in favour of a List<File> -- was it worth it??

Added @Override where possible -- did this as I got bitten by a subtle bug when making the first change. The @Override would have prevented it.
This commit is contained in:
Oliver Burn 2007-12-20 06:21:11 +00:00
parent e287c5e741
commit f38d8abd42
154 changed files with 403 additions and 46 deletions

View File

@ -308,12 +308,12 @@ public class CheckStyleTask extends Task
// Process the files
long startTime = System.currentTimeMillis();
final File[] files = scanFileSets();
final List<File> 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<File> scanFileSets()
{
final List<File> list = new ArrayList<File>();
if (mFileName != null) {
@ -503,7 +503,7 @@ public class CheckStyleTask extends Task
}
}
return list.toArray(new File[0]);
return list;
}
/**

View File

@ -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<File> aFiles)
{
fireAuditStarted();
for (FileSetCheck fsc : mFileSetChecks) {

View File

@ -118,10 +118,7 @@ public final class Main
final AuditListener listener = createListener(line, out, closeOut);
final List<File> 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);
}

View File

@ -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) {

View File

@ -575,9 +575,9 @@ public final class TreeWalker
}
/** {@inheritDoc} */
public void process(File[] aFiles)
public void process(List<File> aFiles)
{
final File[] javaFiles = filter(aFiles);
final List<File> javaFiles = filter(aFiles);
for (File element : javaFiles) {
process(element);

View File

@ -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<File> filter(List<File> 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)
{

View File

@ -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() + "]";

View File

@ -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<File> aFiles);
/** Cleans up the object. **/
void destroy();

View File

@ -143,6 +143,7 @@ public final class FullIdent
}
/** {@inheritDoc} */
@Override
public String toString()
{
return getText() + "[" + getLineNo() + "x" + getColumnNo() + "]";

View File

@ -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<File> filterFilesByExtension(
List<File> aFiles, String[] aFileExtensions)
{
if ((aFileExtensions == null) || (aFileExtensions.length == 0)) {
return aFiles;
@ -300,7 +300,7 @@ public final class Utils
}
}
final List<File> files = new ArrayList<File>(aFiles.length);
final List<File> files = new ArrayList<File>(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;
}
}

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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<File> aFiles)
{
final File[] files = filter(aFiles);
final List<File> files = filter(aFiles);
final MessageDispatcher dispatcher = getMessageDispatcher();
for (final File file : files) {
final String path = file.getPath();

View File

@ -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();

View File

@ -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<String, Set<File>> arrangePropertyFiles(
File[] aPropFiles)
List<File> aPropFiles)
{
final Map<String, Set<File>> propFileMap =
new HashMap<String, Set<File>>();
@ -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<File> aFiles)
{
final File[] propertyFiles = filter(aFiles);
final List<File> propertyFiles = filter(aFiles);
final Map<String, Set<File>> propFilesMap =
arrangePropertyFiles(propertyFiles);
checkPropertyFileSets(propFilesMap);

View File

@ -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()) {

View File

@ -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")) {

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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 =

View File

@ -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");

View File

@ -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

View File

@ -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();

View File

@ -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 =

View File

@ -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();

View File

@ -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)) {

View File

@ -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()) {

View File

@ -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)) {

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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()) {

View File

@ -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()) {

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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:

View File

@ -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

View File

@ -43,6 +43,7 @@ public class SuperCloneCheck extends AbstractSuperCheck
/**
* {@inheritDoc}
*/
@Override
protected String getMethodName()
{
return "clone";

View File

@ -43,6 +43,7 @@ public class SuperFinalizeCheck extends AbstractSuperCheck
/**
* {@inheritDoc}
*/
@Override
protected String getMethodName()
{
return "finalize";

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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 =

View File

@ -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()) {

View File

@ -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<File> 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<File> 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);

View File

@ -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];

View File

@ -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<File> aFiles)
{
final MessageDispatcher msgDispatcher = getMessageDispatcher();
final RegexpHeaderChecker regexpHeaderChecker =
new RegexpHeaderChecker(
mHeaderInfo, new FileSetCheckViolationMonitor());
File[] files = filter(aFiles);
List<File> files = filter(aFiles);
for (final File file : files) {
final String path = file.getPath();
msgDispatcher.fireFileStarted(path);

View File

@ -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();

View File

@ -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();

View File

@ -85,6 +85,7 @@ final class RegexpHeaderInfo extends HeaderInfo
* Initializes {@link #mHeaderRegexps} from
* {@link HeaderInfo#getHeaderLines()}.
*/
@Override
protected void postprocessHeaderLines()
{
final String[] headerLines = getHeaderLines();

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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[] {

View File

@ -55,6 +55,7 @@ public class DoWhileHandler extends BlockParentHandler
/**
* Check the indentation of the expression we are handling.
*/
@Override
public void checkIndentation()
{
super.checkIndentation();

View File

@ -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();

View File

@ -46,6 +46,7 @@ public class FinallyHandler extends BlockParentHandler
*
* @return false
*/
@Override
protected boolean toplevelMustStartLine()
{
return false;

View File

@ -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) {

View File

@ -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();

View File

@ -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();

View File

@ -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)

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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,

View File

@ -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());

View File

@ -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);

View File

@ -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

View File

@ -46,6 +46,7 @@ public class StaticInitHandler extends BlockParentHandler
*
* @return false
*/
@Override
protected boolean toplevelMustStartLine()
{
return false;

View File

@ -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();

View File

@ -50,6 +50,7 @@ public class TryHandler extends BlockParentHandler
*
* @return suggested indentation for child
*/
@Override
public IndentLevel suggestedChildLevel(ExpressionHandler aChild)
{
if ((aChild instanceof CatchHandler)

View File

@ -56,6 +56,7 @@ public class WhileHandler extends BlockParentHandler
/**
* Check the indentation of the expression we are handling.
*/
@Override
public void checkIndentation()
{
checkCondExpr();

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -40,6 +40,7 @@ public abstract class BeanMethodChecker
/**
* {@inheritDoc}
*/
@Override
public void checkMethod(DetailAST aMethodAST)
{
// every kind of a bean has ejbCreate<METHOD>(...) requirements

View File

@ -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);

View File

@ -105,6 +105,7 @@ public class EntityBeanCheck
/**
* {@inheritDoc}
*/
@Override
public void visitToken(DetailAST aAST)
{
if (Utils.hasImplements(aAST, "javax.ejb.EntityBean")) {

View File

@ -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)

View File

@ -40,6 +40,7 @@ public abstract class HomeInterfaceMethodChecker
/**
* {@inheritDoc}
*/
@Override
public void checkMethod(DetailAST aMethodAST)
{
// every kind of a home interface has create<METHOD>(...)

View File

@ -44,6 +44,7 @@ public class LocalHomeInterfaceCheck
/**
* {@inheritDoc}
*/
@Override
public void visitToken(DetailAST aAST)
{
if (Utils.hasExtends(aAST, "javax.ejb.EJBLocalHome")) {

View File

@ -46,6 +46,7 @@ public class LocalHomeInterfaceMethodChecker
/**
* {@inheritDoc}
*/
@Override
public void checkMethod(DetailAST aMethodAST)
{
super.checkMethod(aMethodAST);

View File

@ -39,6 +39,7 @@ public class LocalInterfaceCheck
/**
* {@inheritDoc}
*/
@Override
public void visitToken(DetailAST aAST)
{
if (Utils.hasExtends(aAST, "javax.ejb.EJBLocalObject")) {

View File

@ -42,6 +42,7 @@ public class LocalInterfaceMethodChecker
/**
* {@inheritDoc}
*/
@Override
public void checkMethod(DetailAST aMethodAST)
{
// every method must not throw java.rmi.RemoteException

View File

@ -50,6 +50,7 @@ public class MessageBeanCheck
/**
* {@inheritDoc}
*/
@Override
public void visitToken(DetailAST aAST)
{
if (Utils.hasImplements(aAST, "javax.ejb.MessageDrivenBean")

View File

@ -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);

View File

@ -40,6 +40,7 @@ public class RemoteHomeInterfaceCheck
/**
* {@inheritDoc}
*/
@Override
public void visitToken(DetailAST aAST)
{
if (Utils.hasExtends(aAST, "javax.ejb.EJBHome")) {

View File

@ -42,6 +42,7 @@ public class RemoteHomeInterfaceMethodChecker
/**
* {@inheritDoc}
*/
@Override
public void checkMethod(DetailAST aMethodAST)
{
super.checkMethod(aMethodAST);

Some files were not shown because too many files have changed in this diff Show More