package androidx.lifecycle;

import android.app.Application;
import com.google.android.gms.internal.measurement.C1;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public abstract class U {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final List f8812a = B6.l.W(Application.class, N.class);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final List f8813b = C1.C(N.class);

    public static final Constructor a(Class cls, List list) {
        P6.g.e(list, "signature");
        B6.b bVarD = P6.p.d(cls.getConstructors());
        while (bVarD.hasNext()) {
            Constructor constructor = (Constructor) bVarD.next();
            Class<?>[] parameterTypes = constructor.getParameterTypes();
            P6.g.d(parameterTypes, "getParameterTypes(...)");
            List listP = B6.j.P(parameterTypes);
            if (list.equals(listP)) {
                return constructor;
            }
            if (list.size() == listP.size() && listP.containsAll(list)) {
                throw new UnsupportedOperationException("Class " + cls.getSimpleName() + " must have parameters in the proper order: " + list);
            }
        }
        return null;
    }

    public static final W b(Class cls, Constructor constructor, Object... objArr) {
        try {
            return (W) constructor.newInstance(Arrays.copyOf(objArr, objArr.length));
        } catch (IllegalAccessException e8) {
            throw new RuntimeException("Failed to access " + cls, e8);
        } catch (InstantiationException e9) {
            throw new RuntimeException("A " + cls + " cannot be instantiated.", e9);
        } catch (InvocationTargetException e10) {
            throw new RuntimeException("An exception happened in constructor of " + cls, e10.getCause());
        }
    }
}
