From 8c376e9cc598a0b15d39f17032faa8f5202e6d7f Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 22 Apr 2025 11:53:40 +0200 Subject: [PATCH] Remove redundant parameter count check in AnnotationsScanner.hasSameParameterTypes() The redundancy was reported by @TAKETODAY. See gh-34717 --- .../springframework/core/annotation/AnnotationsScanner.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java index 918a63ee55..fa92e4ef98 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java @@ -361,16 +361,12 @@ abstract class AnnotationsScanner { } private static boolean hasSameParameterTypes(Method rootMethod, Method candidateMethod) { - if (candidateMethod.getParameterCount() != rootMethod.getParameterCount()) { - return false; - } Class[] rootParameterTypes = rootMethod.getParameterTypes(); Class[] candidateParameterTypes = candidateMethod.getParameterTypes(); if (Arrays.equals(candidateParameterTypes, rootParameterTypes)) { return true; } - return hasSameGenericTypeParameters(rootMethod, candidateMethod, - rootParameterTypes); + return hasSameGenericTypeParameters(rootMethod, candidateMethod, rootParameterTypes); } private static boolean hasSameGenericTypeParameters(