pull/48/head
kunfei 5 years ago
parent cec4d81356
commit f15e46bc03
  1. 12
      app/src/main/java/io/legado/app/help/http/CoroutinesCallAdapterFactory.kt

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

Loading…
Cancel
Save