Skip to content

Commit 8c376e9

Browse files
committed
Remove redundant parameter count check in AnnotationsScanner.hasSameParameterTypes()
The redundancy was reported by @TAKETODAY. See gh-34717
1 parent 018d3c9 commit 8c376e9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,16 +361,12 @@ private static boolean isOverride(Method rootMethod, Method candidateMethod) {
361361
}
362362

363363
private static boolean hasSameParameterTypes(Method rootMethod, Method candidateMethod) {
364-
if (candidateMethod.getParameterCount() != rootMethod.getParameterCount()) {
365-
return false;
366-
}
367364
Class<?>[] rootParameterTypes = rootMethod.getParameterTypes();
368365
Class<?>[] candidateParameterTypes = candidateMethod.getParameterTypes();
369366
if (Arrays.equals(candidateParameterTypes, rootParameterTypes)) {
370367
return true;
371368
}
372-
return hasSameGenericTypeParameters(rootMethod, candidateMethod,
373-
rootParameterTypes);
369+
return hasSameGenericTypeParameters(rootMethod, candidateMethod, rootParameterTypes);
374370
}
375371

376372
private static boolean hasSameGenericTypeParameters(

0 commit comments

Comments
 (0)