return asType((Object) cl, clazz);
} catch (GroovyCastException ce) {
try {
return ProxyGenerator.INSTANCE.instantiateAggregateFromBaseClass(cl, clazz);
} catch (GroovyRuntimeException cause) {
throw new GroovyCastException("Error casting closure to " + clazz.getName() +
", Reason: " + cause.getMessage());
}
}
}