alexandroid/decompiled/jadx/sources/com/fasterxml/jackson/databind/util/ClassUtil.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

927 lines
32 KiB
Java

package com.fasterxml.jackson.databind.util;
import androidx.biometric.ErrorUtils$$ExternalSyntheticOutline0;
import androidx.core.app.AppLaunchChecker$$ExternalSyntheticOutline0;
import androidx.core.os.ParcelCompat$$ExternalSyntheticOutline0;
import com.amazon.alexa.handsfree.metrics.caching.JsonFields;
import com.amazon.comms.config.util.DeviceConfigConstants;
import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.annotation.NoClass;
import defpackage.a$$ExternalSyntheticOutline0;
import java.io.Closeable;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import kotlinx.serialization.json.internal.TreeJsonEncoderKt;
import okhttp3.HttpUrl;
import okio.Buffer$$ExternalSyntheticBUOutline0;
import org.apache.commons.lang3.SystemProperties;
import rx.Single$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes7.dex */
public final class ClassUtil {
private static final Class<?> CLS_OBJECT = Object.class;
private static final Annotation[] NO_ANNOTATIONS = new Annotation[0];
private static final Ctor[] NO_CTORS = new Ctor[0];
private static final Iterator<Object> EMPTY_ITERATOR = Collections.emptyIterator();
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static final class Ctor {
private transient Annotation[] _annotations;
public final Constructor<?> _ctor;
private transient Annotation[][] _paramAnnotations;
private int _paramCount = -1;
public Ctor(Constructor<?> constructor) {
this._ctor = constructor;
}
public Constructor<?> getConstructor() {
return this._ctor;
}
public Annotation[] getDeclaredAnnotations() {
Annotation[] annotationArr = this._annotations;
if (annotationArr != null) {
return annotationArr;
}
Annotation[] declaredAnnotations = this._ctor.getDeclaredAnnotations();
this._annotations = declaredAnnotations;
return declaredAnnotations;
}
public Class<?> getDeclaringClass() {
return this._ctor.getDeclaringClass();
}
public int getParamCount() {
int i = this._paramCount;
if (i >= 0) {
return i;
}
int parameterCount = this._ctor.getParameterCount();
this._paramCount = parameterCount;
return parameterCount;
}
public Annotation[][] getParameterAnnotations() {
Annotation[][] annotationArr = this._paramAnnotations;
if (annotationArr != null) {
return annotationArr;
}
Annotation[][] parameterAnnotations = this._ctor.getParameterAnnotations();
this._paramAnnotations = parameterAnnotations;
return parameterAnnotations;
}
}
private static void _addRawSuperTypes(Class<?> cls, Class<?> cls2, Collection<Class<?>> collection, boolean z) {
if (cls == cls2 || cls == null || cls == Object.class) {
return;
}
if (z) {
if (collection.contains(cls)) {
return;
} else {
collection.add(cls);
}
}
for (Class<?> cls3 : _interfaces(cls)) {
_addRawSuperTypes(cls3, cls2, collection, true);
}
_addRawSuperTypes(cls.getSuperclass(), cls2, collection, true);
}
private static void _addSuperTypes(JavaType javaType, Class<?> cls, Collection<JavaType> collection, boolean z) {
Class<?> rawClass;
if (javaType == null || (rawClass = javaType.getRawClass()) == cls || rawClass == Object.class) {
return;
}
if (z) {
if (collection.contains(javaType)) {
return;
} else {
collection.add(javaType);
}
}
Iterator<JavaType> it2 = javaType.getInterfaces().iterator();
while (it2.hasNext()) {
_addSuperTypes(it2.next(), cls, collection, true);
}
_addSuperTypes(javaType.getSuperClass(), cls, collection, true);
}
private static Method[] _failGetClassMethods(Class<?> cls, Throwable th) throws IllegalArgumentException {
String name = cls.getName();
String name2 = th.getClass().getName();
String message = th.getMessage();
StringBuilder m = ErrorUtils$$ExternalSyntheticOutline0.m("Failed on call to `getDeclaredMethods()` on class `", name, "`, problem: (", name2, ") ");
m.append(message);
throw new IllegalArgumentException(m.toString(), th);
}
private static Class<?>[] _interfaces(Class<?> cls) {
return cls.getInterfaces();
}
public static String apostrophed(String str) {
if (str == null) {
return "[null]";
}
StringBuilder sb = new StringBuilder(str.length() + 2);
sb.append('\'');
sb.append(str);
sb.append('\'');
return sb.toString();
}
public static String backticked(String str) {
if (str == null) {
return "[null]";
}
StringBuilder sb = new StringBuilder(str.length() + 2);
sb.append('`');
sb.append(str);
sb.append('`');
return sb.toString();
}
public static String canBeABeanType(Class<?> cls) {
if (cls.isAnnotation()) {
return "annotation";
}
if (cls.isArray()) {
return "array";
}
if (Enum.class.isAssignableFrom(cls)) {
return "enum";
}
if (cls.isPrimitive()) {
return TreeJsonEncoderKt.PRIMITIVE_TAG;
}
return null;
}
/* JADX WARN: Multi-variable type inference failed */
public static void checkAndFixAccess(Member member, boolean z) {
AccessibleObject accessibleObject = (AccessibleObject) member;
try {
Class<?> declaringClass = member.getDeclaringClass();
if (Modifier.isPublic(member.getModifiers()) && Modifier.isPublic(declaringClass.getModifiers()) && (!z || isJDKClass(declaringClass))) {
return;
}
accessibleObject.setAccessible(true);
} catch (SecurityException e) {
if (accessibleObject.isAccessible()) {
return;
}
Class<?> declaringClass2 = member.getDeclaringClass();
StringBuilder sb = new StringBuilder("Cannot access ");
sb.append(member);
String name = declaringClass2.getName();
String message = e.getMessage();
sb.append(" (from class ");
sb.append(name);
sb.append("; failed to set access: ");
sb.append(message);
throw new IllegalArgumentException(sb.toString());
} catch (RuntimeException e2) {
if (!"InaccessibleObjectException".equals(e2.getClass().getSimpleName())) {
throw e2;
}
String simpleName = member.getClass().getSimpleName();
String name2 = member.getName();
String nameOf = nameOf(member.getDeclaringClass());
String name3 = e2.getClass().getName();
String message2 = e2.getMessage();
StringBuilder m = ErrorUtils$$ExternalSyntheticOutline0.m("Failed to call `setAccess()` on ", simpleName, " '", name2, "' (of class ");
AppLaunchChecker$$ExternalSyntheticOutline0.m(m, nameOf, ") due to `", name3, "`, problem: ");
m.append(message2);
throw new IllegalArgumentException(m.toString(), e2);
}
}
public static String classNameOf(Object obj) {
if (obj == null) {
return "[null]";
}
return nameOf(obj instanceof Class ? (Class) obj : obj.getClass());
}
public static Class<?> classOf(Object obj) {
if (obj == null) {
return null;
}
return obj.getClass();
}
public static void closeOnFailAndThrowAsIOE(JsonGenerator jsonGenerator, Closeable closeable, Exception exc) throws IOException {
if (jsonGenerator != null) {
jsonGenerator.disable(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT);
try {
jsonGenerator.close();
} catch (Exception e) {
exc.addSuppressed(e);
}
}
if (closeable != null) {
try {
closeable.close();
} catch (Exception e2) {
exc.addSuppressed(e2);
}
}
throwIfIOE(exc);
throwIfRTE(exc);
throw new RuntimeException(exc);
}
public static <T> T createInstance(Class<T> cls, boolean z) throws IllegalArgumentException {
Constructor findConstructor = findConstructor(cls, z);
if (findConstructor == null) {
Single$$ExternalSyntheticBUOutline0.m$3(ParcelCompat$$ExternalSyntheticOutline0.m((Class) cls, new StringBuilder("Class "), " has no default (no arg) constructor"));
return null;
}
try {
return (T) findConstructor.newInstance(null);
} catch (Exception e) {
unwrapAndThrowAsIAE(e, "Failed to instantiate class " + cls.getName() + ", problem: " + e.getMessage());
return null;
}
}
public static Object defaultValue(Class<?> cls) {
if (cls == Integer.TYPE) {
return 0;
}
if (cls == Long.TYPE) {
return 0L;
}
if (cls == Boolean.TYPE) {
return Boolean.FALSE;
}
if (cls == Double.TYPE) {
return Double.valueOf(0.0d);
}
if (cls == Float.TYPE) {
return Float.valueOf(0.0f);
}
if (cls == Byte.TYPE) {
return (byte) 0;
}
if (cls == Short.TYPE) {
return (short) 0;
}
if (cls == Character.TYPE) {
return (char) 0;
}
Single$$ExternalSyntheticBUOutline0.m$3(ParcelCompat$$ExternalSyntheticOutline0.m((Class) cls, new StringBuilder("Class "), " is not a primitive type"));
return null;
}
public static <T> Iterator<T> emptyIterator() {
return (Iterator<T>) EMPTY_ITERATOR;
}
public static <T> Stream<T> emptyStream() {
return Stream.empty();
}
public static String exceptionMessage(Throwable th) {
return th instanceof JacksonException ? ((JacksonException) th).getOriginalMessage() : (!(th instanceof InvocationTargetException) || th.getCause() == null) ? th.getMessage() : th.getCause().getMessage();
}
public static Annotation[] findClassAnnotations(Class<?> cls) {
return isObjectOrPrimitive(cls) ? NO_ANNOTATIONS : cls.getDeclaredAnnotations();
}
public static <T> Constructor<T> findConstructor(Class<T> cls, boolean z) throws IllegalArgumentException {
try {
Constructor<T> declaredConstructor = cls.getDeclaredConstructor(null);
if (z) {
checkAndFixAccess(declaredConstructor, z);
return declaredConstructor;
}
if (Modifier.isPublic(declaredConstructor.getModifiers())) {
return declaredConstructor;
}
throw new IllegalArgumentException("Default constructor for " + cls.getName() + " is not accessible (non-public?): not allowed to try modify access via Reflection: cannot instantiate type");
} catch (NoSuchMethodException unused) {
return null;
} catch (Exception e) {
unwrapAndThrowAsIAE(e, "Failed to find default constructor of class " + cls.getName() + ", problem: " + e.getMessage());
return null;
}
}
public static Class<? extends Enum<?>> findEnumType(EnumMap<?, ?> enumMap) {
return !enumMap.isEmpty() ? findEnumType((Enum<?>) enumMap.keySet().iterator().next()) : EnumTypeLocator.instance.enumTypeFor(enumMap);
}
public static <T extends Annotation> Enum<?> findFirstAnnotatedEnumValue(Class<Enum<?>> cls, Class<T> cls2) {
for (Field field : cls.getDeclaredFields()) {
if (field.isEnumConstant() && field.getAnnotation(cls2) != null) {
String name = field.getName();
for (Enum<?> r8 : cls.getEnumConstants()) {
if (name.equals(r8.name())) {
return r8;
}
}
}
}
return null;
}
public static List<Class<?>> findRawSuperTypes(Class<?> cls, Class<?> cls2, boolean z) {
if (cls == null || cls == cls2 || cls == Object.class) {
return Collections.EMPTY_LIST;
}
ArrayList arrayList = new ArrayList(8);
_addRawSuperTypes(cls, cls2, arrayList, z);
return arrayList;
}
public static List<Class<?>> findSuperClasses(Class<?> cls, Class<?> cls2, boolean z) {
ArrayList arrayList = new ArrayList(8);
if (cls != null && cls != cls2) {
if (z) {
arrayList.add(cls);
}
while (true) {
cls = cls.getSuperclass();
if (cls == null || cls == cls2) {
break;
}
arrayList.add(cls);
}
}
return arrayList;
}
public static List<JavaType> findSuperTypes(JavaType javaType, Class<?> cls, boolean z) {
if (javaType == null || javaType.hasRawClass(cls) || javaType.hasRawClass(Object.class)) {
return Collections.EMPTY_LIST;
}
ArrayList arrayList = new ArrayList(8);
_addSuperTypes(javaType, cls, arrayList, z);
return arrayList;
}
public static String getClassDescription(Object obj) {
if (obj == null) {
return "unknown";
}
return nameOf(obj instanceof Class ? (Class) obj : obj.getClass());
}
public static Method[] getClassMethods(Class<?> cls) {
try {
return cls.getDeclaredMethods();
} catch (Exception e) {
return _failGetClassMethods(cls, e);
} catch (NoClassDefFoundError e2) {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader == null) {
return _failGetClassMethods(cls, e2);
}
try {
try {
return contextClassLoader.loadClass(cls.getName()).getDeclaredMethods();
} catch (Exception e3) {
return _failGetClassMethods(cls, e3);
}
} catch (ClassNotFoundException e4) {
e2.addSuppressed(e4);
return _failGetClassMethods(cls, e2);
}
}
}
public static Ctor[] getConstructors(Class<?> cls) {
if (cls.isInterface() || isObjectOrPrimitive(cls)) {
return NO_CTORS;
}
Constructor<?>[] declaredConstructors = cls.getDeclaredConstructors();
int length = declaredConstructors.length;
Ctor[] ctorArr = new Ctor[length];
for (int i = 0; i < length; i++) {
ctorArr[i] = new Ctor(declaredConstructors[i]);
}
return ctorArr;
}
@Deprecated
public static Field[] getDeclaredFields(Class<?> cls) {
return cls.getDeclaredFields();
}
@Deprecated
public static Method[] getDeclaredMethods(Class<?> cls) {
return cls.getDeclaredMethods();
}
public static Class<?> getDeclaringClass(Class<?> cls) {
if (isObjectOrPrimitive(cls)) {
return null;
}
return cls.getDeclaringClass();
}
public static Class<?> getEnclosingClass(Class<?> cls) {
if (isObjectOrPrimitive(cls)) {
return null;
}
return cls.getEnclosingClass();
}
public static Type[] getGenericInterfaces(Class<?> cls) {
return cls.getGenericInterfaces();
}
public static Type getGenericSuperclass(Class<?> cls) {
return cls.getGenericSuperclass();
}
public static int getJDKMajorVersion() {
try {
String property = System.getProperty(SystemProperties.JAVA_VERSION);
if (property.startsWith("1.")) {
return 8;
}
int indexOf = property.indexOf(".");
try {
return Integer.parseInt(indexOf < 0 ? property : property.substring(0, indexOf));
} catch (NumberFormatException unused) {
Single$$ExternalSyntheticBUOutline0.m$2(a$$ExternalSyntheticOutline0.m("Invalid JDK version String '", property, "' cannot determine JDK major version"));
return 0;
}
} catch (SecurityException unused2) {
Single$$ExternalSyntheticBUOutline0.m$2("Could not access 'java.version': cannot determine JDK major version");
return 0;
}
}
public static Class<?> getOuterClass(Class<?> cls) {
if (!Modifier.isStatic(cls.getModifiers())) {
try {
if (hasEnclosingMethod(cls)) {
return null;
}
return getEnclosingClass(cls);
} catch (SecurityException unused) {
}
}
return null;
}
@Deprecated
public static String getPackageName(Class<?> cls) {
Package r0 = cls.getPackage();
if (r0 == null) {
return null;
}
return r0.getName();
}
public static Throwable getRootCause(Throwable th) {
while (th.getCause() != null) {
th = th.getCause();
}
return th;
}
public static String getTypeDescription(JavaType javaType) {
if (javaType == null) {
return "[null]";
}
int i = 0;
while (javaType.isArrayType()) {
i++;
javaType = javaType.getContentType();
}
StringBuilder sb = new StringBuilder(80);
sb.append('`');
sb.append(javaType.toCanonical());
while (true) {
int i2 = i - 1;
if (i <= 0) {
sb.append('`');
return sb.toString();
}
sb.append(HttpUrl.PATH_SEGMENT_ENCODE_SET_URI);
i = i2;
}
}
public static boolean hasClass(Object obj, Class<?> cls) {
return obj != null && obj.getClass() == cls;
}
public static boolean hasEnclosingMethod(Class<?> cls) {
return (isObjectOrPrimitive(cls) || cls.getEnclosingMethod() == null) ? false : true;
}
@Deprecated
public static boolean hasGetterSignature(Method method) {
return (Modifier.isStatic(method.getModifiers()) || method.getParameterTypes().length != 0 || Void.TYPE == method.getReturnType()) ? false : true;
}
public static boolean isBogusClass(Class<?> cls) {
return cls == Void.class || cls == Void.TYPE || cls == NoClass.class;
}
public static boolean isCollectionMapOrArray(Class<?> cls) {
return cls.isArray() || Collection.class.isAssignableFrom(cls) || Map.class.isAssignableFrom(cls);
}
public static boolean isConcrete(Class<?> cls) {
return (cls.getModifiers() & DeviceConfigConstants.BUFFER_SIZE_IN_SAMPLES_768_2) == 0;
}
public static boolean isEnumType(Class<?> cls) {
return Enum.class.isAssignableFrom(cls);
}
public static boolean isJDK17OrAbove() {
try {
return getJDKMajorVersion() >= 17;
} catch (Throwable th) {
ExceptionUtil.rethrowIfFatal(th);
System.err.println("Failed to determine JDK major version, assuming pre-JDK-17; problem: " + th);
return false;
}
}
public static boolean isJDKClass(Class<?> cls) {
String name = cls.getName();
return name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("sun.");
}
public static boolean isJacksonStdImpl(Object obj) {
return obj == null || isJacksonStdImpl(obj.getClass());
}
public static String isLocalType(Class<?> cls, boolean z) {
try {
boolean isStatic = Modifier.isStatic(cls.getModifiers());
if (!isStatic && hasEnclosingMethod(cls)) {
return "local/anonymous";
}
if (z || isStatic) {
return null;
}
if (getEnclosingClass(cls) != null) {
return "non-static member class";
}
return null;
} catch (NullPointerException | SecurityException unused) {
return null;
}
}
public static boolean isNonStaticInnerClass(Class<?> cls) {
return (Modifier.isStatic(cls.getModifiers()) || getEnclosingClass(cls) == null) ? false : true;
}
public static boolean isObjectOrPrimitive(Class<?> cls) {
return cls == CLS_OBJECT || cls.isPrimitive();
}
public static boolean isProxyType(Class<?> cls) {
String name = cls.getName();
return name.startsWith("net.sf.cglib.proxy.") || name.startsWith("org.hibernate.proxy.");
}
public static boolean isRecordType(Class<?> cls) {
Class<? super Object> superclass = cls.getSuperclass();
return superclass != null && "java.lang.Record".equals(superclass.getName());
}
public static String name(PropertyName propertyName) {
return propertyName == null ? "[null]" : apostrophed(propertyName.getSimpleName());
}
public static String nameOf(Class<?> cls) {
if (cls == null) {
return "[null]";
}
int i = 0;
while (cls.isArray()) {
i++;
cls = cls.getComponentType();
}
String simpleName = cls.isPrimitive() ? cls.getSimpleName() : cls.getName();
if (i > 0) {
StringBuilder sb = new StringBuilder(simpleName);
do {
sb.append(HttpUrl.PATH_SEGMENT_ENCODE_SET_URI);
i--;
} while (i > 0);
simpleName = sb.toString();
}
return backticked(simpleName);
}
public static <T> T nonNull(T t, T t2) {
return t == null ? t2 : t;
}
public static String nonNullString(String str) {
return str == null ? "" : str;
}
public static String nullOrToString(Object obj) {
if (obj == null) {
return null;
}
return obj.toString();
}
public static Class<?> primitiveType(Class<?> cls) {
if (cls.isPrimitive()) {
return cls;
}
if (cls == Integer.class) {
return Integer.TYPE;
}
if (cls == Long.class) {
return Long.TYPE;
}
if (cls == Boolean.class) {
return Boolean.TYPE;
}
if (cls == Double.class) {
return Double.TYPE;
}
if (cls == Float.class) {
return Float.TYPE;
}
if (cls == Byte.class) {
return Byte.TYPE;
}
if (cls == Short.class) {
return Short.TYPE;
}
if (cls == Character.class) {
return Character.TYPE;
}
return null;
}
public static String quotedOr(Object obj, String str) {
return obj == null ? str : String.format("\"%s\"", obj);
}
public static Class<?> rawClass(JavaType javaType) {
if (javaType == null) {
return null;
}
return javaType.getRawClass();
}
public static void throwAsIAE(Throwable th, String str) {
throwIfRTE(th);
throwIfError(th);
throw new IllegalArgumentException(str, th);
}
public static <T> T throwAsMappingException(DeserializationContext deserializationContext, IOException iOException) throws JsonMappingException {
if (iOException instanceof JsonMappingException) {
throw ((JsonMappingException) iOException);
}
throw JsonMappingException.from(deserializationContext, iOException.getMessage()).withCause(iOException);
}
public static Throwable throwIfError(Throwable th) {
if (th instanceof Error) {
throw ((Error) th);
}
return th;
}
public static Throwable throwIfIOE(Throwable th) throws IOException {
if (th instanceof IOException) {
throw ((IOException) th);
}
return th;
}
public static Throwable throwIfRTE(Throwable th) {
if (th instanceof RuntimeException) {
throw ((RuntimeException) th);
}
return th;
}
public static Throwable throwRootCauseIfIOE(Throwable th) throws IOException {
return throwIfIOE(getRootCause(th));
}
public static void unwrapAndThrowAsIAE(Throwable th) {
throwAsIAE(getRootCause(th));
}
public static void verifyMustOverride(Class<?> cls, Object obj, String str) {
if (obj.getClass() == cls) {
return;
}
Single$$ExternalSyntheticBUOutline0.m$2(a$$ExternalSyntheticOutline0.m(ErrorUtils$$ExternalSyntheticOutline0.m("Sub-class ", obj.getClass().getName(), " (of class ", cls.getName(), ") must override method '"), str, "'"));
}
public static Class<?> wrapperType(Class<?> cls) {
if (cls == Integer.TYPE) {
return Integer.class;
}
if (cls == Long.TYPE) {
return Long.class;
}
if (cls == Boolean.TYPE) {
return Boolean.class;
}
if (cls == Double.TYPE) {
return Double.class;
}
if (cls == Float.TYPE) {
return Float.class;
}
if (cls == Byte.TYPE) {
return Byte.class;
}
if (cls == Short.TYPE) {
return Short.class;
}
if (cls == Character.TYPE) {
return Character.class;
}
Single$$ExternalSyntheticBUOutline0.m$3(ParcelCompat$$ExternalSyntheticOutline0.m((Class) cls, new StringBuilder("Class "), " is not a primitive type"));
return null;
}
public static void unwrapAndThrowAsIAE(Throwable th, String str) {
throwAsIAE(getRootCause(th), str);
}
public static boolean isConcrete(Member member) {
return (member.getModifiers() & DeviceConfigConstants.BUFFER_SIZE_IN_SAMPLES_768_2) == 0;
}
public static void throwAsIAE(Throwable th) {
throwAsIAE(th, th.getMessage());
}
public static String name(String str) {
if (str == null) {
return "[null]";
}
return apostrophed(str);
}
public static boolean isJacksonStdImpl(Class<?> cls) {
return cls.getAnnotation(JacksonStdImpl.class) != null;
}
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static class EnumTypeLocator {
static final EnumTypeLocator instance = new EnumTypeLocator();
private final Field enumMapTypeField;
private final Field enumSetTypeField;
private final String failForEnumMap;
private final String failForEnumSet;
private EnumTypeLocator() {
String obj;
Field field;
String obj2;
Field field2 = null;
try {
field = locateField(EnumSet.class, JsonFields.ELEMENT_TYPE, Class.class);
obj = null;
} catch (Exception e) {
obj = e.toString();
field = null;
}
this.enumSetTypeField = field;
this.failForEnumSet = obj;
try {
field2 = locateField(EnumMap.class, "keyType", Class.class);
obj2 = null;
} catch (Exception e2) {
obj2 = e2.toString();
}
this.enumMapTypeField = field2;
this.failForEnumMap = obj2;
}
private Object get(Object obj, Field field) {
try {
return field.get(obj);
} catch (Exception e) {
Buffer$$ExternalSyntheticBUOutline0.m$1(e);
return null;
}
}
private static Field locateField(Class<?> cls, String str, Class<?> cls2) throws Exception {
for (Field field : cls.getDeclaredFields()) {
if (str.equals(field.getName()) && field.getType() == cls2) {
field.setAccessible(true);
return field;
}
}
Single$$ExternalSyntheticBUOutline0.m$2(a$$ExternalSyntheticOutline0.m("No field named '", str, "' in class '", cls.getName(), "'"));
return null;
}
public Class<? extends Enum<?>> enumTypeFor(EnumSet<?> enumSet) {
Field field = this.enumSetTypeField;
if (field != null) {
return (Class) get(enumSet, field);
}
Single$$ExternalSyntheticBUOutline0.m(this.failForEnumSet, "Cannot figure out type parameter for `EnumSet` (odd JDK platform?), problem: ");
return null;
}
public Class<? extends Enum<?>> enumTypeFor(EnumMap<?, ?> enumMap) {
Field field = this.enumMapTypeField;
if (field != null) {
return (Class) get(enumMap, field);
}
Single$$ExternalSyntheticBUOutline0.m(this.failForEnumMap, "Cannot figure out type parameter for `EnumMap` (odd JDK platform?), problem: ");
return null;
}
}
@Deprecated
public static List<Class<?>> findSuperTypes(Class<?> cls, Class<?> cls2) {
return findSuperTypes(cls, cls2, new ArrayList(8));
}
public static Class<? extends Enum<?>> findEnumType(EnumSet<?> enumSet) {
if (!enumSet.isEmpty()) {
return findEnumType((Enum<?>) enumSet.iterator().next());
}
return EnumTypeLocator.instance.enumTypeFor(enumSet);
}
@Deprecated
public static List<Class<?>> findSuperTypes(Class<?> cls, Class<?> cls2, List<Class<?>> list) {
_addRawSuperTypes(cls, cls2, list, false);
return list;
}
public static Class<? extends Enum<?>> findEnumType(Enum<?> r0) {
return r0.getDeclaringClass();
}
/* JADX WARN: Multi-variable type inference failed */
public static Class<? extends Enum<?>> findEnumType(Class<?> cls) {
return cls.getSuperclass() != Enum.class ? cls.getSuperclass() : cls;
}
public static void closeOnFailAndThrowAsIOE(JsonGenerator jsonGenerator, Exception exc) throws IOException {
jsonGenerator.disable(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT);
try {
jsonGenerator.close();
} catch (Exception e) {
exc.addSuppressed(e);
}
throwIfIOE(exc);
throwIfRTE(exc);
throw new RuntimeException(exc);
}
public static String nameOf(Named named) {
if (named == null) {
return "[null]";
}
return apostrophed(named.getName());
}
@Deprecated
public static void checkAndFixAccess(Member member) {
checkAndFixAccess(member, false);
}
}