Apply instanceof pattern matching in RootBeanDefinition

Closes gh-32520
This commit is contained in:
Felix 2024-03-22 20:33:30 +03:00 committed by Sam Brannen
parent 0e7aba4179
commit 05b15812bb
1 changed files with 2 additions and 2 deletions

View File

@ -401,8 +401,8 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
if (attribute instanceof Constructor<?> constructor) {
return new Constructor<?>[] {constructor};
}
if (attribute instanceof Constructor<?>[]) {
return (Constructor<?>[]) attribute;
if (attribute instanceof Constructor<?>[] constructors) {
return constructors;
}
throw new IllegalArgumentException("Invalid value type for attribute '" +
PREFERRED_CONSTRUCTORS_ATTRIBUTE + "': " + attribute.getClass().getName());