diff options
author | Michal Kordas <kordas.michal@gmail.com> | 2015-10-31 17:15:26 +0100 |
---|---|---|
committer | Roman Ivanov <ivanov-jr@mail.ru> | 2015-10-31 15:15:08 -0700 |
commit | 9aa49c8f6d2b30577565f87984819e1df0d62d0f (patch) | |
tree | 6f3a78884b521e8ef0883e063f000d2b122f6d7b /src | |
parent | 536bc20b48637fa85025b790736114d5dcb7a385 (diff) | |
download | checkstyle-9aa49c8f6d2b30577565f87984819e1df0d62d0f.tar.gz |
Issue #2202: Make SuppressWarningsFilter case-insensitive
Diffstat (limited to 'src')
3 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java index da90b2f2b..cf423bb93 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java @@ -52,8 +52,8 @@ public class SuppressWarningsHolder * Optional prefix for warning suppressions that are only intended to be * recognized by checkstyle. For instance, to suppress {@code * FallThroughCheck} only in checkstyle (and not in javac), use the - * suppression {@code "checkstyle:fallthrough"}. To suppress the warning in - * both tools, just use {@code "fallthrough"}. + * suppression {@code "checkstyle:fallthrough"} or {@code "checkstyle:FallThrough"}. + * To suppress the warning in both tools, just use {@code "fallthrough"}. */ public static final String CHECKSTYLE_PREFIX = "checkstyle:"; @@ -163,7 +163,7 @@ public class SuppressWarningsHolder .getLastColumn() >= column; final boolean nameMatches = ALL_WARNING_MATCHING_ID.equals(entry.getCheckName()) - || entry.getCheckName().equals(checkAlias); + || entry.getCheckName().equalsIgnoreCase(checkAlias); if (afterStart && beforeEnd && nameMatches) { return true; } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/filters/InputSuppressWarningsFilter.java b/src/test/resources/com/puppycrawl/tools/checkstyle/filters/InputSuppressWarningsFilter.java index 109def344..4efd42c13 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/filters/InputSuppressWarningsFilter.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/filters/InputSuppressWarningsFilter.java @@ -29,7 +29,7 @@ class InputSuppressWarningsFilter private int L; private int X; // L should NOT fail, X should // test "checkstyle:" prefix - @SuppressWarnings("checkstyle:constantname") + @SuppressWarnings("checkstyle:ConstantName") private static final int m = 0; // should NOT fail ConstantNameCheck private static final int n = 0; // should fail ConstantNameCheck @@ -48,7 +48,7 @@ class InputSuppressWarningsFilter } // test fully qualified annotation name - @java.lang.SuppressWarnings("illegalcatch") + @java.lang.SuppressWarnings("illegalCatch") public void needsToCatchException() { try { diff --git a/src/xdocs/config_filters.xml b/src/xdocs/config_filters.xml index 32832a2bc..fd5bc5123 100644 --- a/src/xdocs/config_filters.xml +++ b/src/xdocs/config_filters.xml @@ -762,8 +762,8 @@ public static final int [] array; // @cs.suppress ConstantName | NoWhitespaceAft the filter. Because of that, a configuration that includes this filter must also include <code>SuppressWarningsHolder</code> as a child module of the - <code>TreeWalker</code>. Name of check in annotation should - be written in lower case with any dotted prefix or "Check" suffix removed. + <code>TreeWalker</code>. Name of check in annotation is case-insensitive + and should be written with any dotted prefix or "Check" suffix removed. </p> </subsection> <subsection name="Examples"> @@ -783,11 +783,11 @@ public static final int [] array; // @cs.suppress ConstantName | NoWhitespaceAft <module name="SuppressWarningsFilter" /> </source> <source> -@SuppressWarnings({"membername"}) +@SuppressWarnings({"memberName"}) private int J; // should NOT fail MemberNameCheck -@SuppressWarnings({"membername"}) -@SuppressWarnings({"nowhitespaceafter"}) +@SuppressWarnings({"MemberName"}) +@SuppressWarnings({"NoWhitespaceAfter"}) private int [] ARRAY; // should NOT fail MemberNameCheck and NoWhitespaceAfterCheck </source> </subsection> |