Allow BeanUtils#instantiateClass inlining with native
Closes gh-27072
This commit is contained in:
parent
54bd66755c
commit
2fba0bc272
|
|
@ -142,19 +142,20 @@ public abstract class BeanUtils {
|
|||
if (clazz.isInterface()) {
|
||||
throw new BeanInstantiationException(clazz, "Specified class is an interface");
|
||||
}
|
||||
Constructor<T> ctor;
|
||||
try {
|
||||
return instantiateClass(clazz.getDeclaredConstructor());
|
||||
ctor = clazz.getDeclaredConstructor();
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
Constructor<T> ctor = findPrimaryConstructor(clazz);
|
||||
if (ctor != null) {
|
||||
return instantiateClass(ctor);
|
||||
ctor = findPrimaryConstructor(clazz);
|
||||
if (ctor == null) {
|
||||
throw new BeanInstantiationException(clazz, "No default constructor found", ex);
|
||||
}
|
||||
throw new BeanInstantiationException(clazz, "No default constructor found", ex);
|
||||
}
|
||||
catch (LinkageError err) {
|
||||
throw new BeanInstantiationException(clazz, "Unresolvable class definition", err);
|
||||
}
|
||||
return instantiateClass(ctor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue