package kotlin.coroutines.jvm.internal;

import java.lang.reflect.Method;

/* JADX INFO: loaded from: classes.dex */
final class i {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final i f5081a = new i();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private static final a f5082b = new a(null, null, null);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private static a f5083c;

    private static final class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        public final Method f5084a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final Method f5085b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final Method f5086c;

        public a(Method method, Method method2, Method method3) {
            this.f5084a = method;
            this.f5085b = method2;
            this.f5086c = method3;
        }
    }

    private i() {
    }

    private final a a(kotlin.coroutines.jvm.internal.a aVar) {
        try {
            a aVar2 = new a(Class.class.getDeclaredMethod("getModule", null), aVar.getClass().getClassLoader().loadClass("java.lang.Module").getDeclaredMethod("getDescriptor", null), aVar.getClass().getClassLoader().loadClass("java.lang.module.ModuleDescriptor").getDeclaredMethod("name", null));
            f5083c = aVar2;
            return aVar2;
        } catch (Exception unused) {
            a aVar3 = f5082b;
            f5083c = aVar3;
            return aVar3;
        }
    }

    public final String b(kotlin.coroutines.jvm.internal.a continuation) {
        kotlin.jvm.internal.l.e(continuation, "continuation");
        a aVarA = f5083c;
        if (aVarA == null) {
            aVarA = a(continuation);
        }
        if (aVarA == f5082b) {
            return null;
        }
        Method method = aVarA.f5084a;
        Object objInvoke = method != null ? method.invoke(continuation.getClass(), null) : null;
        if (objInvoke == null) {
            return null;
        }
        Method method2 = aVarA.f5085b;
        Object objInvoke2 = method2 != null ? method2.invoke(objInvoke, null) : null;
        if (objInvoke2 == null) {
            return null;
        }
        Method method3 = aVarA.f5086c;
        Object objInvoke3 = method3 != null ? method3.invoke(objInvoke2, null) : null;
        if (objInvoke3 instanceof String) {
            return (String) objInvoke3;
        }
        return null;
    }
}
