package kotlin.reflect.w.internal;

import g.a.a.a.a;
import g.h.a.i;
import java.lang.reflect.Type;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.o;
import kotlin.reflect.w.internal.y0.d.e;
import kotlin.reflect.w.internal.y0.d.h;
import kotlin.reflect.w.internal.y0.n.h0;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\u0010\u0000\u001a\u00020\u0001\"\b\b\u0000\u0010\u0002*\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "Ljava/lang/reflect/Type;", "T", "", "invoke"}, k = 3, mv = {1, 7, 1}, xi = 48)
public final class m extends Lambda implements Function0<Type> {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ h0 f6358f;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ KClassImpl<T>.a f6359m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final /* synthetic */ KClassImpl<T> f6360n;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public m(h0 h0Var, KClassImpl<T>.a aVar, KClassImpl<T> kClassImpl) {
        super(0);
        this.f6358f = h0Var;
        this.f6359m = aVar;
        this.f6360n = kClassImpl;
    }

    @Override // kotlin.jvm.functions.Function0
    public Type invoke() {
        Type genericSuperclass;
        String str;
        h hVarC = this.f6358f.L0().c();
        if (!(hVarC instanceof e)) {
            throw new KotlinReflectionInternalError("Supertype not a class: " + hVarC);
        }
        Class<?> clsJ = v0.j((e) hVarC);
        if (clsJ == null) {
            StringBuilder sbF = a.F("Unsupported superclass of ");
            sbF.append(this.f6359m);
            sbF.append(": ");
            sbF.append(hVarC);
            throw new KotlinReflectionInternalError(sbF.toString());
        }
        if (o.a(this.f6360n.f6321p.getSuperclass(), clsJ)) {
            genericSuperclass = this.f6360n.f6321p.getGenericSuperclass();
            str = "{\n                      …ass\n                    }";
        } else {
            Class<?>[] interfaces = this.f6360n.f6321p.getInterfaces();
            o.e(interfaces, "jClass.interfaces");
            int iA2 = i.a2(interfaces, clsJ);
            if (iA2 < 0) {
                StringBuilder sbF2 = a.F("No superclass of ");
                sbF2.append(this.f6359m);
                sbF2.append(" in Java reflection for ");
                sbF2.append(hVarC);
                throw new KotlinReflectionInternalError(sbF2.toString());
            }
            genericSuperclass = this.f6360n.f6321p.getGenericInterfaces()[iA2];
            str = "{\n                      …ex]\n                    }";
        }
        o.e(genericSuperclass, str);
        return genericSuperclass;
    }
}
