|
|
|
|
@ -142,19 +142,20 @@ public abstract class BeanUtils {
@@ -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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|