From 1bd7f9bdf3dc678b70e79481971aebc50db69dc7 Mon Sep 17 00:00:00 2001
From: alexkravin
Date: Sun, 11 Jan 2015 14:13:23 +0400
Subject: [PATCH] Prefixes, annotation, #512
---
.../annotation/AnnotationLocationCheck.java | 112 +++++++-------
.../annotation/AnnotationUseStyleCheck.java | 142 +++++++++---------
.../annotation/MissingDeprecatedCheck.java | 28 ++--
.../annotation/MissingOverrideCheck.java | 38 ++---
.../annotation/PackageAnnotationCheck.java | 6 +-
.../annotation/SuppressWarningsCheck.java | 76 +++++-----
6 files changed, 201 insertions(+), 201 deletions(-)
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java
index b829df522..16646cce8 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java
@@ -42,17 +42,17 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
* Check have following options:
*
*
- * - mAllowSamelineMultipleAnnotations - to allow annotation to be located on
+ *
- allowSamelineMultipleAnnotations - to allow annotation to be located on
* the same line as target element. Default value is false.
*
*
* -
- * mAllowSamelineSingleParameterlessAnnotation - to allow single parameterless
+ * allowSamelineSingleParameterlessAnnotation - to allow single parameterless
* annotation to be located on the same line as target element. Default value is false.
*
*
* -
- * mAllowSamelineParametrizedAnnotation - to allow parameterized annotation
+ * allowSamelineParametrizedAnnotation - to allow parameterized annotation
* to be located on the same line as target element. Default value is false.
*
*
@@ -127,43 +127,43 @@ public class AnnotationLocationCheck extends Check
/**
* Some javadoc.
*/
- private boolean mAllowSamelineSingleParameterlessAnnotation = true;
+ private boolean allowSamelineSingleParameterlessAnnotation = true;
/**
* Some javadoc.
*/
- private boolean mAllowSamelineParametrizedAnnotation;
+ private boolean allowSamelineParametrizedAnnotation;
/**
* Some javadoc.
*/
- private boolean mAllowSamelineMultipleAnnotations;
+ private boolean allowSamelineMultipleAnnotations;
/**
* Some javadoc.
- * @param aAllow Some javadoc.
+ * @param allow Some javadoc.
*/
- public final void setAllowSamelineSingleParameterlessAnnotation(boolean aAllow)
+ public final void setAllowSamelineSingleParameterlessAnnotation(boolean allow)
{
- mAllowSamelineSingleParameterlessAnnotation = aAllow;
+ allowSamelineSingleParameterlessAnnotation = allow;
}
/**
* Some javadoc.
- * @param aAllow Some javadoc.
+ * @param allow Some javadoc.
*/
- public final void setAllowSamelineParametrizedAnnotation(boolean aAllow)
+ public final void setAllowSamelineParametrizedAnnotation(boolean allow)
{
- mAllowSamelineParametrizedAnnotation = aAllow;
+ allowSamelineParametrizedAnnotation = allow;
}
/**
* Some javadoc.
- * @param aAllow Some javadoc.
+ * @param allow Some javadoc.
*/
- public final void setAllowSamelineMultipleAnnotations(boolean aAllow)
+ public final void setAllowSamelineMultipleAnnotations(boolean allow)
{
- mAllowSamelineMultipleAnnotations = aAllow;
+ allowSamelineMultipleAnnotations = allow;
}
@Override
@@ -180,9 +180,9 @@ public class AnnotationLocationCheck extends Check
}
@Override
- public void visitToken(DetailAST aAST)
+ public void visitToken(DetailAST ast)
{
- final DetailAST modifiersNode = aAST.findFirstToken(TokenTypes.MODIFIERS);
+ final DetailAST modifiersNode = ast.findFirstToken(TokenTypes.MODIFIERS);
if (hasAnnotations(modifiersNode)) {
checkAnnotations(modifiersNode, getAnnotationLevel(modifiersNode));
@@ -191,12 +191,12 @@ public class AnnotationLocationCheck extends Check
/**
* Some javadoc.
- * @param aModifierNode Some javadoc.
- * @param aCorrectLevel Some javadoc.
+ * @param modifierNode Some javadoc.
+ * @param correctLevel Some javadoc.
*/
- private void checkAnnotations(DetailAST aModifierNode, int aCorrectLevel)
+ private void checkAnnotations(DetailAST modifierNode, int correctLevel)
{
- DetailAST annotation = aModifierNode.getFirstChild();
+ DetailAST annotation = modifierNode.getFirstChild();
while (annotation != null && annotation.getType() == TokenTypes.ANNOTATION) {
final boolean hasParameters = isParameterized(annotation);
@@ -205,9 +205,9 @@ public class AnnotationLocationCheck extends Check
log(annotation.getLineNo(),
MSG_KEY_ANNOTATION_LOCATION_ALONE, getAnnotationName(annotation));
}
- else if (annotation.getColumnNo() != aCorrectLevel && !hasNodeBefore(annotation)) {
+ else if (annotation.getColumnNo() != correctLevel && !hasNodeBefore(annotation)) {
log(annotation.getLineNo(), MSG_KEY_ANNOTATION_LOCATION,
- getAnnotationName(annotation), annotation.getColumnNo(), aCorrectLevel);
+ getAnnotationName(annotation), annotation.getColumnNo(), correctLevel);
}
annotation = annotation.getNextSibling();
}
@@ -215,45 +215,45 @@ public class AnnotationLocationCheck extends Check
/**
* Some javadoc.
- * @param aAnnotation Some javadoc.
- * @param aHasParams Some javadoc.
+ * @param annotation Some javadoc.
+ * @param hasParams Some javadoc.
* @return Some javadoc.
*/
- private boolean isCorrectLocation(DetailAST aAnnotation, boolean aHasParams)
+ private boolean isCorrectLocation(DetailAST annotation, boolean hasParams)
{
- final boolean allowingCondition = aHasParams ? mAllowSamelineParametrizedAnnotation
- : mAllowSamelineSingleParameterlessAnnotation;
- return allowingCondition && !hasNodeBefore(aAnnotation)
- || !allowingCondition && !hasNodeBeside(aAnnotation)
- || mAllowSamelineMultipleAnnotations;
+ final boolean allowingCondition = hasParams ? allowSamelineParametrizedAnnotation
+ : allowSamelineSingleParameterlessAnnotation;
+ return allowingCondition && !hasNodeBefore(annotation)
+ || !allowingCondition && !hasNodeBeside(annotation)
+ || allowSamelineMultipleAnnotations;
}
/**
* Some javadoc.
- * @param aAnnotation Some javadoc.
+ * @param annotation Some javadoc.
* @return Some javadoc.
*/
- private static String getAnnotationName(DetailAST aAnnotation)
+ private static String getAnnotationName(DetailAST annotation)
{
- DetailAST idenNode = aAnnotation.findFirstToken(TokenTypes.IDENT);
+ DetailAST idenNode = annotation.findFirstToken(TokenTypes.IDENT);
if (idenNode == null) {
- idenNode = aAnnotation.findFirstToken(TokenTypes.DOT).findFirstToken(TokenTypes.IDENT);
+ idenNode = annotation.findFirstToken(TokenTypes.DOT).findFirstToken(TokenTypes.IDENT);
}
return idenNode.getText();
}
/**
* Some javadoc.
- * @param aAnnotation Some javadoc.
+ * @param annotation Some javadoc.
* @return Some javadoc.
*/
- private static boolean hasNodeAfter(DetailAST aAnnotation)
+ private static boolean hasNodeAfter(DetailAST annotation)
{
- final int annotationLineNo = aAnnotation.getLineNo();
- DetailAST nextNode = aAnnotation.getNextSibling();
+ final int annotationLineNo = annotation.getLineNo();
+ DetailAST nextNode = annotation.getNextSibling();
if (nextNode == null) {
- nextNode = aAnnotation.getParent().getNextSibling();
+ nextNode = annotation.getParent().getNextSibling();
}
return nextNode != null && annotationLineNo == nextNode.getLineNo();
@@ -261,54 +261,54 @@ public class AnnotationLocationCheck extends Check
/**
* Some javadoc.
- * @param aAnnotation Some javadoc.
+ * @param annotation Some javadoc.
* @return Some javadoc.
*/
- private static boolean hasNodeBefore(DetailAST aAnnotation)
+ private static boolean hasNodeBefore(DetailAST annotation)
{
- final int annotationLineNo = aAnnotation.getLineNo();
- final DetailAST previousNode = aAnnotation.getPreviousSibling();
+ final int annotationLineNo = annotation.getLineNo();
+ final DetailAST previousNode = annotation.getPreviousSibling();
return previousNode != null && annotationLineNo == previousNode.getLineNo();
}
/**
* Some javadoc.
- * @param aAnnotation Some javadoc.
+ * @param annotation Some javadoc.
* @return Some javadoc.
*/
- private static boolean hasNodeBeside(DetailAST aAnnotation)
+ private static boolean hasNodeBeside(DetailAST annotation)
{
- return hasNodeBefore(aAnnotation) || hasNodeAfter(aAnnotation);
+ return hasNodeBefore(annotation) || hasNodeAfter(annotation);
}
/**
* Some javadoc.
- * @param aModifierNode Some javadoc.
+ * @param modifierNode Some javadoc.
* @return Some javadoc.
*/
- private static int getAnnotationLevel(DetailAST aModifierNode)
+ private static int getAnnotationLevel(DetailAST modifierNode)
{
- return aModifierNode.getParent().getColumnNo();
+ return modifierNode.getParent().getColumnNo();
}
/**
* Some javadoc.
- * @param aAnnotation Some javadoc.
+ * @param annotation Some javadoc.
* @return Some javadoc.
*/
- private static boolean isParameterized(DetailAST aAnnotation)
+ private static boolean isParameterized(DetailAST annotation)
{
- return aAnnotation.findFirstToken(TokenTypes.EXPR) != null;
+ return annotation.findFirstToken(TokenTypes.EXPR) != null;
}
/**
* Some javadoc.
- * @param aModifierNode Some javadoc.
+ * @param modifierNode Some javadoc.
* @return Some javadoc.
*/
- private static boolean hasAnnotations(DetailAST aModifierNode)
+ private static boolean hasAnnotations(DetailAST modifierNode)
{
- return aModifierNode.findFirstToken(TokenTypes.ANNOTATION) != null;
+ return modifierNode.findFirstToken(TokenTypes.ANNOTATION) != null;
}
}
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java
index 4d54bf6fb..edcfea26d 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java
@@ -164,63 +164,63 @@ public final class AnnotationUseStyleCheck extends Check
//has more than one option type.
/** @see #setElementStyle(String) */
- private ElementStyle mStyle = ElementStyle.COMPACT_NO_ARRAY;
+ private ElementStyle style = ElementStyle.COMPACT_NO_ARRAY;
//defaulting to NEVER because of the strange compiler behavior
/** @see #setTrailingArrayComma(String) */
- private TrailingArrayComma mComma = TrailingArrayComma.NEVER;
+ private TrailingArrayComma comma = TrailingArrayComma.NEVER;
/** @see #setClosingParens(String) */
- private ClosingParens mParens = ClosingParens.NEVER;
+ private ClosingParens parens = ClosingParens.NEVER;
/**
* Sets the ElementStyle from a string.
*
- * @param aStyle string representation
+ * @param style string representation
* @throws ConversionException if cannot convert string.
*/
- public void setElementStyle(final String aStyle)
+ public void setElementStyle(final String style)
{
- this.mStyle = this.getOption(ElementStyle.class, aStyle);
+ this.style = this.getOption(ElementStyle.class, style);
}
/**
* Sets the TrailingArrayComma from a string.
*
- * @param aComma string representation
+ * @param comma string representation
* @throws ConversionException if cannot convert string.
*/
- public void setTrailingArrayComma(final String aComma)
+ public void setTrailingArrayComma(final String comma)
{
- this.mComma = this.getOption(TrailingArrayComma.class, aComma);
+ this.comma = this.getOption(TrailingArrayComma.class, comma);
}
/**
* Sets the ClosingParens from a string.
*
- * @param aParens string representation
+ * @param parens string representation
* @throws ConversionException if cannot convert string.
*/
- public void setClosingParens(final String aParens)
+ public void setClosingParens(final String parens)
{
- this.mParens = this.getOption(ClosingParens.class, aParens);
+ this.parens = this.getOption(ClosingParens.class, parens);
}
/**
* Retrieves an {@link Enum Enum} type from a @{link String String}.
* @param the enum type
- * @param aEnumClass the enum class
- * @param aString the string representing the enum
+ * @param enuclass the enum class
+ * @param string the string representing the enum
* @return the enum type
*/
- private > T getOption(final Class aEnumClass,
- final String aString)
+ private > T getOption(final Class enuclass,
+ final String string)
{
try {
- return Enum.valueOf(aEnumClass, aString.trim().toUpperCase());
+ return Enum.valueOf(enuclass, string.trim().toUpperCase());
}
catch (final IllegalArgumentException iae) {
- throw new ConversionException("unable to parse " + aString, iae);
+ throw new ConversionException("unable to parse " + string, iae);
}
}
@@ -249,11 +249,11 @@ public final class AnnotationUseStyleCheck extends Check
/** {@inheritDoc} */
@Override
- public void visitToken(final DetailAST aAST)
+ public void visitToken(final DetailAST ast)
{
- this.checkStyleType(aAST);
- this.checkCheckClosingParens(aAST);
- this.checkTrailingComma(aAST);
+ this.checkStyleType(ast);
+ this.checkCheckClosingParens(ast);
+ this.checkTrailingComma(ast);
}
/**
@@ -261,41 +261,41 @@ public final class AnnotationUseStyleCheck extends Check
* {@link ElementStyle AnnotationElementStyle}
* is correct.
*
- * @param aAnnotation the annotation token
+ * @param annotation the annotation token
*/
- private void checkStyleType(final DetailAST aAnnotation)
+ private void checkStyleType(final DetailAST annotation)
{
- if (ElementStyle.IGNORE.equals(this.mStyle)
- || this.mStyle == null)
+ if (ElementStyle.IGNORE.equals(this.style)
+ || this.style == null)
{
return;
}
- if (ElementStyle.COMPACT_NO_ARRAY.equals(this.mStyle)) {
- this.checkCompactNoArrayStyle(aAnnotation);
+ if (ElementStyle.COMPACT_NO_ARRAY.equals(this.style)) {
+ this.checkCompactNoArrayStyle(annotation);
}
- else if (ElementStyle.COMPACT.equals(this.mStyle)) {
- this.checkCompactStyle(aAnnotation);
+ else if (ElementStyle.COMPACT.equals(this.style)) {
+ this.checkCompactStyle(annotation);
}
- else if (ElementStyle.EXPANDED.equals(this.mStyle)) {
- this.checkExpandedStyle(aAnnotation);
+ else if (ElementStyle.EXPANDED.equals(this.style)) {
+ this.checkExpandedStyle(annotation);
}
}
/**
* Checks for expanded style type violations.
*
- * @param aAnnotation the annotation token
+ * @param annotation the annotation token
*/
- private void checkExpandedStyle(final DetailAST aAnnotation)
+ private void checkExpandedStyle(final DetailAST annotation)
{
final int valuePairCount =
- aAnnotation.getChildCount(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
+ annotation.getChildCount(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
if (valuePairCount == 0
- && aAnnotation.branchContains(TokenTypes.EXPR))
+ && annotation.branchContains(TokenTypes.EXPR))
{
- this.log(aAnnotation.getLineNo(), MSG_KEY_ANNOTATION_INCORRECT_STYLE,
+ this.log(annotation.getLineNo(), MSG_KEY_ANNOTATION_INCORRECT_STYLE,
ElementStyle.EXPANDED);
}
}
@@ -303,23 +303,23 @@ public final class AnnotationUseStyleCheck extends Check
/**
* Checks for compact style type violations.
*
- * @param aAnnotation the annotation token
+ * @param annotation the annotation token
*/
- private void checkCompactStyle(final DetailAST aAnnotation)
+ private void checkCompactStyle(final DetailAST annotation)
{
final int valuePairCount =
- aAnnotation.getChildCount(
+ annotation.getChildCount(
TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
final DetailAST valuePair =
- aAnnotation.findFirstToken(
+ annotation.findFirstToken(
TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
if (valuePairCount == 1
&& AnnotationUseStyleCheck.ANNOTATION_ELEMENT_SINGLE_NAME.equals(
valuePair.getFirstChild().getText()))
{
- this.log(aAnnotation.getLineNo(), "annotation.incorrect.style",
+ this.log(annotation.getLineNo(), "annotation.incorrect.style",
ElementStyle.COMPACT);
}
}
@@ -327,24 +327,24 @@ public final class AnnotationUseStyleCheck extends Check
/**
* Checks for compact no array style type violations.
*
- * @param aAnnotation the annotation token
+ * @param annotation the annotation token
*/
- private void checkCompactNoArrayStyle(final DetailAST aAnnotation)
+ private void checkCompactNoArrayStyle(final DetailAST annotation)
{
final DetailAST arrayInit =
- aAnnotation.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT);
+ annotation.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT);
final int valuePairCount =
- aAnnotation.getChildCount(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
+ annotation.getChildCount(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
final DetailAST valuePair =
- aAnnotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
+ annotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
//in compact style with one value
if (arrayInit != null
&& arrayInit.getChildCount(TokenTypes.EXPR) == 1)
{
- this.log(aAnnotation.getLineNo(), "annotation.incorrect.style",
+ this.log(annotation.getLineNo(), "annotation.incorrect.style",
ElementStyle.COMPACT_NO_ARRAY);
}
//in expanded style with one value and the correct element name
@@ -358,7 +358,7 @@ public final class AnnotationUseStyleCheck extends Check
valuePair.getFirstChild().getText())
&& nestedArrayInit.getChildCount(TokenTypes.EXPR) == 1)
{
- this.log(aAnnotation.getLineNo(), "annotation.incorrect.style",
+ this.log(annotation.getLineNo(), "annotation.incorrect.style",
ElementStyle.COMPACT_NO_ARRAY);
}
}
@@ -368,17 +368,17 @@ public final class AnnotationUseStyleCheck extends Check
* Checks to see if the trailing comma is present if required or
* prohibited.
*
- * @param aAnnotation the annotation token
+ * @param annotation the annotation token
*/
- private void checkTrailingComma(final DetailAST aAnnotation)
+ private void checkTrailingComma(final DetailAST annotation)
{
- if (TrailingArrayComma.IGNORE.equals(this.mComma)
- || this.mComma == null)
+ if (TrailingArrayComma.IGNORE.equals(this.comma)
+ || this.comma == null)
{
return;
}
- DetailAST child = aAnnotation.getFirstChild();
+ DetailAST child = annotation.getFirstChild();
while (child != null) {
DetailAST arrayInit = null;
@@ -403,23 +403,23 @@ public final class AnnotationUseStyleCheck extends Check
/**
* logs a trailing array comma violation if one exists.
*
- * @param aAST the array init
+ * @param ast the array init
* {@link TokenTypes#ANNOTATION_ARRAY_INIT ANNOTATION_ARRAY_INIT}.
*/
- private void logCommaViolation(final DetailAST aAST)
+ private void logCommaViolation(final DetailAST ast)
{
- final DetailAST rCurly = aAST.findFirstToken(TokenTypes.RCURLY);
+ final DetailAST rCurly = ast.findFirstToken(TokenTypes.RCURLY);
//comma can be null if array is empty
final DetailAST comma = rCurly.getPreviousSibling();
- if (TrailingArrayComma.ALWAYS.equals(this.mComma)
+ if (TrailingArrayComma.ALWAYS.equals(this.comma)
&& (comma == null || comma.getType() != TokenTypes.COMMA))
{
this.log(rCurly.getLineNo(),
rCurly.getColumnNo(), MSG_KEY_ANNOTATION_TRAILING_COMMA_MISSING);
}
- else if (TrailingArrayComma.NEVER.equals(this.mComma)
+ else if (TrailingArrayComma.NEVER.equals(this.comma)
&& comma != null && comma.getType() == TokenTypes.COMMA)
{
this.log(comma.getLineNo(),
@@ -431,31 +431,31 @@ public final class AnnotationUseStyleCheck extends Check
* Checks to see if the closing parenthesis are present if required or
* prohibited.
*
- * @param aAST the annotation token
+ * @param ast the annotation token
*/
- private void checkCheckClosingParens(final DetailAST aAST)
+ private void checkCheckClosingParens(final DetailAST ast)
{
- if (ClosingParens.IGNORE.equals(this.mParens)
- || this.mParens == null)
+ if (ClosingParens.IGNORE.equals(this.parens)
+ || this.parens == null)
{
return;
}
- final DetailAST paren = aAST.getLastChild();
+ final DetailAST paren = ast.getLastChild();
final boolean parenExists = paren.getType() == TokenTypes.RPAREN;
- if (ClosingParens.ALWAYS.equals(this.mParens)
+ if (ClosingParens.ALWAYS.equals(this.parens)
&& !parenExists)
{
- this.log(aAST.getLineNo(), MSG_KEY_ANNOTATION_PARENS_MISSING);
+ this.log(ast.getLineNo(), MSG_KEY_ANNOTATION_PARENS_MISSING);
}
- else if (ClosingParens.NEVER.equals(this.mParens)
- && !aAST.branchContains(TokenTypes.EXPR)
- && !aAST.branchContains(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)
- && !aAST.branchContains(TokenTypes.ANNOTATION_ARRAY_INIT)
+ else if (ClosingParens.NEVER.equals(this.parens)
+ && !ast.branchContains(TokenTypes.EXPR)
+ && !ast.branchContains(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)
+ && !ast.branchContains(TokenTypes.ANNOTATION_ARRAY_INIT)
&& parenExists)
{
- this.log(aAST.getLineNo(), MSG_KEY_ANNOTATION_PARENS_PRESENT);
+ this.log(ast.getLineNo(), MSG_KEY_ANNOTATION_PARENS_PRESENT);
}
}
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java
index ee8be2c4f..2fa8e2e0f 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java
@@ -142,39 +142,39 @@ public final class MissingDeprecatedCheck extends Check
/** {@inheritDoc} */
@Override
- public void visitToken(final DetailAST aAST)
+ public void visitToken(final DetailAST ast)
{
final TextBlock javadoc =
- this.getFileContents().getJavadocBefore(aAST.getLineNo());
+ this.getFileContents().getJavadocBefore(ast.getLineNo());
final boolean containsAnnotation =
- AnnotationUtility.containsAnnotation(aAST, DEPRECATED)
- || AnnotationUtility.containsAnnotation(aAST, FQ_DEPRECATED);
+ AnnotationUtility.containsAnnotation(ast, DEPRECATED)
+ || AnnotationUtility.containsAnnotation(ast, FQ_DEPRECATED);
final boolean containsJavadocTag = this.containsJavadocTag(javadoc);
if (containsAnnotation ^ containsJavadocTag) {
- this.log(aAST.getLineNo(), MSG_KEY_ANNOTATION_MISSING_DEPRECATED);
+ this.log(ast.getLineNo(), MSG_KEY_ANNOTATION_MISSING_DEPRECATED);
}
}
/**
* Checks to see if the text block contains a deprecated tag.
*
- * @param aJavadoc the javadoc of the AST
+ * @param javadoc the javadoc of the AST
* @return true if contains the tag
*/
- private boolean containsJavadocTag(final TextBlock aJavadoc)
+ private boolean containsJavadocTag(final TextBlock javadoc)
{
- if (aJavadoc == null) {
+ if (javadoc == null) {
return false;
}
- final String[] lines = aJavadoc.getText();
+ final String[] lines = javadoc.getText();
boolean found = false;
- int currentLine = aJavadoc.getStartLineNo() - 1;
+ int currentLine = javadoc.getStartLineNo() - 1;
for (int i = 0; i < lines.length; i++) {
currentLine++;
@@ -199,15 +199,15 @@ public final class MissingDeprecatedCheck extends Check
// Javadoc), '@' (start of next tag), or anything that's
// not whitespace or '*' characters.
- for (int remIndex = i + 1;
- remIndex < lines.length; remIndex++)
+ for (int reindex = i + 1;
+ reindex < lines.length; reindex++)
{
final Matcher multilineCont =
MissingDeprecatedCheck.MATCH_DEPRECATED_MULTILINE_CONT
- .matcher(lines[remIndex]);
+ .matcher(lines[reindex]);
if (multilineCont.find()) {
- remIndex = lines.length;
+ reindex = lines.length;
final String lFin = multilineCont.group(1);
if (!lFin.equals(MissingDeprecatedCheck.NEXT_TAG)
&& !lFin.equals(MissingDeprecatedCheck.END_JAVADOC))
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java
index 2d3a4accb..310e8156b 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java
@@ -100,7 +100,7 @@ public final class MissingOverrideCheck extends Check
"annotation.missing.override";
/** @see #setJavaFiveCompatibility(boolean) */
- private boolean mJavaFiveCompatibility;
+ private boolean javaFiveCompatibility;
/**
* Sets Java 5 compatibility mode.
@@ -116,11 +116,11 @@ public final class MissingOverrideCheck extends Check
* false to turn off Java 5 compatibility mode.
*
*
- * @param aCompatibility compatibility or not
+ * @param compatibility compatibility or not
*/
- public void setJavaFiveCompatibility(final boolean aCompatibility)
+ public void setJavaFiveCompatibility(final boolean compatibility)
{
- this.mJavaFiveCompatibility = aCompatibility;
+ this.javaFiveCompatibility = compatibility;
}
/** {@inheritDoc} */
@@ -147,21 +147,21 @@ public final class MissingOverrideCheck extends Check
/** {@inheritDoc} */
@Override
- public void visitToken(final DetailAST aAST)
+ public void visitToken(final DetailAST ast)
{
final TextBlock javadoc =
- this.getFileContents().getJavadocBefore(aAST.getLineNo());
+ this.getFileContents().getJavadocBefore(ast.getLineNo());
- final boolean containsTag = this.containsJavadocTag(javadoc);
- if (containsTag && !JavadocTagInfo.INHERIT_DOC.isValidOn(aAST)) {
- this.log(aAST.getLineNo(), MSG_KEY_TAG_NOT_VALID_ON,
+ final boolean containastag = this.containsJavadocTag(javadoc);
+ if (containastag && !JavadocTagInfo.INHERIT_DOC.isValidOn(ast)) {
+ this.log(ast.getLineNo(), MSG_KEY_TAG_NOT_VALID_ON,
JavadocTagInfo.INHERIT_DOC.getText());
return;
}
- if (this.mJavaFiveCompatibility) {
- final DetailAST defOrNew = aAST.getParent().getParent();
+ if (this.javaFiveCompatibility) {
+ final DetailAST defOrNew = ast.getParent().getParent();
if (defOrNew.branchContains(TokenTypes.EXTENDS_CLAUSE)
|| defOrNew.branchContains(TokenTypes.IMPLEMENTS_CLAUSE)
@@ -171,27 +171,27 @@ public final class MissingOverrideCheck extends Check
}
}
- if (containsTag
- && (!AnnotationUtility.containsAnnotation(aAST, OVERRIDE)
- && !AnnotationUtility.containsAnnotation(aAST, FQ_OVERRIDE)))
+ if (containastag
+ && (!AnnotationUtility.containsAnnotation(ast, OVERRIDE)
+ && !AnnotationUtility.containsAnnotation(ast, FQ_OVERRIDE)))
{
- this.log(aAST.getLineNo(), MSG_KEY_ANNOTATION_MISSING_OVERRIDE);
+ this.log(ast.getLineNo(), MSG_KEY_ANNOTATION_MISSING_OVERRIDE);
}
}
/**
* Checks to see if the text block contains a inheritDoc tag.
*
- * @param aJavadoc the javadoc of the AST
+ * @param javadoc the javadoc of the AST
* @return true if contains the tag
*/
- private boolean containsJavadocTag(final TextBlock aJavadoc)
+ private boolean containsJavadocTag(final TextBlock javadoc)
{
- if (aJavadoc == null) {
+ if (javadoc == null) {
return false;
}
- final String[] lines = aJavadoc.getText();
+ final String[] lines = javadoc.getText();
for (final String line : lines) {
final Matcher matchInheritDoc =
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java
index 7ba420c84..87a94eb28 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java
@@ -71,15 +71,15 @@ public class PackageAnnotationCheck extends Check
/** {@inheritDoc} */
@Override
- public void visitToken(final DetailAST aAST)
+ public void visitToken(final DetailAST ast)
{
final boolean containsAnnotation =
- AnnotationUtility.containsAnnotation(aAST);
+ AnnotationUtility.containsAnnotation(ast);
final boolean inPackageInfo =
this.getFileContents().inPackageInfo();
if (containsAnnotation && !inPackageInfo) {
- this.log(aAST.getLine(), "annotation.package.location");
+ this.log(ast.getLine(), "annotation.package.location");
}
}
}
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java
index a4d7c4f0c..c77e481b7 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java
@@ -139,9 +139,9 @@ public class SuppressWarningsCheck extends AbstractFormatCheck
/** {@inheritDoc} */
@Override
- public void visitToken(final DetailAST aAST)
+ public void visitToken(final DetailAST ast)
{
- final DetailAST annotation = this.getSuppressWarnings(aAST);
+ final DetailAST annotation = this.getSuppressWarnings(ast);
if (annotation == null) {
return;
@@ -196,47 +196,47 @@ public class SuppressWarningsCheck extends AbstractFormatCheck
* that is annotating the AST. If the annotation does not exist
* this method will return {@code null}.
*
- * @param aAST the AST
+ * @param ast the AST
* @return the {@link SuppressWarnings SuppressWarnings} annotation
*/
- private DetailAST getSuppressWarnings(DetailAST aAST)
+ private DetailAST getSuppressWarnings(DetailAST ast)
{
final DetailAST annotation = AnnotationUtility.getAnnotation(
- aAST, SuppressWarningsCheck.SUPPRESS_WARNINGS);
+ ast, SuppressWarningsCheck.SUPPRESS_WARNINGS);
return (annotation != null) ? annotation
: AnnotationUtility.getAnnotation(
- aAST, SuppressWarningsCheck.FQ_SUPPRESS_WARNINGS);
+ ast, SuppressWarningsCheck.FQ_SUPPRESS_WARNINGS);
}
/**
* This method looks for a warning that matches a configured expression.
* If found it logs a violation at the given line and column number.
*
- * @param aLineNo the line number
- * @param aColNum the column number
- * @param aWarningText the warning.
+ * @param lineNo the line number
+ * @param colNum the column number
+ * @param warningText the warning.
*/
- private void logMatch(final int aLineNo,
- final int aColNum, final String aWarningText)
+ private void logMatch(final int lineNo,
+ final int colNum, final String warningText)
{
- final Matcher matcher = this.getRegexp().matcher(aWarningText);
+ final Matcher matcher = this.getRegexp().matcher(warningText);
if (matcher.matches()) {
- this.log(aLineNo, aColNum,
- MSG_KEY_SUPPRESSED_WARNING_NOT_ALLOWED, aWarningText);
+ this.log(lineNo, colNum,
+ MSG_KEY_SUPPRESSED_WARNING_NOT_ALLOWED, warningText);
}
}
/**
* Find the parent (holder) of the of the warnings (Expr).
*
- * @param aAnnotation the annotation
+ * @param annotation the annotation
* @return a Token representing the expr.
*/
- private DetailAST findWarningsHolder(final DetailAST aAnnotation)
+ private DetailAST findWarningsHolder(final DetailAST annotation)
{
final DetailAST annValuePair =
- aAnnotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
+ annotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
final DetailAST annArrayInit;
if (annValuePair != null) {
@@ -245,14 +245,14 @@ public class SuppressWarningsCheck extends AbstractFormatCheck
}
else {
annArrayInit =
- aAnnotation.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT);
+ annotation.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT);
}
if (annArrayInit != null) {
return annArrayInit;
}
- return aAnnotation;
+ return annotation;
}
/**
@@ -264,16 +264,16 @@ public class SuppressWarningsCheck extends AbstractFormatCheck
*
* Output String = unchecked
*
- * @param aWarning the warning string
+ * @param warning the warning string
* @return the string without two quotes
*/
- private String removeQuotes(final String aWarning)
+ private String removeQuotes(final String warning)
{
- assert aWarning != null : "the aWarning was null";
- assert aWarning.charAt(0) == '"';
- assert aWarning.charAt(aWarning.length() - 1) == '"';
+ assert warning != null : "the warning was null";
+ assert warning.charAt(0) == '"';
+ assert warning.charAt(warning.length() - 1) == '"';
- return aWarning.substring(1, aWarning.length() - 1);
+ return warning.substring(1, warning.length() - 1);
}
/**
@@ -281,47 +281,47 @@ public class SuppressWarningsCheck extends AbstractFormatCheck
* and right sides, checking for matches and
* logging violations.
*
- * @param aCond a Conditional type
+ * @param cond a Conditional type
* {@link TokenTypes#QUESTION QUESTION}
*/
- private void walkConditional(final DetailAST aCond)
+ private void walkConditional(final DetailAST cond)
{
- if (aCond.getType() != TokenTypes.QUESTION) {
+ if (cond.getType() != TokenTypes.QUESTION) {
final String warningText =
- this.removeQuotes(aCond.getText());
- this.logMatch(aCond.getLineNo(), aCond.getColumnNo(), warningText);
+ this.removeQuotes(cond.getText());
+ this.logMatch(cond.getLineNo(), cond.getColumnNo(), warningText);
return;
}
- this.walkConditional(this.getCondLeft(aCond));
- this.walkConditional(this.getCondRight(aCond));
+ this.walkConditional(this.getCondLeft(cond));
+ this.walkConditional(this.getCondRight(cond));
}
/**
* Retrieves the left side of a conditional.
*
- * @param aCond aCond a conditional type
+ * @param cond cond a conditional type
* {@link TokenTypes#QUESTION QUESTION}
* @return either the value
* or another conditional
*/
- private DetailAST getCondLeft(final DetailAST aCond)
+ private DetailAST getCondLeft(final DetailAST cond)
{
- final DetailAST colon = aCond.findFirstToken(TokenTypes.COLON);
+ final DetailAST colon = cond.findFirstToken(TokenTypes.COLON);
return colon.getPreviousSibling();
}
/**
* Retrieves the right side of a conditional.
*
- * @param aCond a conditional type
+ * @param cond a conditional type
* {@link TokenTypes#QUESTION QUESTION}
* @return either the value
* or another conditional
*/
- private DetailAST getCondRight(final DetailAST aCond)
+ private DetailAST getCondRight(final DetailAST cond)
{
- final DetailAST colon = aCond.findFirstToken(TokenTypes.COLON);
+ final DetailAST colon = cond.findFirstToken(TokenTypes.COLON);
return colon.getNextSibling();
}
}