in core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java [259:278]
public Object invoke(Object proxy, Method method, Object[] arguments) throws Throwable
{
final TrainingContextFrame<?> frame = current().peek();
if (!frame.getId().equals(id))
{
throw new IllegalStateException("Wrong stub!");
}
else
{
frame.methodInvoked(method, arguments);
}
final Class<?> type = method.getReturnType();
if (Object[].class.isAssignableFrom(type))
{
return Array.newInstance(type.getComponentType(), 0);
}
return ProxyUtils.nullValue(type);
}