package g.e.b.g0.f0;

import g.e.b.d0;
import g.e.b.g0.f0.n;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;

/* JADX INFO: loaded from: classes.dex */
public final class p<T> extends d0<T> {
    public final g.e.b.j a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final d0<T> f4081b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Type f4082c;

    public p(g.e.b.j jVar, d0<T> d0Var, Type type) {
        this.a = jVar;
        this.f4081b = d0Var;
        this.f4082c = type;
    }

    @Override // g.e.b.d0
    public T a(g.e.b.i0.a aVar) {
        return this.f4081b.a(aVar);
    }

    @Override // g.e.b.d0
    public void b(g.e.b.i0.c cVar, T t2) {
        d0<T> d0VarD = this.f4081b;
        Type type = this.f4082c;
        if (t2 != null && (type == Object.class || (type instanceof TypeVariable) || (type instanceof Class))) {
            type = t2.getClass();
        }
        if (type != this.f4082c) {
            d0VarD = this.a.d(new g.e.b.h0.a<>(type));
            if (d0VarD instanceof n.a) {
                d0<T> d0Var = this.f4081b;
                if (!(d0Var instanceof n.a)) {
                    d0VarD = d0Var;
                }
            }
        }
        d0VarD.b(cVar, t2);
    }
}
