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

View File

@@ -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());