Apply instanceof pattern matching in RootBeanDefinition
Closes gh-32520
This commit is contained in:
@@ -401,8 +401,8 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
|||||||
if (attribute instanceof Constructor<?> constructor) {
|
if (attribute instanceof Constructor<?> constructor) {
|
||||||
return new Constructor<?>[] {constructor};
|
return new Constructor<?>[] {constructor};
|
||||||
}
|
}
|
||||||
if (attribute instanceof Constructor<?>[]) {
|
if (attribute instanceof Constructor<?>[] constructors) {
|
||||||
return (Constructor<?>[]) attribute;
|
return constructors;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Invalid value type for attribute '" +
|
throw new IllegalArgumentException("Invalid value type for attribute '" +
|
||||||
PREFERRED_CONSTRUCTORS_ATTRIBUTE + "': " + attribute.getClass().getName());
|
PREFERRED_CONSTRUCTORS_ATTRIBUTE + "': " + attribute.getClass().getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user