private GenericMetadataSupport resolveGenericType(Type type, Method method) { if (type instanceof Class) { return new NotGenericReturnTypeSupport(this, type); } if (type instanceof ParameterizedType) { return new ParameterizedReturnType(this, method.getTypeParameters(), (ParameterizedType) type); } if (type instanceof TypeVariable) { return new TypeVariableReturnType(this, method.getTypeParameters(), (TypeVariable<?>) type); } throw new MockitoException("Ouch, it shouldn't happen, type '" + type.getClass().getCanonicalName() + "' on method : '" + method.toGenericString() + "' is not supported : " + type); }
private void readTypeParameters() { registerTypeParametersOn(typeParameters); }
private void readTypeVariables() { registerTypeVariablesOn(parameterizedType); }
public ParameterizedReturnType(GenericMetadataSupport source, TypeVariable<?>[] typeParameters, ParameterizedType parameterizedType) { this.parameterizedType = parameterizedType; this.typeParameters = typeParameters; this.contextualActualTypeParameters = source.contextualActualTypeParameters; readTypeParameters(); readTypeVariables(); }