80 lines
3.0 KiB
Java
80 lines
3.0 KiB
Java
|
package o;
|
||
|
|
||
|
import android.app.Application;
|
||
|
import java.lang.reflect.Constructor;
|
||
|
import java.lang.reflect.InvocationTargetException;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.Collections;
|
||
|
import java.util.List;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class Plq {
|
||
|
private static final List<Class<?>> a;
|
||
|
private static final List<Class<?>> b;
|
||
|
|
||
|
public static final <T extends VKL> T c(Class<T> cls, Constructor<T> constructor, Object... objArr) {
|
||
|
C14957gcv.e(cls, "");
|
||
|
C14957gcv.e(constructor, "");
|
||
|
C14957gcv.e(objArr, "");
|
||
|
try {
|
||
|
return constructor.newInstance(Arrays.copyOf(objArr, objArr.length));
|
||
|
} catch (IllegalAccessException e) {
|
||
|
throw new RuntimeException("Failed to access ".concat(String.valueOf(cls)), e);
|
||
|
} catch (InstantiationException e2) {
|
||
|
StringBuilder sb = new StringBuilder("A ");
|
||
|
sb.append(cls);
|
||
|
sb.append(" cannot be instantiated.");
|
||
|
throw new RuntimeException(sb.toString(), e2);
|
||
|
} catch (InvocationTargetException e3) {
|
||
|
throw new RuntimeException("An exception happened in constructor of ".concat(String.valueOf(cls)), e3.getCause());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
Class[] clsArr = {Application.class, NER.class};
|
||
|
C14957gcv.e(clsArr, "");
|
||
|
C14957gcv.e(clsArr, "");
|
||
|
List<Class<?>> asList = Arrays.asList(clsArr);
|
||
|
C14957gcv.c(asList, "");
|
||
|
a = asList;
|
||
|
List<Class<?>> singletonList = Collections.singletonList(NER.class);
|
||
|
C14957gcv.c(singletonList, "");
|
||
|
b = singletonList;
|
||
|
}
|
||
|
|
||
|
public static final <T> Constructor<T> d(Class<T> cls, List<? extends Class<?>> list) {
|
||
|
C14957gcv.e(cls, "");
|
||
|
C14957gcv.e(list, "");
|
||
|
Object[] constructors = cls.getConstructors();
|
||
|
C14957gcv.c(constructors, "");
|
||
|
for (Object obj : constructors) {
|
||
|
Constructor<T> constructor = (Constructor<T>) obj;
|
||
|
Class<?>[] parameterTypes = constructor.getParameterTypes();
|
||
|
C14957gcv.c(parameterTypes, "");
|
||
|
List d = C14875gap.d(parameterTypes);
|
||
|
if (C14957gcv.b(list, d)) {
|
||
|
if (constructor != null) {
|
||
|
return constructor;
|
||
|
}
|
||
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.reflect.Constructor<T of androidx.lifecycle.SavedStateViewModelFactoryKt.findMatchingConstructor>");
|
||
|
}
|
||
|
if (list.size() == d.size() && d.containsAll(list)) {
|
||
|
StringBuilder sb = new StringBuilder("Class ");
|
||
|
sb.append(cls.getSimpleName());
|
||
|
sb.append(" must have parameters in the proper order: ");
|
||
|
sb.append(list);
|
||
|
throw new UnsupportedOperationException(sb.toString());
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ List c() {
|
||
|
return b;
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ List e() {
|
||
|
return a;
|
||
|
}
|
||
|
}
|