diff --git a/config/checkstyle_checks.xml b/config/checkstyle_checks.xml index ae8d0490e..f8c86425a 100644 --- a/config/checkstyle_checks.xml +++ b/config/checkstyle_checks.xml @@ -337,7 +337,7 @@ - + diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessages.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessages.java index ac694a677..d6ee8f781 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessages.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessages.java @@ -47,10 +47,10 @@ public final class LocalizedMessages { /** * Logs a message to be reported. - * @param aMsg the message to log + * @param message the message to log **/ - public void add(LocalizedMessage aMsg) { - messages.add(aMsg); + public void add(LocalizedMessage message) { + messages.add(message); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java index 3610f4fcc..fff37eb5f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java @@ -401,14 +401,14 @@ public class TranslationCheck /** * Helper method to log an io exception. - * @param ex the exception that occurred + * @param exception the exception that occurred * @param file the file that could not be processed */ - private void logIoException(IOException ex, File file) { + private void logIoException(IOException exception, File file) { String[] args = null; String key = "general.fileNotFound"; - if (!(ex instanceof FileNotFoundException)) { - args = new String[] {ex.getMessage()}; + if (!(exception instanceof FileNotFoundException)) { + args = new String[] {exception.getMessage()}; key = "general.exception"; } final LocalizedMessage message = @@ -422,7 +422,7 @@ public class TranslationCheck final SortedSet messages = Sets.newTreeSet(); messages.add(message); getMessageDispatcher().fireErrors(file.getPath(), messages); - LOG.debug("IOException occurred.", ex); + LOG.debug("IOException occurred.", exception); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractComplexityCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractComplexityCheck.java index 6534e6e6b..d9ae0fe24 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractComplexityCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractComplexityCheck.java @@ -145,10 +145,10 @@ public abstract class AbstractComplexityCheck /** * Increments the current value by a specified amount. * - * @param by the amount to increment by + * @param amount the amount to increment by */ - protected final void incrementCurrentValue(BigInteger by) { - currentValue = currentValue.add(by); + protected final void incrementCurrentValue(BigInteger amount) { + currentValue = currentValue.add(amount); } /** Push the current value on the stack. */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java index dfee755db..e5c7cd393 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java @@ -201,10 +201,10 @@ public class CyclomaticComplexityCheck /** * Increments the current value by a specified amount. * - * @param by the amount to increment by + * @param amount the amount to increment by */ - protected final void incrementCurrentValue(BigInteger by) { - currentValue = currentValue.add(by); + protected final void incrementCurrentValue(BigInteger amount) { + currentValue = currentValue.add(amount); } /** Push the current value on the stack. */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtils.java index 98513a41d..203256665 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtils.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtils.java @@ -62,12 +62,12 @@ public final class ScopeUtils { /** * Returns the scope of the surrounding "block". - * @param aAST the node to return the scope for + * @param node the node to return the scope for * @return the Scope of the surrounding block */ - public static Scope getSurroundingScope(DetailAST aAST) { + public static Scope getSurroundingScope(DetailAST node) { Scope returnValue = null; - for (DetailAST token = aAST.getParent(); + for (DetailAST token = node.getParent(); token != null; token = token.getParent()) { final int type = token.getType(); @@ -95,14 +95,14 @@ public final class ScopeUtils { /** * Returns whether a node is directly contained within an interface block. * - * @param aAST the node to check if directly contained within an interface block. + * @param node the node to check if directly contained within an interface block. * @return a {@code boolean} value */ - public static boolean isInInterfaceBlock(DetailAST aAST) { + public static boolean isInInterfaceBlock(DetailAST node) { boolean returnValue = false; // Loop up looking for a containing interface block - for (DetailAST token = aAST.getParent(); + for (DetailAST token = node.getParent(); token != null && !returnValue; token = token.getParent()) { @@ -125,14 +125,14 @@ public final class ScopeUtils { /** * Returns whether a node is directly contained within an annotation block. * - * @param aAST the node to check if directly contained within an annotation block. + * @param node the node to check if directly contained within an annotation block. * @return a {@code boolean} value */ - public static boolean isInAnnotationBlock(DetailAST aAST) { + public static boolean isInAnnotationBlock(DetailAST node) { boolean returnValue = false; // Loop up looking for a containing interface block - for (DetailAST token = aAST.getParent(); + for (DetailAST token = node.getParent(); token != null && !returnValue; token = token.getParent()) { final int type = token.getType(); @@ -155,25 +155,25 @@ public final class ScopeUtils { * Returns whether a node is directly contained within an interface or * annotation block. * - * @param aAST the node to check if directly contained within an interface + * @param node the node to check if directly contained within an interface * or annotation block. * @return a {@code boolean} value */ - public static boolean isInInterfaceOrAnnotationBlock(DetailAST aAST) { - return isInInterfaceBlock(aAST) || isInAnnotationBlock(aAST); + public static boolean isInInterfaceOrAnnotationBlock(DetailAST node) { + return isInInterfaceBlock(node) || isInAnnotationBlock(node); } /** * Returns whether a node is directly contained within an enum block. * - * @param aAST the node to check if directly contained within an enum block. + * @param node the node to check if directly contained within an enum block. * @return a {@code boolean} value */ - public static boolean isInEnumBlock(DetailAST aAST) { + public static boolean isInEnumBlock(DetailAST node) { boolean returnValue = false; // Loop up looking for a containing interface block - for (DetailAST token = aAST.getParent(); + for (DetailAST token = node.getParent(); token != null && !returnValue; token = token.getParent()) { final int type = token.getType(); @@ -195,14 +195,14 @@ public final class ScopeUtils { * Returns whether the scope of a node is restricted to a code block. * A code block is a method or constructor body, or a initializer block. * - * @param aAST the node to check + * @param node the node to check * @return a {@code boolean} value */ - public static boolean isInCodeBlock(DetailAST aAST) { + public static boolean isInCodeBlock(DetailAST node) { boolean returnValue = false; // Loop up looking for a containing code block - for (DetailAST token = aAST.getParent(); + for (DetailAST token = node.getParent(); token != null; token = token.getParent()) { final int type = token.getType(); @@ -221,12 +221,12 @@ public final class ScopeUtils { /** * Returns whether a node is contained in the outer most type block. * - * @param aAST the node to check + * @param node the node to check * @return a {@code boolean} value */ - public static boolean isOuterMostType(DetailAST aAST) { + public static boolean isOuterMostType(DetailAST node) { boolean returnValue = true; - for (DetailAST parent = aAST.getParent(); + for (DetailAST parent = node.getParent(); parent != null; parent = parent.getParent()) { if (parent.getType() == TokenTypes.CLASS_DEF @@ -245,22 +245,22 @@ public final class ScopeUtils { * Determines whether a node is a local variable definition. * I.e. if it is declared in a code block, a for initializer, * or a catch parameter. - * @param aAST the node to check. + * @param node the node to check. * @return whether aAST is a local variable definition. */ - public static boolean isLocalVariableDef(DetailAST aAST) { + public static boolean isLocalVariableDef(DetailAST node) { boolean localVariableDef = false; // variable declaration? - if (aAST.getType() == TokenTypes.VARIABLE_DEF) { - final DetailAST parent = aAST.getParent(); + if (node.getType() == TokenTypes.VARIABLE_DEF) { + final DetailAST parent = node.getParent(); final int type = parent.getType(); localVariableDef = type == TokenTypes.SLIST || type == TokenTypes.FOR_INIT || type == TokenTypes.FOR_EACH_CLAUSE; } // catch parameter? - if (aAST.getType() == TokenTypes.PARAMETER_DEF) { - final DetailAST parent = aAST.getParent(); + if (node.getType() == TokenTypes.PARAMETER_DEF) { + final DetailAST parent = node.getParent(); localVariableDef = parent.getType() == TokenTypes.LITERAL_CATCH; } return localVariableDef; diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java index 15361f111..562c5d285 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java @@ -230,11 +230,11 @@ public class ImportControlCheckTest extends BaseCheckTestSupport { * and caught in test (it was caught and re-thrown twice after that) * Note: this is helper method with hard-coded structure of exception causes. It works * fine for methods mentioned, you may need to adjust it if you try to use it for other needs - * @param ex Exception + * @param exception Exception * @return String message of original exception */ - private static String getInvocationTargetExceptionMessage(CheckstyleException ex) { - return ((InvocationTargetException) ex.getCause().getCause()) + private static String getInvocationTargetExceptionMessage(CheckstyleException exception) { + return ((InvocationTargetException) exception.getCause().getCause()) .getTargetException().getMessage(); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/javadoc/JavadocParseTreeTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/javadoc/JavadocParseTreeTest.java index b7fcbcaef..d7d92abbc 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/javadoc/JavadocParseTreeTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/javadoc/JavadocParseTreeTest.java @@ -278,8 +278,8 @@ public class JavadocParseTreeTest { compareTrees(expectedTree, generatedTree); } - private void compareTrees(ParseTree t1, ParseTree t2) { - Assert.assertEquals(t1.toStringTree(parser), t2.toStringTree(parser)); + private void compareTrees(ParseTree first, ParseTree second) { + Assert.assertEquals(first.toStringTree(parser), second.toStringTree(parser)); } private static class FailOnErrorListener extends BaseErrorListener {