Skip to content

Commit 05b1581

Browse files
FelixDessbrannen
authored andcommitted
Apply instanceof pattern matching in RootBeanDefinition
Closes gh-32520
1 parent 0e7aba4 commit 05b1581

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ public Constructor<?>[] getPreferredConstructors() {
401401
if (attribute instanceof Constructor<?> constructor) {
402402
return new Constructor<?>[] {constructor};
403403
}
404-
if (attribute instanceof Constructor<?>[]) {
405-
return (Constructor<?>[]) attribute;
404+
if (attribute instanceof Constructor<?>[] constructors) {
405+
return constructors;
406406
}
407407
throw new IllegalArgumentException("Invalid value type for attribute '" +
408408
PREFERRED_CONSTRUCTORS_ATTRIBUTE + "': " + attribute.getClass().getName());

0 commit comments

Comments
 (0)