what-the-bank/sources/o/jBJ.java

183 lines
6.5 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import o.wdQ;
@Deprecated
/* loaded from: classes.dex */
public final class jBJ {
public static jBJ d = new jBJ();
public final Map<Class<?>, RVV> a = new HashMap();
final Map<Class<?>, Boolean> e = new HashMap();
jBJ() {
}
/* JADX INFO: Access modifiers changed from: package-private */
public static Method[] c(Class<?> cls) {
try {
return cls.getDeclaredMethods();
} catch (NoClassDefFoundError e) {
throw new IllegalArgumentException("The observer class has some methods that use newer APIs which are not available in the current OS version. Lifecycles cannot access even other methods so you should make sure that your observer classes only access framework classes that are available in your min API level OR use lifecycle:compiler annotation processor.", e);
}
}
private static void b(Map<LWm, wdQ.HBt> map, LWm lWm, wdQ.HBt hBt, Class<?> cls) {
wdQ.HBt hBt2 = map.get(lWm);
if (hBt2 == null || hBt == hBt2) {
if (hBt2 == null) {
map.put(lWm, hBt);
return;
}
return;
}
Method method = lWm.c;
StringBuilder sb = new StringBuilder("Method ");
sb.append(method.getName());
sb.append(" in ");
sb.append(cls.getName());
sb.append(" already declared with different @OnLifecycleEvent value: previous value ");
sb.append(hBt2);
sb.append(", new value ");
sb.append(hBt);
throw new IllegalArgumentException(sb.toString());
}
public final RVV c(Class<?> cls, Method[] methodArr) {
int i;
Class<? super Object> superclass = cls.getSuperclass();
HashMap hashMap = new HashMap();
if (superclass != null) {
RVV rvv = this.a.get(superclass);
if (rvv == null) {
rvv = c(superclass, null);
}
if (rvv != null) {
hashMap.putAll(rvv.a);
}
}
for (Class<?> cls2 : cls.getInterfaces()) {
RVV rvv2 = this.a.get(cls2);
if (rvv2 == null) {
rvv2 = c(cls2, null);
}
for (Map.Entry<LWm, wdQ.HBt> entry : rvv2.a.entrySet()) {
b(hashMap, entry.getKey(), entry.getValue(), cls);
}
}
if (methodArr == null) {
methodArr = c(cls);
}
boolean z = false;
for (Method method : methodArr) {
RDs rDs = (RDs) method.getAnnotation(RDs.class);
if (rDs != null) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length <= 0) {
i = 0;
} else {
if (!parameterTypes[0].isAssignableFrom(InterfaceC16541pFg.class)) {
throw new IllegalArgumentException("invalid parameter type. Must be one and instanceof LifecycleOwner");
}
i = 1;
}
wdQ.HBt d2 = rDs.d();
if (parameterTypes.length > 1) {
if (!parameterTypes[1].isAssignableFrom(wdQ.HBt.class)) {
throw new IllegalArgumentException("invalid parameter type. second arg must be an event");
}
if (d2 != wdQ.HBt.ON_ANY) {
throw new IllegalArgumentException("Second arg is supported only for ON_ANY value");
}
i = 2;
}
if (parameterTypes.length > 2) {
throw new IllegalArgumentException("cannot have more than 2 params");
}
b(hashMap, new LWm(i, method), d2, cls);
z = true;
}
}
RVV rvv3 = new RVV(hashMap);
this.a.put(cls, rvv3);
this.e.put(cls, Boolean.valueOf(z));
return rvv3;
}
@Deprecated
/* loaded from: classes.dex */
public static class RVV {
final Map<LWm, wdQ.HBt> a;
public final Map<wdQ.HBt, List<LWm>> d = new HashMap();
RVV(Map<LWm, wdQ.HBt> map) {
this.a = map;
for (Map.Entry<LWm, wdQ.HBt> entry : map.entrySet()) {
wdQ.HBt value = entry.getValue();
List<LWm> list = this.d.get(value);
if (list == null) {
list = new ArrayList<>();
this.d.put(value, list);
}
list.add(entry.getKey());
}
}
public static void c(List<LWm> list, InterfaceC16541pFg interfaceC16541pFg, wdQ.HBt hBt, Object obj) {
if (list != null) {
for (int size = list.size() - 1; size >= 0; size--) {
LWm lWm = list.get(size);
try {
int i = lWm.b;
if (i == 0) {
lWm.c.invoke(obj, new Object[0]);
} else if (i == 1) {
lWm.c.invoke(obj, interfaceC16541pFg);
} else if (i == 2) {
lWm.c.invoke(obj, interfaceC16541pFg, hBt);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e2) {
throw new RuntimeException("Failed to call observer method", e2.getCause());
}
}
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
@Deprecated
/* loaded from: classes.dex */
public static final class LWm {
final int b;
final Method c;
LWm(int i, Method method) {
this.b = i;
this.c = method;
method.setAccessible(true);
}
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof LWm)) {
return false;
}
LWm lWm = (LWm) obj;
return this.b == lWm.b && this.c.getName().equals(lWm.c.getName());
}
public final int hashCode() {
return (this.b * 31) + this.c.getName().hashCode();
}
}
}