what-the-bank/sources/com/facetec/sdk/ft.java

58 lines
1.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
/* loaded from: classes.dex */
final class ft extends fx {
private static Class d;
private final Object b = a();
private final Field c = e();
@Override // com.facetec.sdk.fx
public final void c(AccessibleObject accessibleObject) {
if (a(accessibleObject)) {
return;
}
try {
accessibleObject.setAccessible(true);
} catch (SecurityException e) {
StringBuilder sb = new StringBuilder("Gson couldn't modify fields for ");
sb.append(accessibleObject);
sb.append("\nand sun.misc.Unsafe not found.\nEither write a custom type adapter, or make fields accessible, or include sun.misc.Unsafe.");
throw new ed(sb.toString(), e);
}
}
private boolean a(AccessibleObject accessibleObject) {
if (this.b != null && this.c != null) {
try {
d.getMethod("putBoolean", Object.class, Long.TYPE, Boolean.TYPE).invoke(this.b, accessibleObject, Long.valueOf(((Long) d.getMethod("objectFieldOffset", Field.class).invoke(this.b, this.c)).longValue()), Boolean.TRUE);
return true;
} catch (Exception unused) {
}
}
return false;
}
private static Object a() {
try {
Class<?> cls = Class.forName("sun.misc.Unsafe");
d = cls;
Field declaredField = cls.getDeclaredField("theUnsafe");
declaredField.setAccessible(true);
return declaredField.get(null);
} catch (Exception unused) {
return null;
}
}
private static Field e() {
try {
return AccessibleObject.class.getDeclaredField("override");
} catch (NoSuchFieldException unused) {
return null;
}
}
}