package retrofit2; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import kotlin.coroutines.Continuation; import okhttp3.Call; import okhttp3.Response; import okhttp3.ResponseBody; import retrofit2.w; /* compiled from: HttpServiceMethod */ public abstract class j<ResponseT, ReturnT> extends t<ReturnT> { /* renamed from: a reason: collision with root package name */ public final q f125864a; /* renamed from: b reason: collision with root package name */ public final Call.Factory f125865b; /* renamed from: c reason: collision with root package name */ public final f<ResponseBody, ResponseT> f125866c; /* compiled from: HttpServiceMethod */ public static final class a<ResponseT, ReturnT> extends j<ResponseT, ReturnT> { /* renamed from: d reason: collision with root package name */ public final c<ResponseT, ReturnT> f125867d; public a(q qVar, Call.Factory factory, f<ResponseBody, ResponseT> fVar, c<ResponseT, ReturnT> cVar) { super(qVar, factory, fVar); this.f125867d = cVar; } @Override // retrofit2.j public ReturnT c(b<ResponseT> bVar, Object[] objArr) { return this.f125867d.b(bVar); } } /* compiled from: HttpServiceMethod */ public static final class b<ResponseT> extends j<ResponseT, Object> { /* renamed from: d reason: collision with root package name */ public final c<ResponseT, b<ResponseT>> f125868d; /* renamed from: e reason: collision with root package name */ public final boolean f125869e; public b(q qVar, Call.Factory factory, f<ResponseBody, ResponseT> fVar, c<ResponseT, b<ResponseT>> cVar, boolean z14) { super(qVar, factory, fVar); this.f125868d = cVar; this.f125869e = z14; } @Override // retrofit2.j public Object c(b<ResponseT> bVar, Object[] objArr) { b<ResponseT> b14 = this.f125868d.b(bVar); Continuation continuation = (Continuation) objArr[objArr.length - 1]; try { if (this.f125869e) { return l.b(b14, continuation); } return l.a(b14, continuation); } catch (Exception e14) { return l.d(e14, continuation); } } } /* compiled from: HttpServiceMethod */ public static final class c<ResponseT> extends j<ResponseT, Object> { /* renamed from: d reason: collision with root package name */ public final c<ResponseT, b<ResponseT>> f125870d; public c(q qVar, Call.Factory factory, f<ResponseBody, ResponseT> fVar, c<ResponseT, b<ResponseT>> cVar) { super(qVar, factory, fVar); this.f125870d = cVar; } @Override // retrofit2.j public Object c(b<ResponseT> bVar, Object[] objArr) { b<ResponseT> b14 = this.f125870d.b(bVar); Continuation continuation = (Continuation) objArr[objArr.length - 1]; try { return l.c(b14, continuation); } catch (Exception e14) { return l.d(e14, continuation); } } } public j(q qVar, Call.Factory factory, f<ResponseBody, ResponseT> fVar) { this.f125864a = qVar; this.f125865b = factory; this.f125866c = fVar; } public static <ResponseT, ReturnT> c<ResponseT, ReturnT> d(s sVar, Method method, Type type, Annotation[] annotationArr) { try { return (c<ResponseT, ReturnT>) sVar.a(type, annotationArr); } catch (RuntimeException e14) { throw w.n(method, e14, "Unable to create call adapter for %s", type); } } public static <ResponseT> f<ResponseBody, ResponseT> e(s sVar, Method method, Type type) { try { return sVar.h(type, method.getAnnotations()); } catch (RuntimeException e14) { throw w.n(method, e14, "Unable to create converter for %s", type); } } public static <ResponseT, ReturnT> j<ResponseT, ReturnT> f(s sVar, Method method, q qVar) { Type type; boolean z14; boolean z15 = qVar.f125960k; Annotation[] annotations = method.getAnnotations(); if (z15) { Type[] genericParameterTypes = method.getGenericParameterTypes(); Type f14 = w.f(0, (ParameterizedType) genericParameterTypes[genericParameterTypes.length - 1]); if (w.h(f14) != r.class || !(f14 instanceof ParameterizedType)) { z14 = false; } else { f14 = w.g(0, (ParameterizedType) f14); z14 = true; } type = new w.b(null, b.class, f14); annotations = v.a(annotations); } else { type = method.getGenericReturnType(); z14 = false; } c d14 = d(sVar, method, type, annotations); Type a14 = d14.a(); if (a14 == Response.class) { throw w.m(method, "'" + w.h(a14).getName() + "' is not a valid response body type. Did you mean ResponseBody?", new Object[0]); } else if (a14 == r.class) { throw w.m(method, "Response must include generic type (e.g., Response<String>)", new Object[0]); } else if (!qVar.f125952c.equals("HEAD") || Void.class.equals(a14)) { f e14 = e(sVar, method, a14); Call.Factory factory = sVar.f125990b; if (!z15) { return new a(qVar, factory, e14, d14); } if (z14) { return new c(qVar, factory, e14, d14); } return new b(qVar, factory, e14, d14, false); } else { throw w.m(method, "HEAD method must use Void as response type.", new Object[0]); } } @Override // retrofit2.t public final ReturnT a(Object[] objArr) { return c(new OkHttpCall(this.f125864a, objArr, this.f125865b, this.f125866c), objArr); } public abstract ReturnT c(b<ResponseT> bVar, Object[] objArr); }