additional fixes for #66, minor renaming and UTs extension
This commit is contained in:
parent
c731689244
commit
e6b25218eb
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue