From f15e46bc03f06848d9eb2d0689deea4ed7de2099 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 6 Nov 2019 14:32:30 +0800 Subject: [PATCH] up --- .../app/help/http/CoroutinesCallAdapterFactory.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/http/CoroutinesCallAdapterFactory.kt b/app/src/main/java/io/legado/app/help/http/CoroutinesCallAdapterFactory.kt index 5489275ea..70391773a 100644 --- a/app/src/main/java/io/legado/app/help/http/CoroutinesCallAdapterFactory.kt +++ b/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 or Deferred" - ) - } + check(returnType is ParameterizedType) { "Deferred return type must be parameterized as Deferred or Deferred" } 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 or Response" - ) - } + check(responseType is ParameterizedType) { "Response must be parameterized as Response or Response" } ResponseCallAdapter( getParameterUpperBound( 0,