public static Type getReturnType(Method method, Type declaringType) {
    Type returnType = GenericTypeReflector.getReturnType(method, declaringType);
    return resolveTypeVariableWithBound(returnType);
  }
Resolves the return type of the given method in the given type, with the method {@link GenericTypeReflector#getReturnType(Method, Type)}.

<p>In difference to the method of the library, this method will resolve unknown {@link java.lang.reflect.TypeVariable}s to the upper bound of the type variable.

@param method        the method for which the return type shall be resolved
@param declaringType the declaring type of the {@code method}
@return the resolved type
spock-core/src/main/java/org/spockframework/util/GenericTypeReflectorUtil.java