diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java index 4f49e737a..c2cab23a8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java @@ -30,16 +30,16 @@ public class ArrayInitHandler extends BlockParentHandler { /** * Construct an instance of this handler with the given indentation check, - * abstract syntax tree, and parent handler. + * astract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the astract syntax tree + * @param parent the parent handler */ - public ArrayInitHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public ArrayInitHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "array initialization", aAst, aParent); + super(indentCheck, "array initialization", ast, parent); } @Override @@ -124,25 +124,25 @@ public class ArrayInitHandler extends BlockParentHandler } /** - * @param aLineNo number of line on which we search - * @param aColumnNo number of column after which we search + * @param lineNo number of line on which we search + * @param columnNo number of column after which we search * * @return column number of first non-blank char after * specified column on specified line or -1 if * such char doesn't exist. */ - private int getNextFirstNonblankOnLineAfter(int aLineNo, int aColumnNo) + private int getNextFirstNonblankOnLineAfter(int lineNo, int columnNo) { - int columnNo = aColumnNo + 1; - final String line = getIndentCheck().getLines()[aLineNo - 1]; + int realColumnNo = columnNo + 1; + final String line = getIndentCheck().getLines()[lineNo - 1]; final int lineLength = line.length(); - while ((columnNo < lineLength) - && Character.isWhitespace(line.charAt(columnNo))) + while ((realColumnNo < lineLength) + && Character.isWhitespace(line.charAt(realColumnNo))) { - columnNo++; + realColumnNo++; } - return (columnNo == lineLength) ? -1 : columnNo; + return (realColumnNo == lineLength) ? -1 : realColumnNo; } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java index 4cfba3727..d5cb1120d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java @@ -68,15 +68,15 @@ public class BlockParentHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * name, abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aName the name of the handler - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param name the name of the handler + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public BlockParentHandler(IndentationCheck aIndentCheck, - String aName, DetailAST aAst, ExpressionHandler aParent) + public BlockParentHandler(IndentationCheck indentCheck, + String name, DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, aName, aAst, aParent); + super(indentCheck, name, ast, parent); } /** @@ -339,7 +339,7 @@ public class BlockParentHandler extends ExpressionHandler } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { return getChildrenExpectedLevel(); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java index 98387d994..c8db735a4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java @@ -40,14 +40,14 @@ public class CaseHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aExpr the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param expr the abstract syntax tree + * @param parent the parent handler */ - public CaseHandler(IndentationCheck aIndentCheck, - DetailAST aExpr, ExpressionHandler aParent) + public CaseHandler(IndentationCheck indentCheck, + DetailAST expr, ExpressionHandler parent) { - super(aIndentCheck, "case", aExpr, aParent); + super(indentCheck, "case", expr, parent); } @Override @@ -66,7 +66,7 @@ public class CaseHandler extends ExpressionHandler } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { return getLevel(); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java index c3918158d..6de529833 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java @@ -32,14 +32,14 @@ public class CatchHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public CatchHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public CatchHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "catch", aAst, aParent); + super(indentCheck, "catch", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java index 3d73e7e7a..577504016 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java @@ -32,19 +32,19 @@ public class ClassDefHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public ClassDefHandler(IndentationCheck aIndentCheck, - DetailAST aAst, - ExpressionHandler aParent) + public ClassDefHandler(IndentationCheck indentCheck, + DetailAST ast, + ExpressionHandler parent) { - super(aIndentCheck, - (aAst.getType() == TokenTypes.CLASS_DEF) - ? "class def" : ((aAst.getType() == TokenTypes.ENUM_DEF) + super(indentCheck, + (ast.getType() == TokenTypes.CLASS_DEF) + ? "class def" : ((ast.getType() == TokenTypes.ENUM_DEF) ? "enum def" : "interface def"), - aAst, aParent); + ast, parent); } @Override @@ -93,9 +93,9 @@ public class ClassDefHandler extends BlockParentHandler final LineWrappingHandler lineWrap = new LineWrappingHandler(getIndentCheck(), getMainAst()) { @Override - public DetailAST findLastNode(DetailAST aFirstNode) + public DetailAST findLastNode(DetailAST firstNode) { - return aFirstNode.getLastChild(); + return firstNode.getLastChild(); } }; lineWrap.checkIndentation(); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java index 41e2fdd1a..de64c7c1c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java @@ -32,14 +32,14 @@ public class DoWhileHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public DoWhileHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public DoWhileHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "do..while", aAst, aParent); + super(indentCheck, "do..while", ast, parent); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java index bfc840c64..5b167e515 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java @@ -32,14 +32,14 @@ public class ElseHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public ElseHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public ElseHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "else", aAst, aParent); + super(indentCheck, "else", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ExpressionHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ExpressionHandler.java index 1438a99f1..03245be34 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ExpressionHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ExpressionHandler.java @@ -33,36 +33,36 @@ public abstract class ExpressionHandler /** * The instance of IndentationCheck using this handler. */ - private final IndentationCheck mIndentCheck; + private final IndentationCheck indentCheck; /** the AST which is handled by this handler */ - private final DetailAST mMainAst; + private final DetailAST mainAst; /** name used during output to user */ - private final String mTypeName; + private final String typeName; /** containing AST handler */ - private final ExpressionHandler mParent; + private final ExpressionHandler parent; /** indentation amount for this handler */ - private IndentLevel mLevel; + private IndentLevel level; /** * Construct an instance of this handler with the given indentation check, * name, abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aTypeName the name of the handler - * @param aExpr the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param typeName the name of the handler + * @param expr the abstract syntax tree + * @param parent the parent handler */ - public ExpressionHandler(IndentationCheck aIndentCheck, - String aTypeName, DetailAST aExpr, ExpressionHandler aParent) + public ExpressionHandler(IndentationCheck indentCheck, + String typeName, DetailAST expr, ExpressionHandler parent) { - mIndentCheck = aIndentCheck; - mTypeName = aTypeName; - mMainAst = aExpr; - mParent = aParent; + this.indentCheck = indentCheck; + this.typeName = typeName; + mainAst = expr; + this.parent = parent; } /** @@ -75,10 +75,10 @@ public abstract class ExpressionHandler */ public final IndentLevel getLevel() { - if (mLevel == null) { - mLevel = getLevelImpl(); + if (level == null) { + level = getLevelImpl(); } - return mLevel; + return level; } /** @@ -88,19 +88,19 @@ public abstract class ExpressionHandler */ protected IndentLevel getLevelImpl() { - return mParent.suggestedChildLevel(this); + return parent.suggestedChildLevel(this); } /** * Indentation level suggested for a child element. Children don't have * to respect this, but most do. * - * @param aChild child AST (so suggestion level can differ based on child + * @param child child AST (so suggestion level can differ based on child * type) * * @return suggested indentation for child */ - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { return new IndentLevel(getLevel(), getBasicOffset()); } @@ -108,92 +108,92 @@ public abstract class ExpressionHandler /** * Log an indentation error. * - * @param aAst the expression that caused the error - * @param aSubtypeName the type of the expression - * @param aActualLevel the actual indent level of the expression + * @param ast the expression that caused the error + * @param subtypeName the type of the expression + * @param actualLevel the actual indent level of the expression */ - protected final void logError(DetailAST aAst, String aSubtypeName, - int aActualLevel) + protected final void logError(DetailAST ast, String subtypeName, + int actualLevel) { - logError(aAst, aSubtypeName, aActualLevel, getLevel()); + logError(ast, subtypeName, actualLevel, getLevel()); } /** * Log an indentation error. * - * @param aAst the expression that caused the error - * @param aSubtypeName the type of the expression - * @param aActualLevel the actual indent level of the expression - * @param aExpectedLevel the expected indent level of the expression + * @param ast the expression that caused the error + * @param subtypeName the type of the expression + * @param actualLevel the actual indent level of the expression + * @param expectedLevel the expected indent level of the expression */ - protected final void logError(DetailAST aAst, String aSubtypeName, - int aActualLevel, IndentLevel aExpectedLevel) + protected final void logError(DetailAST ast, String subtypeName, + int actualLevel, IndentLevel expectedLevel) { final String typeStr = - ("".equals(aSubtypeName) ? "" : (" " + aSubtypeName)); + ("".equals(subtypeName) ? "" : (" " + subtypeName)); String messageKey = "indentation.error"; - if (aExpectedLevel.isMultiLevel()) { + if (expectedLevel.isMultiLevel()) { messageKey = "indentation.error.multi"; } - mIndentCheck.indentationLog(aAst.getLineNo(), messageKey, - mTypeName + typeStr, aActualLevel, aExpectedLevel); + indentCheck.indentationLog(ast.getLineNo(), messageKey, + typeName + typeStr, actualLevel, expectedLevel); } /** * Log child indentation error. * - * @param aLine the expression that caused the error - * @param aActualLevel the actual indent level of the expression - * @param aExpectedLevel the expected indent level of the expression + * @param line the expression that caused the error + * @param actualLevel the actual indent level of the expression + * @param expectedLevel the expected indent level of the expression */ - private void logChildError(int aLine, - int aActualLevel, - IndentLevel aExpectedLevel) + private void logChildError(int line, + int actualLevel, + IndentLevel expectedLevel) { String messageKey = "indentation.child.error"; - if (aExpectedLevel.isMultiLevel()) { + if (expectedLevel.isMultiLevel()) { messageKey = "indentation.child.error.multi"; } - mIndentCheck.indentationLog(aLine, messageKey, - mTypeName, aActualLevel, aExpectedLevel); + indentCheck.indentationLog(line, messageKey, + typeName, actualLevel, expectedLevel); } /** * Determines if the given expression is at the start of a line. * - * @param aAst the expression to check + * @param ast the expression to check * * @return true if it is, false otherwise */ - protected final boolean startsLine(DetailAST aAst) + protected final boolean startsLine(DetailAST ast) { - return getLineStart(aAst) == expandedTabsColumnNo(aAst); + return getLineStart(ast) == expandedTabsColumnNo(ast); } /** * Determines if two expressions are on the same line. * - * @param aAst1 the first expression - * @param aAst2 the second expression + * @param ast1 the first expression + * @param ast2 the second expression * * @return true if they are, false otherwise */ - static boolean areOnSameLine(DetailAST aAst1, DetailAST aAst2) + static boolean areOnSameLine(DetailAST ast1, DetailAST ast2) { - return (aAst1 != null) && (aAst2 != null) - && (aAst1.getLineNo() == aAst2.getLineNo()); + return (ast1 != null) && (ast2 != null) + && (ast1.getLineNo() == ast2.getLineNo()); } /** * Searchs in given sub-tree (including given node) for the token * which represents first symbol for this sub-tree in file. - * @param aAST a root of sub-tree in which the search shoul be performed. + * @param ast a root of sub-tree in which the search shoul be performed. * @return a token which occurs first in the file. */ - static DetailAST getFirstToken(DetailAST aAST) + static DetailAST getFirstToken(DetailAST ast) { - DetailAST first = aAST; - DetailAST child = aAST.getFirstChild(); + DetailAST first = ast; + DetailAST child = ast.getFirstChild(); while (child != null) { final DetailAST toTest = getFirstToken(child); @@ -212,13 +212,13 @@ public abstract class ExpressionHandler /** * Get the start of the line for the given expression. * - * @param aAst the expression to find the start of the line for + * @param ast the expression to find the start of the line for * * @return the start of the line for the given expression */ - protected final int getLineStart(DetailAST aAst) + protected final int getLineStart(DetailAST ast) { - final String line = mIndentCheck.getLine(aAst.getLineNo() - 1); + final String line = indentCheck.getLine(ast.getLineNo() - 1); return getLineStart(line); } @@ -226,20 +226,20 @@ public abstract class ExpressionHandler * Check the indentation of consecutive lines for the expression we are * handling. * - * @param aStartLine the first line to check - * @param aEndLine the last line to check - * @param aIndentLevel the required indent level + * @param startLine the first line to check + * @param endLine the last line to check + * @param indentLevel the required indent level */ - protected final void checkLinesIndent(int aStartLine, int aEndLine, - IndentLevel aIndentLevel) + protected final void checkLinesIndent(int startLine, int endLine, + IndentLevel indentLevel) { // check first line - checkSingleLine(aStartLine, aIndentLevel); + checkSingleLine(startLine, indentLevel); // check following lines final IndentLevel offsetLevel = - new IndentLevel(aIndentLevel, getBasicOffset()); - for (int i = aStartLine + 1; i <= aEndLine; i++) { + new IndentLevel(indentLevel, getBasicOffset()); + for (int i = startLine + 1; i <= endLine; i++) { checkSingleLine(i, offsetLevel); } } @@ -257,31 +257,31 @@ public abstract class ExpressionHandler /** * Check the indentation for a set of lines. * - * @param aLines the set of lines to check - * @param aIndentLevel the indentation level - * @param aFirstLineMatches whether or not the first line has to match - * @param aFirstLine firstline of whole expression + * @param lines the set of lines to check + * @param indentLevel the indentation level + * @param firstLineMatches whether or not the first line has to match + * @param firstLine firstline of whole expression */ - private void checkLinesIndent(LineSet aLines, - IndentLevel aIndentLevel, - boolean aFirstLineMatches, - int aFirstLine) + private void checkLinesIndent(LineSet lines, + IndentLevel indentLevel, + boolean firstLineMatches, + int firstLine) { - if (aLines.isEmpty()) { + if (lines.isEmpty()) { return; } // check first line - final int startLine = aLines.firstLine(); - final int endLine = aLines.lastLine(); - final int startCol = aLines.firstLineCol(); + final int startLine = lines.firstLine(); + final int endLine = lines.lastLine(); + final int startCol = lines.firstLineCol(); final int realStartCol = - getLineStart(mIndentCheck.getLine(startLine - 1)); + getLineStart(indentCheck.getLine(startLine - 1)); if (realStartCol == startCol) { - checkSingleLine(startLine, startCol, aIndentLevel, - aFirstLineMatches); + checkSingleLine(startLine, startCol, indentLevel, + firstLineMatches); } // if first line starts the line, following lines are indented @@ -290,16 +290,16 @@ public abstract class ExpressionHandler // doesn't start the line) then don't indent more, the first // indentation is absorbed by the nesting - IndentLevel theLevel = aIndentLevel; - if (aFirstLineMatches - || ((aFirstLine > mMainAst.getLineNo()) && shouldIncreaseIndent())) + IndentLevel theLevel = indentLevel; + if (firstLineMatches + || ((firstLine > mainAst.getLineNo()) && shouldIncreaseIndent())) { - theLevel = new IndentLevel(aIndentLevel, getBasicOffset()); + theLevel = new IndentLevel(indentLevel, getBasicOffset()); } // check following lines for (int i = startLine + 1; i <= endLine; i++) { - final Integer col = aLines.getStartColumn(i); + final Integer col = lines.getStartColumn(i); // startCol could be null if this line didn't have an // expression that was required to be checked (it could be // checked by a child expression) @@ -313,58 +313,58 @@ public abstract class ExpressionHandler /** * Check the indent level for a single line. * - * @param aLineNum the line number to check - * @param aIndentLevel the required indent level + * @param lineNum the line number to check + * @param indentLevel the required indent level */ - private void checkSingleLine(int aLineNum, IndentLevel aIndentLevel) + private void checkSingleLine(int lineNum, IndentLevel indentLevel) { - final String line = mIndentCheck.getLine(aLineNum - 1); + final String line = indentCheck.getLine(lineNum - 1); final int start = getLineStart(line); - if (aIndentLevel.gt(start)) { - logChildError(aLineNum, start, aIndentLevel); + if (indentLevel.gt(start)) { + logChildError(lineNum, start, indentLevel); } } /** * Check the indentation for a single line. * - * @param aLineNum the number of the line to check - * @param aColNum the column number we are starting at - * @param aIndentLevel the indentation level - * @param aMustMatch whether or not the indentation level must match + * @param lineNum the number of the line to check + * @param colNum the column number we are starting at + * @param indentLevel the indentation level + * @param mustMatch whether or not the indentation level must match */ - private void checkSingleLine(int aLineNum, int aColNum, - IndentLevel aIndentLevel, boolean aMustMatch) + private void checkSingleLine(int lineNum, int colNum, + IndentLevel indentLevel, boolean mustMatch) { - final String line = mIndentCheck.getLine(aLineNum - 1); + final String line = indentCheck.getLine(lineNum - 1); final int start = getLineStart(line); // if must match is set, it is an error if the line start is not // at the correct indention level; otherwise, it is an only an // error if this statement starts the line and it is less than // the correct indentation level - if (aMustMatch ? !aIndentLevel.accept(start) - : (aColNum == start) && aIndentLevel.gt(start)) + if (mustMatch ? !indentLevel.accept(start) + : (colNum == start) && indentLevel.gt(start)) { - logChildError(aLineNum, start, aIndentLevel); + logChildError(lineNum, start, indentLevel); } } /** * Get the start of the specified line. * - * @param aLine the specified line number + * @param line the specified line number * * @return the start of the specified line */ - protected final int getLineStart(String aLine) + protected final int getLineStart(String line) { - for (int start = 0; start < aLine.length(); start++) { - final char c = aLine.charAt(start); + for (int start = 0; start < line.length(); start++) { + final char c = line.charAt(start); if (!Character.isWhitespace(c)) { return Utils.lengthExpandedTabs( - aLine, start, mIndentCheck.getIndentationTabWidth()); + line, start, indentCheck.getIndentationTabWidth()); } } return 0; @@ -374,26 +374,26 @@ public abstract class ExpressionHandler * Check the indent level of the children of the specified parent * expression. * - * @param aParent the parent whose children we are checking - * @param aTokenTypes the token types to check - * @param aStartLevel the starting indent level - * @param aFirstLineMatches whether or not the first line needs to match - * @param aAllowNesting whether or not nested children are allowed + * @param parent the parent whose children we are checking + * @param tokenTypes the token types to check + * @param startLevel the starting indent level + * @param firstLineMatches whether or not the first line needs to match + * @param allowNesting whether or not nested children are allowed */ - protected final void checkChildren(DetailAST aParent, - int[] aTokenTypes, - IndentLevel aStartLevel, - boolean aFirstLineMatches, - boolean aAllowNesting) + protected final void checkChildren(DetailAST parent, + int[] tokenTypes, + IndentLevel startLevel, + boolean firstLineMatches, + boolean allowNesting) { - Arrays.sort(aTokenTypes); - for (DetailAST child = aParent.getFirstChild(); + Arrays.sort(tokenTypes); + for (DetailAST child = parent.getFirstChild(); child != null; child = child.getNextSibling()) { - if (Arrays.binarySearch(aTokenTypes, child.getType()) >= 0) { - checkExpressionSubtree(child, aStartLevel, - aFirstLineMatches, aAllowNesting); + if (Arrays.binarySearch(tokenTypes, child.getType()) >= 0) { + checkExpressionSubtree(child, startLevel, + firstLineMatches, allowNesting); } } } @@ -401,47 +401,47 @@ public abstract class ExpressionHandler /** * Check the indentation level for an expression subtree. * - * @param aTree the expression subtree to check - * @param aLevel the indentation level - * @param aFirstLineMatches whether or not the first line has to match - * @param aAllowNesting whether or not subtree nesting is allowed + * @param tree the expression subtree to check + * @param level the indentation level + * @param firstLineMatches whether or not the first line has to match + * @param allowNesting whether or not subtree nesting is allowed */ protected final void checkExpressionSubtree( - DetailAST aTree, - IndentLevel aLevel, - boolean aFirstLineMatches, - boolean aAllowNesting + DetailAST tree, + IndentLevel level, + boolean firstLineMatches, + boolean allowNesting ) { final LineSet subtreeLines = new LineSet(); - final int firstLine = getFirstLine(Integer.MAX_VALUE, aTree); - if (aFirstLineMatches && !aAllowNesting) { + final int firstLine = getFirstLine(Integer.MAX_VALUE, tree); + if (firstLineMatches && !allowNesting) { subtreeLines.addLineAndCol(firstLine, - getLineStart(mIndentCheck.getLine(firstLine - 1))); + getLineStart(indentCheck.getLine(firstLine - 1))); } - findSubtreeLines(subtreeLines, aTree, aAllowNesting); + findSubtreeLines(subtreeLines, tree, allowNesting); - checkLinesIndent(subtreeLines, aLevel, aFirstLineMatches, firstLine); + checkLinesIndent(subtreeLines, level, firstLineMatches, firstLine); } /** * Get the first line for a given expression. * - * @param aStartLine the line we are starting from - * @param aTree the expression to find the first line for + * @param startLine the line we are starting from + * @param tree the expression to find the first line for * * @return the first line of the expression */ - protected final int getFirstLine(int aStartLine, DetailAST aTree) + protected final int getFirstLine(int startLine, DetailAST tree) { - int realStart = aStartLine; - final int currLine = aTree.getLineNo(); + int realStart = startLine; + final int currLine = tree.getLineNo(); if (currLine < realStart) { realStart = currLine; } // check children - for (DetailAST node = aTree.getFirstChild(); + for (DetailAST node = tree.getFirstChild(); node != null; node = node.getNextSibling()) { @@ -455,49 +455,49 @@ public abstract class ExpressionHandler * Get the column number for the start of a given expression, expanding * tabs out into spaces in the process. * - * @param aAST the expression to find the start of + * @param ast the expression to find the start of * * @return the column number for the start of the expression */ - protected final int expandedTabsColumnNo(DetailAST aAST) + protected final int expandedTabsColumnNo(DetailAST ast) { final String line = - mIndentCheck.getLine(aAST.getLineNo() - 1); + indentCheck.getLine(ast.getLineNo() - 1); - return Utils.lengthExpandedTabs(line, aAST.getColumnNo(), - mIndentCheck.getIndentationTabWidth()); + return Utils.lengthExpandedTabs(line, ast.getColumnNo(), + indentCheck.getIndentationTabWidth()); } /** * Find the set of lines for a given subtree. * - * @param aLines the set of lines to add to - * @param aTree the subtree to examine - * @param aAllowNesting whether or not to allow nested subtrees + * @param lines the set of lines to add to + * @param tree the subtree to examine + * @param allowNesting whether or not to allow nested subtrees */ - protected final void findSubtreeLines(LineSet aLines, DetailAST aTree, - boolean aAllowNesting) + protected final void findSubtreeLines(LineSet lines, DetailAST tree, + boolean allowNesting) { - if (getIndentCheck().getHandlerFactory().isHandledType(aTree.getType()) - || (aTree.getLineNo() < 0)) + if (getIndentCheck().getHandlerFactory().isHandledType(tree.getType()) + || (tree.getLineNo() < 0)) { return; } - final int lineNum = aTree.getLineNo(); - final Integer colNum = aLines.getStartColumn(lineNum); + final int lineNum = tree.getLineNo(); + final Integer colNum = lines.getStartColumn(lineNum); - final int thisLineColumn = expandedTabsColumnNo(aTree); + final int thisLineColumn = expandedTabsColumnNo(tree); if ((colNum == null) || (thisLineColumn < colNum.intValue())) { - aLines.addLineAndCol(lineNum, thisLineColumn); + lines.addLineAndCol(lineNum, thisLineColumn); } // check children - for (DetailAST node = aTree.getFirstChild(); + for (DetailAST node = tree.getFirstChild(); node != null; node = node.getNextSibling()) { - findSubtreeLines(aLines, node, aAllowNesting); + findSubtreeLines(lines, node, allowNesting); } } @@ -507,7 +507,7 @@ public abstract class ExpressionHandler protected void checkModifiers() { final DetailAST modifiers = - mMainAst.findFirstToken(TokenTypes.MODIFIERS); + mainAst.findFirstToken(TokenTypes.MODIFIERS); for (DetailAST modifier = modifiers.getFirstChild(); modifier != null; modifier = modifier.getNextSibling()) @@ -533,7 +533,7 @@ public abstract class ExpressionHandler */ protected final IndentationCheck getIndentCheck() { - return mIndentCheck; + return indentCheck; } /** @@ -543,7 +543,7 @@ public abstract class ExpressionHandler */ protected final DetailAST getMainAst() { - return mMainAst; + return mainAst; } /** @@ -553,7 +553,7 @@ public abstract class ExpressionHandler */ protected final ExpressionHandler getParent() { - return mParent; + return parent; } /** @@ -577,46 +577,46 @@ public abstract class ExpressionHandler /** * Check the indentation of the right parenthesis. - * @param aRparen parenthesis to check - * @param aLparen left parenthesis associated with aRparen + * @param rparen parenthesis to check + * @param lparen left parenthesis associated with aRparen */ - protected final void checkRParen(DetailAST aLparen, DetailAST aRparen) + protected final void checkRParen(DetailAST lparen, DetailAST rparen) { // no paren - no check :) - if (aRparen == null) { + if (rparen == null) { return; } // the rcurly can either be at the correct indentation, // or not first on the line ... - final int rparenLevel = expandedTabsColumnNo(aRparen); - if (getLevel().accept(rparenLevel) || !startsLine(aRparen)) { + final int rparenLevel = expandedTabsColumnNo(rparen); + if (getLevel().accept(rparenLevel) || !startsLine(rparen)) { return; } // or has + 1 indentation - final int lparenLevel = expandedTabsColumnNo(aLparen); + final int lparenLevel = expandedTabsColumnNo(lparen); if (rparenLevel == (lparenLevel + 1)) { return; } - logError(aRparen, "rparen", rparenLevel); + logError(rparen, "rparen", rparenLevel); } /** * Check the indentation of the left parenthesis. - * @param aLparen parenthesis to check + * @param lparen parenthesis to check */ - protected final void checkLParen(final DetailAST aLparen) + protected final void checkLParen(final DetailAST lparen) { // the rcurly can either be at the correct indentation, or on the // same line as the lcurly - if ((aLparen == null) - || getLevel().accept(expandedTabsColumnNo(aLparen)) - || !startsLine(aLparen)) + if ((lparen == null) + || getLevel().accept(expandedTabsColumnNo(lparen)) + || !startsLine(lparen)) { return; } - logError(aLparen, "lparen", expandedTabsColumnNo(aLparen)); + logError(lparen, "lparen", expandedTabsColumnNo(lparen)); } -} +} \ No newline at end of file diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java index e3e9849f5..342d4ccf6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java @@ -29,16 +29,16 @@ public class FinallyHandler extends BlockParentHandler { /** * Construct an instance of this handler with the given indentation check, - * abstract syntax tree, and parent handler. + * astract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the astract syntax tree + * @param parent the parent handler */ - public FinallyHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public FinallyHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "finally", aAst, aParent); + super(indentCheck, "finally", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java index 4a4d7fdae..38ca0de37 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java @@ -32,14 +32,14 @@ public class ForHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public ForHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public ForHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "for", aAst, aParent); + super(indentCheck, "for", ast, parent); } /** @@ -81,11 +81,11 @@ public class ForHandler extends BlockParentHandler } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { - if (aChild instanceof ElseHandler) { + if (child instanceof ElseHandler) { return getLevel(); } - return super.suggestedChildLevel(aChild); + return super.suggestedChildLevel(child); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java index c107709b0..db9324f4d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java @@ -42,36 +42,36 @@ public class HandlerFactory /** * Registered handlers. */ - private final Map> mTypeHandlers = + private final Map> typeHandlers = Maps.newHashMap(); /** * registers a handler * - * @param aType + * @param type * type from TokenTypes - * @param aHandlerClass + * @param handlerClass * the handler to register */ - private void register(int aType, Class aHandlerClass) + private void register(int type, Class handlerClass) { try { - final Constructor ctor = aHandlerClass + final Constructor ctor = handlerClass .getConstructor(new Class[] {IndentationCheck.class, DetailAST.class, // current AST ExpressionHandler.class, // parent }); - mTypeHandlers.put(aType, ctor); + typeHandlers.put(type, ctor); } ///CLOVER:OFF catch (final NoSuchMethodException e) { throw new RuntimeException("couldn't find ctor for " - + aHandlerClass); + + handlerClass); } catch (final SecurityException e) { - LOG.debug("couldn't find ctor for " + aHandlerClass, e); + LOG.debug("couldn't find ctor for " + handlerClass, e); throw new RuntimeException("couldn't find ctor for " - + aHandlerClass); + + handlerClass); } ///CLOVER:ON } @@ -112,13 +112,13 @@ public class HandlerFactory /** * Returns true if this type (form TokenTypes) is handled. * - * @param aType type from TokenTypes + * @param type type from TokenTypes * @return true if handler is registered, false otherwise */ - public boolean isHandledType(int aType) + public boolean isHandledType(int type) { - final Set typeSet = mTypeHandlers.keySet(); - return typeSet.contains(aType); + final Set typeSet = typeHandlers.keySet(); + return typeSet.contains(type); } /** @@ -128,7 +128,7 @@ public class HandlerFactory */ public int[] getHandledTypes() { - final Set typeSet = mTypeHandlers.keySet(); + final Set typeSet = typeHandlers.keySet(); final int[] types = new int[typeSet.size()]; int index = 0; for (final Integer val : typeSet) { @@ -141,52 +141,52 @@ public class HandlerFactory /** * Get the handler for an AST. * - * @param aIndentCheck the indentation check - * @param aAst ast to handle - * @param aParent the handler parent of this AST + * @param indentCheck the indentation check + * @param ast ast to handle + * @param parent the handler parent of this AST * - * @return the ExpressionHandler for aAst + * @return the ExpressionHandler for ast */ - public ExpressionHandler getHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public ExpressionHandler getHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { final ExpressionHandler handler = - mCreatedHandlers.get(aAst); + createdHandlers.get(ast); if (handler != null) { return handler; } - if (aAst.getType() == TokenTypes.METHOD_CALL) { - return createMethodCallHandler(aIndentCheck, aAst, aParent); + if (ast.getType() == TokenTypes.METHOD_CALL) { + return createMethodCallHandler(indentCheck, ast, parent); } ExpressionHandler expHandler = null; try { final Constructor handlerCtor = - mTypeHandlers.get(aAst.getType()); + typeHandlers.get(ast.getType()); if (handlerCtor != null) { expHandler = (ExpressionHandler) handlerCtor.newInstance( - aIndentCheck, aAst, aParent); + indentCheck, ast, parent); } } ///CLOVER:OFF catch (final InstantiationException e) { - LOG.debug("couldn't instantiate constructor for " + aAst, e); + LOG.debug("couldn't instantiate constructor for " + ast, e); throw new RuntimeException("couldn't instantiate constructor for " - + aAst); + + ast); } catch (final IllegalAccessException e) { - LOG.debug("couldn't access constructor for " + aAst, e); + LOG.debug("couldn't access constructor for " + ast, e); throw new RuntimeException("couldn't access constructor for " - + aAst); + + ast); } catch (final InvocationTargetException e) { - LOG.debug("couldn't instantiate constructor for " + aAst, e); + LOG.debug("couldn't instantiate constructor for " + ast, e); throw new RuntimeException("couldn't instantiate constructor for " - + aAst); + + ast); } if (expHandler == null) { - throw new RuntimeException("no handler for type " + aAst.getType()); + throw new RuntimeException("no handler for type " + ast.getType()); } ///CLOVER:ON return expHandler; @@ -195,34 +195,34 @@ public class HandlerFactory /** * Create new instance of handler for METHOD_CALL. * - * @param aIndentCheck the indentation check - * @param aAst ast to handle - * @param aParent the handler parent of this AST + * @param indentCheck the indentation check + * @param ast ast to handle + * @param parent the handler parent of this AST * * @return new instance. */ - ExpressionHandler createMethodCallHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + ExpressionHandler createMethodCallHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - ExpressionHandler theParent = aParent; - DetailAST ast = aAst.getFirstChild(); - while ((ast != null) && (ast.getType() == TokenTypes.DOT)) { - ast = ast.getFirstChild(); + ExpressionHandler theParent = parent; + DetailAST astNode = ast.getFirstChild(); + while ((astNode != null) && (astNode.getType() == TokenTypes.DOT)) { + astNode = astNode.getFirstChild(); } - if ((ast != null) && isHandledType(ast.getType())) { - theParent = getHandler(aIndentCheck, ast, theParent); - mCreatedHandlers.put(ast, theParent); + if ((astNode != null) && isHandledType(astNode.getType())) { + theParent = getHandler(indentCheck, astNode, theParent); + createdHandlers.put(astNode, theParent); } - return new MethodCallHandler(aIndentCheck, aAst, theParent); + return new MethodCallHandler(indentCheck, ast, theParent); } /** Clears cache of created handlers. */ void clearCreatedHandlers() { - mCreatedHandlers.clear(); + createdHandlers.clear(); } /** cache for created method call handlers */ - private final Map mCreatedHandlers = + private final Map createdHandlers = Maps.newHashMap(); -} +} \ No newline at end of file diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java index 1df6aead0..c3d4c5171 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java @@ -32,23 +32,23 @@ public class IfHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public IfHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public IfHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "if", aAst, aParent); + super(indentCheck, "if", ast, parent); } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { - if (aChild instanceof ElseHandler) { + if (child instanceof ElseHandler) { return getLevel(); } - return super.suggestedChildLevel(aChild); + return super.suggestedChildLevel(child); } @Override @@ -104,9 +104,9 @@ public class IfHandler extends BlockParentHandler final LineWrappingHandler lineWrap = new LineWrappingHandler(getIndentCheck(), getMainAst()) { @Override - public DetailAST findLastNode(DetailAST aFirstNode) + public DetailAST findLastNode(DetailAST firstNode) { - return aFirstNode.findFirstToken(TokenTypes.RPAREN); + return firstNode.findFirstToken(TokenTypes.RPAREN); } }; lineWrap.checkIndentation(); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java index 501d32347..70e8d6a0b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java @@ -32,14 +32,14 @@ public class ImportHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public ImportHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public ImportHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "import", aAst, aParent); + super(indentCheck, "import", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java index 8b0572a0e..15e636753 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java @@ -29,28 +29,28 @@ import java.util.BitSet; public class IndentLevel { /** set of acceptable indentation levels. */ - private final BitSet mLevels = new BitSet(); + private final BitSet levels = new BitSet(); /** * Creates new instance with one accaptable indentation level. - * @param aIndent accaptable indentation level. + * @param indent accaptable indentation level. */ - public IndentLevel(int aIndent) + public IndentLevel(int indent) { - mLevels.set(aIndent); + levels.set(indent); } /** * Creates new instance for nested structure. - * @param aBase parent's level - * @param aOffsets offsets from parent's level. + * @param base parent's level + * @param offsets offsets from parent's level. */ - public IndentLevel(IndentLevel aBase, int... aOffsets) + public IndentLevel(IndentLevel base, int... offsets) { - final BitSet src = aBase.mLevels; + final BitSet src = base.levels; for (int i = src.nextSetBit(0); i >= 0; i = src.nextSetBit(i + 1)) { - for (int offset : aOffsets) { - mLevels.set(i + offset); + for (int offset : offsets) { + levels.set(i + offset); } } } @@ -61,46 +61,46 @@ public class IndentLevel */ public final boolean isMultiLevel() { - return mLevels.cardinality() > 1; + return levels.cardinality() > 1; } /** * Checks if given indentation is acceptable. - * @param aIndent indentation to check. + * @param indent indentation to check. * @return true if given indentation is acceptable, * false otherwise. */ - public boolean accept(int aIndent) + public boolean accept(int indent) { - return mLevels.get(aIndent); + return levels.get(indent); } /** - * @param aIndent indentation to check. - * @return true if aIndent less then minimal of + * @param indent indentation to check. + * @return true if indent less then minimal of * acceptable indentation levels, false otherwise. */ - public boolean gt(int aIndent) + public boolean gt(int indent) { - return mLevels.nextSetBit(0) > aIndent; + return levels.nextSetBit(0) > indent; } /** * Adds one more acceptable indentation level. - * @param aIndent new acceptable indentation. + * @param indent new acceptable indentation. */ - public void addAcceptedIndent(int aIndent) + public void addAcceptedIndent(int indent) { - mLevels.set(aIndent); + levels.set(indent); } /** * Adds one more acceptable indentation level. - * @param aIndent new acceptable indentation. + * @param indent new acceptable indentation. */ - public void addAcceptedIndent(IndentLevel aIndent) + public void addAcceptedIndent(IndentLevel indent) { - mLevels.or(aIndent.mLevels); + levels.or(indent.levels); } /** @@ -109,7 +109,7 @@ public class IndentLevel */ public int getFirstIndentLevel() { - return mLevels.nextSetBit(0); + return levels.nextSetBit(0); } /** @@ -118,18 +118,18 @@ public class IndentLevel */ public int getLastIndentLevel() { - return mLevels.length() - 1; + return levels.length() - 1; } @Override public String toString() { - if (mLevels.cardinality() == 1) { - return String.valueOf(mLevels.nextSetBit(0)); + if (levels.cardinality() == 1) { + return String.valueOf(levels.nextSetBit(0)); } final StringBuilder sb = new StringBuilder(); - for (int i = mLevels.nextSetBit(0); i >= 0; - i = mLevels.nextSetBit(i + 1)) + for (int i = levels.nextSetBit(0); i >= 0; + i = levels.nextSetBit(i + 1)) { if (sb.length() > 0) { sb.append(", "); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java index 00c7e19ac..c4064af74 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java @@ -68,7 +68,7 @@ import com.puppycrawl.tools.checkstyle.api.FastStack; * Basically, this check requests visitation for all handled token * types (those tokens registered in the HandlerFactory). When visitToken * is called, a new ExpressionHandler is created for the AST and pushed - * onto the mHandlers stack. The new handler then checks the indentation + * onto the handlers stack. The new handler then checks the indentation * for the currently visiting AST. When leaveToken is called, the * ExpressionHandler is popped from the stack. *

@@ -110,36 +110,36 @@ public class IndentationCheck extends Check private static final int DEFAULT_INDENTATION = 4; /** how many tabs or spaces to use */ - private int mBasicOffset = DEFAULT_INDENTATION; + private int basicOffset = DEFAULT_INDENTATION; /** how much to indent a case label */ - private int mCaseIndentationAmount = DEFAULT_INDENTATION; + private int caseIndentationAmount = DEFAULT_INDENTATION; /** how far brace should be indented when on next line */ - private int mBraceAdjustment; + private int braceAdjustment; /** how far throws should be indented when on next line */ - private int mThrowsIndentationAmount = DEFAULT_INDENTATION; + private int throwsIndentationAmount = DEFAULT_INDENTATION; /** how much to indent an array initialization when on next line */ - private int mArrayInitIndentationAmount = DEFAULT_INDENTATION; + private int arrayInitIndentationAmount = DEFAULT_INDENTATION; /** how far continuation line should be indented when line-wrapping is present */ - private int mLineWrappingIndentation = DEFAULT_INDENTATION; + private int lineWrappingIndentation = DEFAULT_INDENTATION; /** * Force strict condition in line wrapping case. If value is true, line wrap indent * have to be same as lineWrappingIndentation parameter, if value is false, line wrap indent - * have to be not less than mLineWrappingIndentation parameter. + * have to be not less than lineWrappingIndentation parameter. */ - private boolean mForceStrictCondition; + private boolean forceStrictCondition; /** handlers currently in use */ - private final FastStack mHandlers = + private final FastStack handlers = FastStack.newInstance(); /** factory from which handlers are distributed */ - private final HandlerFactory mHandlerFactory = new HandlerFactory(); + private final HandlerFactory handlerFactory = new HandlerFactory(); /** Creates a new instance of IndentationCheck. */ public IndentationCheck() @@ -148,30 +148,30 @@ public class IndentationCheck extends Check /** * Get forcing strict condition. - * @return mForceStrictCondition value. + * @return forceStrictCondition value. */ public boolean getForceStrictCondition() { - return mForceStrictCondition; + return forceStrictCondition; } /** * Set forcing strict condition. - * @param aValue user's value of mForceStrictCondition. + * @param value user's value of forceStrictCondition. */ - public void setForceStrictCondition(boolean aValue) + public void setForceStrictCondition(boolean value) { - mForceStrictCondition = aValue; + forceStrictCondition = value; } /** * Set the basic offset. * - * @param aBasicOffset the number of tabs or spaces to indent + * @param basicOffset the number of tabs or spaces to indent */ - public void setBasicOffset(int aBasicOffset) + public void setBasicOffset(int basicOffset) { - mBasicOffset = aBasicOffset; + this.basicOffset = basicOffset; } /** @@ -181,17 +181,17 @@ public class IndentationCheck extends Check */ public int getBasicOffset() { - return mBasicOffset; + return basicOffset; } /** * Adjusts brace indentation (positive offset). * - * @param aAdjustmentAmount the brace offset + * @param adjustmentAmount the brace offset */ - public void setBraceAdjustment(int aAdjustmentAmount) + public void setBraceAdjustment(int adjustmentAmount) { - mBraceAdjustment = aAdjustmentAmount; + braceAdjustment = adjustmentAmount; } /** @@ -201,17 +201,17 @@ public class IndentationCheck extends Check */ public int getBraceAdjustement() { - return mBraceAdjustment; + return braceAdjustment; } /** * Set the case indentation level. * - * @param aAmount the case indentation level + * @param amount the case indentation level */ - public void setCaseIndent(int aAmount) + public void setCaseIndent(int amount) { - mCaseIndentationAmount = aAmount; + caseIndentationAmount = amount; } /** @@ -221,17 +221,17 @@ public class IndentationCheck extends Check */ public int getCaseIndent() { - return mCaseIndentationAmount; + return caseIndentationAmount; } /** * Set the throws indentation level. * - * @param aThrowsIndent the throws indentation level + * @param throwsIndent the throws indentation level */ - public void setThrowsIndent(int aThrowsIndent) + public void setThrowsIndent(int throwsIndent) { - mThrowsIndentationAmount = aThrowsIndent; + throwsIndentationAmount = throwsIndent; } /** @@ -241,17 +241,17 @@ public class IndentationCheck extends Check */ public int getThrowsIndent() { - return this.mThrowsIndentationAmount; + return this.throwsIndentationAmount; } /** * Set the array initialisation indentation level. * - * @param aArrayInitIndent the array initialisation indentation level + * @param arrayInitIndent the array initialisation indentation level */ - public void setArrayInitIndent(int aArrayInitIndent) + public void setArrayInitIndent(int arrayInitIndent) { - mArrayInitIndentationAmount = aArrayInitIndent; + arrayInitIndentationAmount = arrayInitIndent; } /** @@ -261,7 +261,7 @@ public class IndentationCheck extends Check */ public int getArrayInitIndent() { - return this.mArrayInitIndentationAmount; + return this.arrayInitIndentationAmount; } /** @@ -271,32 +271,32 @@ public class IndentationCheck extends Check */ public int getLineWrappingIndentation() { - return mLineWrappingIndentation; + return lineWrappingIndentation; } /** * Set the line-wrapping indentation level. * - * @param aLineWrappingIndentation the line-wrapping indentation level + * @param lineWrappingIndentation the line-wrapping indentation level */ - public void setLineWrappingIndentation(int aLineWrappingIndentation) + public void setLineWrappingIndentation(int lineWrappingIndentation) { - mLineWrappingIndentation = aLineWrappingIndentation; + this.lineWrappingIndentation = lineWrappingIndentation; } /** * Log an error message. * - * @param aLine the line number where the error was found - * @param aKey the message that describes the error - * @param aArgs the details of the message + * @param line the line number where the error was found + * @param key the message that describes the error + * @param args the details of the message * * @see java.text.MessageFormat */ - public void indentationLog(int aLine, String aKey, Object... aArgs) + public void indentationLog(int line, String key, Object... args) { - super.log(aLine, aKey, aArgs); + super.log(line, key, args); } /** @@ -312,23 +312,23 @@ public class IndentationCheck extends Check @Override public int[] getDefaultTokens() { - return mHandlerFactory.getHandledTypes(); + return handlerFactory.getHandledTypes(); } @Override - public void beginTree(DetailAST aAst) + public void beginTree(DetailAST ast) { - mHandlerFactory.clearCreatedHandlers(); - mHandlers.clear(); - mHandlers.push(new PrimordialHandler(this)); + handlerFactory.clearCreatedHandlers(); + handlers.clear(); + handlers.push(new PrimordialHandler(this)); } @Override - public void visitToken(DetailAST aAST) + public void visitToken(DetailAST ast) { - final ExpressionHandler handler = mHandlerFactory.getHandler(this, aAST, - mHandlers.peek()); - mHandlers.push(handler); + final ExpressionHandler handler = handlerFactory.getHandler(this, ast, + handlers.peek()); + handlers.push(handler); try { handler.checkIndentation(); } @@ -338,9 +338,9 @@ public class IndentationCheck extends Check } @Override - public void leaveToken(DetailAST aAST) + public void leaveToken(DetailAST ast) { - mHandlers.pop(); + handlers.pop(); } /** @@ -350,6 +350,6 @@ public class IndentationCheck extends Check */ final HandlerFactory getHandlerFactory() { - return mHandlerFactory; + return handlerFactory; } -} +} \ No newline at end of file diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java index 56fc4ee7a..1233980ac 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java @@ -32,15 +32,15 @@ public class IndexHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAST the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public IndexHandler(IndentationCheck aIndentCheck, - DetailAST aAST, - ExpressionHandler aParent) + public IndexHandler(IndentationCheck indentCheck, + DetailAST ast, + ExpressionHandler parent) { - super(aIndentCheck, "index op", aAST, aParent); + super(indentCheck, "index op", ast, parent); } @Override @@ -50,7 +50,7 @@ public class IndexHandler extends ExpressionHandler } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { return getLevel(); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java index 441ef5dbf..d3424f5dc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java @@ -39,14 +39,14 @@ public class LabelHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aExpr the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param expr the abstract syntax tree + * @param parent the parent handler */ - public LabelHandler(IndentationCheck aIndentCheck, - DetailAST aExpr, ExpressionHandler aParent) + public LabelHandler(IndentationCheck indentCheck, + DetailAST expr, ExpressionHandler parent) { - super(aIndentCheck, "label", aExpr, aParent); + super(indentCheck, "label", expr, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineSet.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineSet.java index dec001623..fdc15f75e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineSet.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineSet.java @@ -31,18 +31,18 @@ public class LineSet /** * Maps line numbers to their start column. */ - private final SortedMap mLines = Maps.newTreeMap(); + private final SortedMap lines = Maps.newTreeMap(); /** * Get the starting column for a given line number. * - * @param aLineNum the specified line number + * @param lineNum the specified line number * * @return the starting column for the given line number */ - public Integer getStartColumn(Integer aLineNum) + public Integer getStartColumn(Integer lineNum) { - return mLines.get(aLineNum); + return lines.get(lineNum); } /** @@ -52,8 +52,8 @@ public class LineSet */ public int firstLineCol() { - final Object firstLineKey = mLines.firstKey(); - return (mLines.get(firstLineKey)).intValue(); + final Object firstLineKey = lines.firstKey(); + return (lines.get(firstLineKey)).intValue(); } /** @@ -63,7 +63,7 @@ public class LineSet */ public int firstLine() { - return (mLines.firstKey()).intValue(); + return (lines.firstKey()).intValue(); } /** @@ -73,18 +73,18 @@ public class LineSet */ public int lastLine() { - return (mLines.lastKey()).intValue(); + return (lines.lastKey()).intValue(); } /** * Add a line to this set of lines. * - * @param aLineNum the line to add - * @param aCol the starting column of the new line + * @param lineNum the line to add + * @param col the starting column of the new line */ - public void addLineAndCol(int aLineNum, int aCol) + public void addLineAndCol(int lineNum, int col) { - mLines.put(aLineNum, aCol); + lines.put(lineNum, col); } /** @@ -94,7 +94,7 @@ public class LineSet */ public boolean isEmpty() { - return mLines.isEmpty(); + return lines.isEmpty(); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java index d06875ae5..2e93d7ed9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java @@ -42,54 +42,54 @@ public class LineWrappingHandler * handler. This field used to get access to private fields of * IndentationCheck instance. */ - private final IndentationCheck mIndentCheck; + private final IndentationCheck indentCheck; /** * Root node for current expression. */ - private DetailAST mFirstNode; + private DetailAST firstNode; /** * Last node for current expression. */ - private DetailAST mLastNode; + private DetailAST lastNode; /** * User's value of line wrapping indentation. */ - private int mIndentLevel; + private int indentLevel; /** * Force strict condition in line wrapping case. */ - private boolean mForceStrictCondition; + private boolean forceStrictCondition; /** * Sets values of class field, finds last node and calculates indentation level. * - * @param aInstance + * @param instance * instance of IndentationCheck. - * @param aFirstNode + * @param firstNode * root node for current expression.. */ - public LineWrappingHandler(IndentationCheck aInstance, DetailAST aFirstNode) + public LineWrappingHandler(IndentationCheck instance, DetailAST firstNode) { - mIndentCheck = aInstance; - mFirstNode = aFirstNode; - mLastNode = findLastNode(mFirstNode); - mIndentLevel = mIndentCheck.getLineWrappingIndentation(); - mForceStrictCondition = mIndentCheck.getForceStrictCondition(); + indentCheck = instance; + this.firstNode = firstNode; + lastNode = findLastNode(firstNode); + indentLevel = indentCheck.getLineWrappingIndentation(); + forceStrictCondition = indentCheck.getForceStrictCondition(); } /** * Finds last node of AST subtree. * - * @param aFirstNode the first node of expression or definition. + * @param firstNode the first node of expression or definition. * @return last node. */ - public DetailAST findLastNode(DetailAST aFirstNode) + public DetailAST findLastNode(DetailAST firstNode) { - return aFirstNode.getLastChild().getPreviousSibling(); + return firstNode.getLastChild().getPreviousSibling(); } /** @@ -97,24 +97,24 @@ public class LineWrappingHandler */ public int getCurrentIndentation() { - return mFirstNode.getColumnNo() + mIndentLevel; + return firstNode.getColumnNo() + indentLevel; } // Getters for private fields. public final DetailAST getFirstNode() { - return mFirstNode; + return firstNode; } public final DetailAST getLastNode() { - return mLastNode; + return lastNode; } public final int getIndentLevel() { - return mIndentLevel; + return indentLevel; } /** @@ -132,7 +132,7 @@ public class LineWrappingHandler // First node should be removed because it was already checked before. firstNodesOnLines.remove(firstNodesOnLines.firstKey()); final int firstNodeIndent = getFirstNodeIndent(firstNode); - final int currentIndent = firstNodeIndent + mIndentLevel; + final int currentIndent = firstNodeIndent + indentLevel; for (DetailAST node : firstNodesOnLines.values()) { final int currentType = node.getType(); @@ -159,27 +159,27 @@ public class LineWrappingHandler /** * Calculates indentation of first node. * - * @param aNode + * @param node * first node. * @return indentation of first node. */ - private int getFirstNodeIndent(DetailAST aNode) + private int getFirstNodeIndent(DetailAST node) { - int indentLevel = aNode.getColumnNo(); + int indentLevel = node.getColumnNo(); - if (aNode.getType() == TokenTypes.LITERAL_IF - && aNode.getParent().getType() == TokenTypes.LITERAL_ELSE) + if (node.getType() == TokenTypes.LITERAL_IF + && node.getParent().getType() == TokenTypes.LITERAL_ELSE) { - final DetailAST lcurly = aNode.getParent().getPreviousSibling(); + final DetailAST lcurly = node.getParent().getPreviousSibling(); final DetailAST rcurly = lcurly.getLastChild(); if (lcurly.getType() == TokenTypes.SLIST - && rcurly.getLineNo() == aNode.getLineNo()) + && rcurly.getLineNo() == node.getLineNo()) { indentLevel = rcurly.getColumnNo(); } else { - indentLevel = aNode.getParent().getColumnNo(); + indentLevel = node.getParent().getColumnNo(); } } return indentLevel; @@ -195,10 +195,10 @@ public class LineWrappingHandler { final NavigableMap result = new TreeMap(); - result.put(mFirstNode.getLineNo(), mFirstNode); - DetailAST curNode = mFirstNode.getFirstChild(); + result.put(firstNode.getLineNo(), firstNode); + DetailAST curNode = firstNode.getFirstChild(); - while (curNode != null && curNode != mLastNode) { + while (curNode != null && curNode != lastNode) { if (curNode.getType() == TokenTypes.OBJBLOCK) { curNode = curNode.getNextSibling(); @@ -222,13 +222,13 @@ public class LineWrappingHandler /** * Returns next curNode node. * - * @param aCurNode current node. + * @param curNode current node. * @return next curNode node. */ - private DetailAST getNextCurNode(DetailAST aCurNode) + private DetailAST getNextCurNode(DetailAST curNode) { - DetailAST nodeToVisit = aCurNode.getFirstChild(); - DetailAST currentNode = aCurNode; + DetailAST nodeToVisit = curNode.getFirstChild(); + DetailAST currentNode = curNode; while ((currentNode != null) && (nodeToVisit == null)) { nodeToVisit = currentNode.getNextSibling(); @@ -242,22 +242,22 @@ public class LineWrappingHandler /** * Checks line wrapping into annotations. * - * @param aAtNode at-clause node. - * @param aFirstNodesOnLines map which contains + * @param atNode at-clause node. + * @param firstNodesOnLines map which contains * first nodes as values and line numbers as keys. */ - private void checkAnnotationIndentation(DetailAST aAtNode, - NavigableMap aFirstNodesOnLines) + private void checkAnnotationIndentation(DetailAST atNode, + NavigableMap firstNodesOnLines) { - final int currentIndent = aAtNode.getColumnNo() + mIndentLevel; - final int firstNodeIndent = aAtNode.getColumnNo(); - final Collection values = aFirstNodesOnLines.values(); - final DetailAST lastAnnotationNode = getLastAnnotationNode(aAtNode); + final int currentIndent = atNode.getColumnNo() + indentLevel; + final int firstNodeIndent = atNode.getColumnNo(); + final Collection values = firstNodesOnLines.values(); + final DetailAST lastAnnotationNode = getLastAnnotationNode(atNode); final int lastAnnotationLine = lastAnnotationNode.getLineNo(); final int lastAnnotattionColumn = lastAnnotationNode.getColumnNo(); final Iterator itr = values.iterator(); - while (itr.hasNext() && aFirstNodesOnLines.size() > 1) { + while (itr.hasNext() && firstNodesOnLines.size() > 1) { final DetailAST node = itr.next(); if (node.getLineNo() < lastAnnotationLine @@ -283,12 +283,12 @@ public class LineWrappingHandler /** * Finds and returns last annotation node. - * @param aAtNode first at-clause node. + * @param atNode first at-clause node. * @return last annotation node. */ - private DetailAST getLastAnnotationNode(DetailAST aAtNode) + private DetailAST getLastAnnotationNode(DetailAST atNode) { - DetailAST lastAnnotation = aAtNode.getParent(); + DetailAST lastAnnotation = atNode.getParent(); while (lastAnnotation.getNextSibling() != null && lastAnnotation.getNextSibling().getType() == TokenTypes.ANNOTATION) { @@ -300,25 +300,25 @@ public class LineWrappingHandler /** * Logs warning message if indentation is incorrect. * - * @param aCurrentNode + * @param currentNode * current node which probably invoked an error. - * @param aCurrentIndent + * @param currentIndent * correct indentation. */ - private void logWarningMessage(DetailAST aCurrentNode, int aCurrentIndent) + private void logWarningMessage(DetailAST currentNode, int currentIndent) { - if (mForceStrictCondition) { - if (aCurrentNode.getColumnNo() != aCurrentIndent) { - mIndentCheck.indentationLog(aCurrentNode.getLineNo(), - "indentation.error", aCurrentNode.getText(), - aCurrentNode.getColumnNo(), aCurrentIndent); + if (forceStrictCondition) { + if (currentNode.getColumnNo() != currentIndent) { + indentCheck.indentationLog(currentNode.getLineNo(), + "indentation.error", currentNode.getText(), + currentNode.getColumnNo(), currentIndent); } } else { - if (aCurrentNode.getColumnNo() < aCurrentIndent) { - mIndentCheck.indentationLog(aCurrentNode.getLineNo(), - "indentation.error", aCurrentNode.getText(), - aCurrentNode.getColumnNo(), aCurrentIndent); + if (currentNode.getColumnNo() < currentIndent) { + indentCheck.indentationLog(currentNode.getLineNo(), + "indentation.error", currentNode.getText(), + currentNode.getColumnNo(), currentIndent); } } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java index 64ae5f713..86f707706 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java @@ -32,14 +32,14 @@ public class MemberDefHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAST the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public MemberDefHandler(IndentationCheck aIndentCheck, - DetailAST aAST, ExpressionHandler aParent) + public MemberDefHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "member def", aAST, aParent); + super(indentCheck, "member def", ast, parent); } @Override @@ -55,7 +55,7 @@ public class MemberDefHandler extends ExpressionHandler final LineWrappingHandler lineWrap = new LineWrappingHandler(getIndentCheck(), getMainAst()) { @Override - public DetailAST findLastNode(DetailAST aFirstNode) + public DetailAST findLastNode(DetailAST firstNode) { DetailAST lastNode = getFirstNode().getLastChild(); if (lastNode.getType() != TokenTypes.SEMI) { @@ -70,7 +70,7 @@ public class MemberDefHandler extends ExpressionHandler } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { return getLevel(); } @@ -101,12 +101,12 @@ public class MemberDefHandler extends ExpressionHandler /** * Checks if variable_def node is array declaration. - * @param aVariableDef current variable_def. + * @param variableDef current variable_def. * @return true if variable_def node is array declaration. */ - private boolean isArrayDeclaration(DetailAST aVariableDef) + private boolean isArrayDeclaration(DetailAST variableDef) { - return aVariableDef.findFirstToken(TokenTypes.TYPE) + return variableDef.findFirstToken(TokenTypes.TYPE) .findFirstToken(TokenTypes.ARRAY_DECLARATOR) != null; } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java index 3131546df..5473261c4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java @@ -32,18 +32,18 @@ public class MethodCallHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAST the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public MethodCallHandler(IndentationCheck aIndentCheck, - DetailAST aAST, ExpressionHandler aParent) + public MethodCallHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, - aAST.getType() == TokenTypes.METHOD_CALL + super(indentCheck, + ast.getType() == TokenTypes.METHOD_CALL ? "method call" : "ctor call", - aAST, - aParent); + ast, + parent); } @Override @@ -106,30 +106,30 @@ public class MethodCallHandler extends ExpressionHandler /** * Get the first AST of the specified method call. * - * @param aAst + * @param ast * the method call * * @return the first AST of the specified method call */ - private DetailAST getFirstAst(DetailAST aAst) + private DetailAST getFirstAst(DetailAST ast) { // walk down the first child part of the dots that make up a method // call name - DetailAST ast = aAst.getFirstChild(); - while ((ast != null) && (ast.getType() == TokenTypes.DOT)) { - ast = ast.getFirstChild(); + DetailAST astNode = ast.getFirstChild(); + while ((astNode != null) && (astNode.getType() == TokenTypes.DOT)) { + astNode = astNode.getFirstChild(); } - if (ast == null) { - ast = aAst; + if (astNode == null) { + astNode = ast; } - return ast; + return astNode; } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { // for whatever reason a method that crosses lines, like asList // here: @@ -139,7 +139,7 @@ public class MethodCallHandler extends ExpressionHandler final DetailAST first = getMainAst().getFirstChild(); int indentLevel = getLineStart(first); - if (!areOnSameLine(aChild.getMainAst().getFirstChild(), + if (!areOnSameLine(child.getMainAst().getFirstChild(), getMainAst().getFirstChild())) { indentLevel += getBasicOffset(); @@ -176,7 +176,7 @@ public class MethodCallHandler extends ExpressionHandler final LineWrappingHandler lineWrap = new LineWrappingHandler(getIndentCheck(), getMainAst()) { @Override - public DetailAST findLastNode(DetailAST aFirstNode) + public DetailAST findLastNode(DetailAST firstNode) { DetailAST lastNode; if (getFirstNode().getNextSibling() == null) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java index c4fd64be8..b0e1edc44 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java @@ -33,15 +33,15 @@ public class MethodDefHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public MethodDefHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public MethodDefHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, (aAst.getType() == TokenTypes.CTOR_DEF) - ? "ctor def" : "method def", aAst, aParent); + super(indentCheck, (ast.getType() == TokenTypes.CTOR_DEF) + ? "ctor def" : "method def", ast, parent); } @Override @@ -70,9 +70,9 @@ public class MethodDefHandler extends BlockParentHandler final LineWrappingHandler lineWrap = new LineWrappingHandler(getIndentCheck(), getMainAst()) { @Override - public DetailAST findLastNode(DetailAST aFirstNode) + public DetailAST findLastNode(DetailAST firstNode) { - return aFirstNode.getLastChild().getPreviousSibling(); + return firstNode.getLastChild().getPreviousSibling(); } }; lineWrap.checkIndentation(); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java index 60e18a4f7..4bc24ac09 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java @@ -32,15 +32,15 @@ public class NewHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAST the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public NewHandler(IndentationCheck aIndentCheck, - DetailAST aAST, - ExpressionHandler aParent) + public NewHandler(IndentationCheck indentCheck, + DetailAST ast, + ExpressionHandler parent) { - super(aIndentCheck, "operator new", aAST, aParent); + super(indentCheck, "operator new", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java index 74dd5e86e..6871be6ec 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java @@ -32,14 +32,14 @@ public class ObjectBlockHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public ObjectBlockHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public ObjectBlockHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "object def", aAst, aParent); + super(indentCheck, "object def", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java index f46fe05b1..36bf63ed7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java @@ -32,14 +32,14 @@ public class PackageDefHandler extends ExpressionHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public PackageDefHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public PackageDefHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "package def", aAst, aParent); + super(indentCheck, "package def", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java index 4aa2431a7..a8f0e664d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java @@ -28,11 +28,11 @@ public class PrimordialHandler extends ExpressionHandler /** * Construct an instance of this handler with the given indentation check. * - * @param aIndentCheck the indentation check + * @param indentCheck the indentation check */ - public PrimordialHandler(IndentationCheck aIndentCheck) + public PrimordialHandler(IndentationCheck indentCheck) { - super(aIndentCheck, null, null, null); + super(indentCheck, null, null, null); } @Override @@ -42,7 +42,7 @@ public class PrimordialHandler extends ExpressionHandler } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { return new IndentLevel(0); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java index 70a844d4f..7aa3688fe 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java @@ -32,18 +32,18 @@ public class SlistHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public SlistHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public SlistHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "block", aAst, aParent); + super(indentCheck, "block", ast, parent); } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { // this is: // switch (var) { @@ -58,11 +58,11 @@ public class SlistHandler extends BlockParentHandler if (((getParent() instanceof BlockParentHandler) && !(getParent() instanceof SlistHandler)) || ((getParent() instanceof CaseHandler) - && (aChild instanceof SlistHandler))) + && (child instanceof SlistHandler))) { - return getParent().suggestedChildLevel(aChild); + return getParent().suggestedChildLevel(child); } - return super.suggestedChildLevel(aChild); + return super.suggestedChildLevel(child); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java index a0bc22c4d..c3242e944 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java @@ -31,14 +31,14 @@ public class StaticInitHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public StaticInitHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public StaticInitHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "static initialization", aAst, aParent); + super(indentCheck, "static initialization", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java index d23022f65..93de71765 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java @@ -32,14 +32,14 @@ public class SwitchHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public SwitchHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public SwitchHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "switch", aAst, aParent); + super(indentCheck, "switch", ast, parent); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java index 8f818d662..4d198c9e2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java @@ -31,24 +31,24 @@ public class TryHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public TryHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public TryHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "try", aAst, aParent); + super(indentCheck, "try", ast, parent); } @Override - public IndentLevel suggestedChildLevel(ExpressionHandler aChild) + public IndentLevel suggestedChildLevel(ExpressionHandler child) { - if ((aChild instanceof CatchHandler) - || (aChild instanceof FinallyHandler)) + if ((child instanceof CatchHandler) + || (child instanceof FinallyHandler)) { return getLevel(); } - return super.suggestedChildLevel(aChild); + return super.suggestedChildLevel(child); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java index 329d6e756..63ca929b4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java @@ -32,14 +32,14 @@ public class WhileHandler extends BlockParentHandler * Construct an instance of this handler with the given indentation check, * abstract syntax tree, and parent handler. * - * @param aIndentCheck the indentation check - * @param aAst the abstract syntax tree - * @param aParent the parent handler + * @param indentCheck the indentation check + * @param ast the abstract syntax tree + * @param parent the parent handler */ - public WhileHandler(IndentationCheck aIndentCheck, - DetailAST aAst, ExpressionHandler aParent) + public WhileHandler(IndentationCheck indentCheck, + DetailAST ast, ExpressionHandler parent) { - super(aIndentCheck, "while", aAst, aParent); + super(indentCheck, "while", ast, parent); } /**