From e72b617d4b80e4f947b869989ba261e96876e7de Mon Sep 17 00:00:00 2001 From: Michal Kordas Date: Sat, 15 Aug 2015 01:55:29 +0200 Subject: [PATCH] Replace tags with {@code ...} constructs. #1555 Fixes `HtmlTagCanBeJavadocTag` inspection violations. Description: >Reports use of tags in Javadoc comments. Since JDK1.5 these constructs may be replaced with {@code ...} constructs. This allows the use of angle brackets (<, >) inside the comment, instead of HTML character entities. --- .../checks/AbstractFormatCheck.java | 6 ++--- .../checks/imports/IllegalImportCheck.java | 2 +- .../indentation/CommentsIndentationCheck.java | 4 ++-- .../checks/naming/AbstractClassNameCheck.java | 2 +- .../checks/naming/PackageNameCheck.java | 2 +- .../whitespace/WhitespaceAroundCheck.java | 24 +++++++++---------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/AbstractFormatCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/AbstractFormatCheck.java index 4d832f860..a6708cbf4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/AbstractFormatCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/AbstractFormatCheck.java @@ -44,7 +44,7 @@ public abstract class AbstractFormatCheck private String format; /** - * Creates a new AbstractFormatCheck instance. Defaults the + * Creates a new {@code AbstractFormatCheck} instance. Defaults the * compile flag to 0 (the default). * @param defaultFormat default format * @throws ConversionException unable to parse defaultFormat @@ -54,7 +54,7 @@ public abstract class AbstractFormatCheck } /** - * Creates a new AbstractFormatCheck instance. + * Creates a new {@code AbstractFormatCheck} instance. * @param defaultFormat default format * @param compileFlags the Pattern flags to compile the regexp with. * See {@link Pattern#compile(String, int)} @@ -66,7 +66,7 @@ public abstract class AbstractFormatCheck /** * Set the format to the specified regular expression. - * @param format a String value + * @param format a {@code String} value * @throws ConversionException unable to parse format */ public final void setFormat(String format) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java index fb331c5c4..420d2c442 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java @@ -70,7 +70,7 @@ public class IllegalImportCheck private String[] illegalPkgs; /** - * Creates a new IllegalImportCheck instance. + * Creates a new {@code IllegalImportCheck} instance. */ public IllegalImportCheck() { setIllegalPkgs("sun"); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java index fcb4bf13e..e2321e9f5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java @@ -229,9 +229,9 @@ public class CommentsIndentationCheck extends Check { /** * Checks if current single line comment is trailing comment, e.g.: *

- * + * {@code * double d = 3.14; // some comment - * + * } *

* @param singleLineComment {@link TokenTypes#SINGLE_LINE_COMMENT single line comment}. * @return true if current single line comment is trailing comment. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java index cf108e739..c01730b7e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.java @@ -68,7 +68,7 @@ public final class AbstractClassNameCheck extends AbstractFormatCheck { } /** - * Whether to ignore checking for the abstract modifier. + * Whether to ignore checking for the {@code abstract} modifier. * @param value new value */ public void setIgnoreModifier(boolean value) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java index 0279ecf89..0ad597691 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.java @@ -63,7 +63,7 @@ import com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck; public class PackageNameCheck extends AbstractFormatCheck { /** - * Creates a new PackageNameCheck instance. + * Creates a new {@code PackageNameCheck} instance. */ public PackageNameCheck() { // Uppercase letters seem rather uncommon, but they're allowed in diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java index cc6d21a42..f0a20ef36 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java @@ -295,7 +295,7 @@ public class WhitespaceAroundCheck extends Check { /** * Sets whether or not empty method bodies are allowed. - * @param allow true to allow empty method bodies. + * @param allow {@code true} to allow empty method bodies. */ public void setAllowEmptyMethods(boolean allow) { allowEmptyMethods = allow; @@ -303,7 +303,7 @@ public class WhitespaceAroundCheck extends Check { /** * Sets whether or not empty constructor bodies are allowed. - * @param allow true to allow empty constructor bodies. + * @param allow {@code true} to allow empty constructor bodies. */ public void setAllowEmptyConstructors(boolean allow) { allowEmptyCtors = allow; @@ -312,7 +312,7 @@ public class WhitespaceAroundCheck extends Check { /** * Sets whether or not to ignore the whitespace around the * colon in an enhanced for loop. - * @param ignore true to ignore enhanced for colon. + * @param ignore {@code true} to ignore enhanced for colon. */ public void setIgnoreEnhancedForColon(boolean ignore) { ignoreEnhancedForColon = ignore; @@ -320,7 +320,7 @@ public class WhitespaceAroundCheck extends Check { /** * Sets whether or not empty type bodies are allowed. - * @param allow true to allow empty type bodies. + * @param allow {@code true} to allow empty type bodies. */ public void setAllowEmptyTypes(boolean allow) { allowEmptyTypes = allow; @@ -328,7 +328,7 @@ public class WhitespaceAroundCheck extends Check { /** * Sets whether or not empty loop bodies are allowed. - * @param allow true to allow empty loops bodies. + * @param allow {@code true} to allow empty loops bodies. */ public void setAllowEmptyLoops(boolean allow) { allowEmptyLoops = allow; @@ -466,11 +466,11 @@ public class WhitespaceAroundCheck extends Check { } /** - * Test if the given DetailAST is part of an allowed empty + * Test if the given {@code DetailAST} is part of an allowed empty * method block. - * @param ast the DetailAST to test. - * @param parentType the token type of ast's parent. - * @return true if ast makes up part of an + * @param ast the {@code DetailAST} to test. + * @param parentType the token type of {@code ast}'s parent. + * @return {@code true} if {@code ast} makes up part of an * allowed empty method block. */ private boolean isEmptyMethodBlock(DetailAST ast, int parentType) { @@ -493,9 +493,9 @@ public class WhitespaceAroundCheck extends Check { /** * - * @param ast ast the DetailAST to test. - * @param parentType the token type of ast's parent. - * @return true if ast makes up part of an + * @param ast ast the {@code DetailAST} to test. + * @param parentType the token type of {@code ast}'s parent. + * @return {@code true} if {@code ast} makes up part of an * allowed empty loop block. */ private boolean isEmptyLoop(DetailAST ast, int parentType) {