diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java index e2b3b6465..c3c376989 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java @@ -31,31 +31,6 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtils; * @author jrichard */ public abstract class AbstractExpressionHandler { - - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - public static final String MSG_ERROR = "indentation.error"; - - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - public static final String MSG_ERROR_MULTI = "indentation.error.multi"; - - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - public static final String MSG_CHILD_ERROR = "indentation.child.error"; - - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - public static final String MSG_CHILD_ERROR_MULTI = "indentation.child.error.multi"; - /** * The instance of {@code IndentationCheck} using this handler. */ @@ -162,9 +137,9 @@ public abstract class AbstractExpressionHandler { else { typeStr = " " + subtypeName; } - String messageKey = MSG_ERROR; + String messageKey = IndentationCheck.MSG_ERROR; if (expectedIndent.isMultiLevel()) { - messageKey = MSG_ERROR_MULTI; + messageKey = IndentationCheck.MSG_ERROR_MULTI; } indentCheck.indentationLog(ast.getLineNo(), messageKey, typeName + typeStr, actualIndent, expectedIndent); @@ -180,9 +155,9 @@ public abstract class AbstractExpressionHandler { private void logChildError(int line, int actualIndent, IndentLevel expectedIndent) { - String messageKey = MSG_CHILD_ERROR; + String messageKey = IndentationCheck.MSG_CHILD_ERROR; if (expectedIndent.isMultiLevel()) { - messageKey = MSG_CHILD_ERROR_MULTI; + messageKey = IndentationCheck.MSG_CHILD_ERROR_MULTI; } indentCheck.indentationLog(line, messageKey, typeName, actualIndent, expectedIndent); 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 101bff416..d3da34769 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 @@ -80,6 +80,30 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; * @author maxvetrenko */ public class IndentationCheck extends Check { + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_ERROR = "indentation.error"; + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_ERROR_MULTI = "indentation.error.multi"; + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_CHILD_ERROR = "indentation.child.error"; + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_CHILD_ERROR_MULTI = "indentation.child.error.multi"; + /** Default indentation amount - based on Sun. */ private static final int DEFAULT_INDENTATION = 4; 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 9773e2c05..d967ae619 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 @@ -37,12 +37,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; */ public class LineWrappingHandler { - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - private static final String MSG_INDENTATION_ERROR = "indentation.error"; - /** * The current instance of {@code IndentationCheck} class using this * handler. This field used to get access to private fields of @@ -269,14 +263,14 @@ public class LineWrappingHandler { if (forceStrictCondition) { if (currentNode.getColumnNo() != currentIndent) { indentCheck.indentationLog(currentNode.getLineNo(), - MSG_INDENTATION_ERROR, currentNode.getText(), + IndentationCheck.MSG_ERROR, currentNode.getText(), currentNode.getColumnNo(), currentIndent); } } else { if (currentNode.getColumnNo() < currentIndent) { indentCheck.indentationLog(currentNode.getLineNo(), - MSG_INDENTATION_ERROR, currentNode.getText(), + IndentationCheck.MSG_ERROR, currentNode.getText(), currentNode.getColumnNo(), currentIndent); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java index 047947701..833c6ed47 100755 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java @@ -74,6 +74,11 @@ public abstract class AbstractJavadocCheck extends Check { public static final String MSG_JAVADOC_WRONG_SINGLETON_TAG = "javadoc.wrong.singleton.html.tag"; + /** + * Parse error while rule recognition. + */ + public static final String MSG_JAVADOC_PARSE_RULE_ERROR = "javadoc.parse.rule.error"; + /** * Key is "line:column". Value is {@link DetailNode} tree. Map is stored in {@link ThreadLocal} * to guarantee basic thread safety and avoid shared, mutable state when not necessary. @@ -555,11 +560,6 @@ public abstract class AbstractJavadocCheck extends Check { */ private static class DescriptiveErrorListener extends BaseErrorListener { - /** - * Parse error while rule recognition. - */ - private static final String MSG_JAVADOC_PARSE_RULE_ERROR = "javadoc.parse.rule.error"; - /** * Offset is line number of beginning of the Javadoc comment. Log * messages should have line number in scope of file, not in scope of diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java index d570d13b8..0c123d577 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java @@ -19,10 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.indentation; -import static com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler.MSG_CHILD_ERROR; -import static com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler.MSG_CHILD_ERROR_MULTI; -import static com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler.MSG_ERROR; -import static com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler.MSG_ERROR_MULTI; +import static com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck.MSG_CHILD_ERROR; +import static com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck.MSG_CHILD_ERROR_MULTI; +import static com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck.MSG_ERROR; +import static com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck.MSG_ERROR_MULTI; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals;