public static Type[] getReturnTypes(Invocation invocation) { try { if (invocation != null && invocation.getInvoker() != null && invocation.getInvoker().getUrl() != null && !invocation.getMethodName().startsWith("$")) { String service = invocation.getInvoker().getUrl().getServiceInterface(); if (service != null && service.length() > 0) { Class<?> cls = ReflectUtils.forName(service); Method method = cls.getMethod(invocation.getMethodName(), invocation.getParameterTypes()); if (method.getReturnType() == void.class) { return null; } return new Type[] {method.getReturnType(), method.getGenericReturnType()}; } } } catch (Throwable t) { logger.warn(t.getMessage(), t); } return null; }