139 lines
4.2 KiB
Java
139 lines
4.2 KiB
Java
package i0;
|
|
|
|
import i0.e;
|
|
import java.lang.annotation.Annotation;
|
|
import java.lang.reflect.ParameterizedType;
|
|
import java.lang.reflect.Type;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
|
|
import retrofit2.HttpException;
|
|
/* compiled from: CompletableFutureCallAdapterFactory */
|
|
@IgnoreJRERequirement
|
|
public final class g extends e.a {
|
|
public static final e.a a = new g();
|
|
|
|
/* compiled from: CompletableFutureCallAdapterFactory */
|
|
@IgnoreJRERequirement
|
|
public static final class a<R> implements e<R, CompletableFuture<R>> {
|
|
public final Type a;
|
|
|
|
/* compiled from: CompletableFutureCallAdapterFactory */
|
|
@IgnoreJRERequirement
|
|
/* renamed from: i0.g$a$a reason: collision with other inner class name */
|
|
public class C0314a implements f<R> {
|
|
public final CompletableFuture<R> a;
|
|
|
|
public C0314a(a aVar, CompletableFuture<R> completableFuture) {
|
|
this.a = completableFuture;
|
|
}
|
|
|
|
@Override // i0.f
|
|
public void a(d<R> dVar, Throwable th) {
|
|
this.a.completeExceptionally(th);
|
|
}
|
|
|
|
@Override // i0.f
|
|
public void b(d<R> dVar, x<R> xVar) {
|
|
if (xVar.a()) {
|
|
this.a.complete(xVar.b);
|
|
} else {
|
|
this.a.completeExceptionally(new HttpException(xVar));
|
|
}
|
|
}
|
|
}
|
|
|
|
public a(Type type) {
|
|
this.a = type;
|
|
}
|
|
|
|
@Override // i0.e
|
|
public Type a() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // i0.e
|
|
public Object b(d dVar) {
|
|
b bVar = new b(dVar);
|
|
dVar.B(new C0314a(this, bVar));
|
|
return bVar;
|
|
}
|
|
}
|
|
|
|
/* compiled from: CompletableFutureCallAdapterFactory */
|
|
@IgnoreJRERequirement
|
|
public static final class b<T> extends CompletableFuture<T> {
|
|
public final d<?> i;
|
|
|
|
public b(d<?> dVar) {
|
|
this.i = dVar;
|
|
}
|
|
|
|
@Override // java.util.concurrent.CompletableFuture, java.util.concurrent.Future
|
|
public boolean cancel(boolean z2) {
|
|
if (z2) {
|
|
this.i.cancel();
|
|
}
|
|
return super.cancel(z2);
|
|
}
|
|
}
|
|
|
|
/* compiled from: CompletableFutureCallAdapterFactory */
|
|
@IgnoreJRERequirement
|
|
public static final class c<R> implements e<R, CompletableFuture<x<R>>> {
|
|
public final Type a;
|
|
|
|
/* compiled from: CompletableFutureCallAdapterFactory */
|
|
@IgnoreJRERequirement
|
|
public class a implements f<R> {
|
|
public final CompletableFuture<x<R>> a;
|
|
|
|
public a(c cVar, CompletableFuture<x<R>> completableFuture) {
|
|
this.a = completableFuture;
|
|
}
|
|
|
|
@Override // i0.f
|
|
public void a(d<R> dVar, Throwable th) {
|
|
this.a.completeExceptionally(th);
|
|
}
|
|
|
|
@Override // i0.f
|
|
public void b(d<R> dVar, x<R> xVar) {
|
|
this.a.complete(xVar);
|
|
}
|
|
}
|
|
|
|
public c(Type type) {
|
|
this.a = type;
|
|
}
|
|
|
|
@Override // i0.e
|
|
public Type a() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // i0.e
|
|
public Object b(d dVar) {
|
|
b bVar = new b(dVar);
|
|
dVar.B(new a(this, bVar));
|
|
return bVar;
|
|
}
|
|
}
|
|
|
|
@Override // i0.e.a
|
|
public e<?, ?> a(Type type, Annotation[] annotationArr, z zVar) {
|
|
if (d0.f(type) != CompletableFuture.class) {
|
|
return null;
|
|
}
|
|
if (type instanceof ParameterizedType) {
|
|
Type e = d0.e(0, (ParameterizedType) type);
|
|
if (d0.f(e) != x.class) {
|
|
return new a(e);
|
|
}
|
|
if (e instanceof ParameterizedType) {
|
|
return new c(d0.e(0, (ParameterizedType) e));
|
|
}
|
|
throw new IllegalStateException("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
|
|
}
|
|
throw new IllegalStateException("CompletableFuture return type must be parameterized as CompletableFuture<Foo> or CompletableFuture<? extends Foo>");
|
|
}
|
|
}
|