ctor = findPrimaryConstructor(clazz); if (ctor != null) { return instantiateClass(ctor); } else { throw new BeanInstantiationException(clazz, "No default constructor found", var3); } } catch (LinkageError var4) { throw new BeanInstantiationException(clazz, "Unresolvable class definition", var4); } } }"> ctor = findPrimaryConstructor(clazz); if (ctor != null) { return instantiateClass(ctor); } else { throw new BeanInstantiationException(clazz, "No default constructor found", var3); } } catch (LinkageError var4) { throw new BeanInstantiationException(clazz, "Unresolvable class definition", var4); } } }"> ctor = findPrimaryConstructor(clazz); if (ctor != null) { return instantiateClass(ctor); } else { throw new BeanInstantiationException(clazz, "No default constructor found", var3); } } catch (LinkageError var4) { throw new BeanInstantiationException(clazz, "Unresolvable class definition", var4); } } }">
public static <T> T instantiateClass(Class<T> clazz) throws BeanInstantiationException {
Assert.notNull(clazz, "Class must not be null");
if (clazz.isInterface()) {
throw new BeanInstantiationException(clazz, "Specified class is an interface");
} else {
try {
return instantiateClass(clazz.getDeclaredConstructor());
} catch (NoSuchMethodException var3) {
Constructor<T> ctor = findPrimaryConstructor(clazz);
if (ctor != null) {
return instantiateClass(ctor);
} else {
throw new BeanInstantiationException(clazz, "No default constructor found", var3);
}
} catch (LinkageError var4) {
throw new BeanInstantiationException(clazz, "Unresolvable class definition", var4);
}
}
}
Constructor<T> ctor = findPrimaryConstructor(clazz);
if (ctor != null) {
return instantiateClass(ctor);
}
throw new BeanInstantiationException(clazz, "No default constructor found", ex);