The code is as follows:

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (Type.class == method.getReturnType() && ObjectUtils.isEmpty(args)) { return forTypeProvider(new MethodInvokeTypeProvider(this.provider, method, -1)); } else if (Type[].class == method.getReturnType() && ObjectUtils.isEmpty(args)) { Type[] result = new Type[((Type[]) method.invoke(this.provider.getType())).length];// also calls method.invoke() for (int i = 0; i < result.length; i++) { result[i] = forTypeProvider(new MethodInvokeTypeProvider(this.provider, method, i)); } return result; }

        try {
            return method.invoke(this.provider.getType(), args);
        }
        catch (InvocationTargetException ex) {
            throw ex.getTargetException();
        }
    }

The following code line also calls invoke, but it is not inside the try statement:

Type[] result = new Type[((Type[]) method.invoke(this.provider.getType())).length];

Comment From: jhoeller

Well spotted, this can potentially miss the exception adaptation indeed, even if exceptions are rarely seen there to begin with. In fact those calls should use ReflectionUtils.invokeMethod where we perform that adaptation automatically.