diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java index 798a11f5f..eb5c1c8ac 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java @@ -69,8 +69,8 @@ public class ParameterNumberCheck /** {@link Override Override} annotation name */ private static final String OVERRIDE = "Override"; - /** fully-qualified {@link Override Override} annotation name */ - private static final String FQ_OVERRIDE = "java.lang." + OVERRIDE; + /** canonical {@link Override Override} annotation name */ + private static final String CANONICAL_OVERRIDE = "java.lang." + OVERRIDE; /** default maximum number of allowed parameters */ private static final int DEFAULT_MAX_PARAMETERS = 7; @@ -128,6 +128,6 @@ public class ParameterNumberCheck //if you override a method, you have no power over the number of parameters return mIgnoreOverriddenMethods && (AnnotationUtility.containsAnnotation(aAST, OVERRIDE) - || AnnotationUtility.containsAnnotation(aAST, FQ_OVERRIDE)); + || AnnotationUtility.containsAnnotation(aAST, CANONICAL_OVERRIDE)); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java index 674b2b5d2..22313e8c0 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java @@ -73,6 +73,7 @@ public class ParameterNumberCheckTest checkConfig.addAttribute("ignoreOverriddenMethods", "true"); final String[] expected = { "6:10: More than 7 parameters (found 8).", + "11:10: More than 7 parameters (found 8).", }; verify(checkConfig, getPath("InputParameterNumberCheck.java"), expected); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/InputParameterNumberCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/InputParameterNumberCheck.java index e90969dc0..92ef3b874 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/InputParameterNumberCheck.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/InputParameterNumberCheck.java @@ -6,6 +6,11 @@ class InputParameterNumberCheckBase void myMethod(int a, int b, int c, int d, int e, int f, int g, int h) { } + + // method with many parameters + void myMethod2(int a, int b, int c, int d, int e, int f, int g, int h) { + + } } public class InputParameterNumberCheck extends InputParameterNumberCheckBase @@ -14,4 +19,9 @@ public class InputParameterNumberCheck extends InputParameterNumberCheckBase void myMethod(int a, int b, int c, int d, int e, int f, int g, int h) { } + + @java.lang.Override + void myMethod2(int a, int b, int c, int d, int e, int f, int g, int h) { + + } }