|
|
@ -21,20 +21,12 @@ class CoroutinesCallAdapterFactory private constructor() : CallAdapter.Factory() |
|
|
|
if (Deferred::class.java != getRawType(returnType)) { |
|
|
|
if (Deferred::class.java != getRawType(returnType)) { |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
if (returnType !is ParameterizedType) { |
|
|
|
check(returnType is ParameterizedType) { "Deferred return type must be parameterized as Deferred<Foo> or Deferred<out Foo>" } |
|
|
|
throw IllegalStateException( |
|
|
|
|
|
|
|
"Deferred return type must be parameterized as Deferred<Foo> or Deferred<out Foo>" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
val responseType = getParameterUpperBound(0, returnType) |
|
|
|
val responseType = getParameterUpperBound(0, returnType) |
|
|
|
|
|
|
|
|
|
|
|
val rawDeferredType = getRawType(responseType) |
|
|
|
val rawDeferredType = getRawType(responseType) |
|
|
|
return if (rawDeferredType == Response::class.java) { |
|
|
|
return if (rawDeferredType == Response::class.java) { |
|
|
|
if (responseType !is ParameterizedType) { |
|
|
|
check(responseType is ParameterizedType) { "Response must be parameterized as Response<Foo> or Response<out Foo>" } |
|
|
|
throw IllegalStateException( |
|
|
|
|
|
|
|
"Response must be parameterized as Response<Foo> or Response<out Foo>" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ResponseCallAdapter<Any>( |
|
|
|
ResponseCallAdapter<Any>( |
|
|
|
getParameterUpperBound( |
|
|
|
getParameterUpperBound( |
|
|
|
0, |
|
|
|
0, |
|
|
|