package g.f0;

import g.h0.c.l;
import g.i;

/* JADX INFO: compiled from: PlatformImplementations.kt */
/* JADX INFO: loaded from: classes.dex */
@i
public final class b {
    public static final a a;

    static {
        a aVar;
        Object objNewInstance;
        try {
            try {
                objNewInstance = Class.forName("g.f0.d.a").newInstance();
                l.e(objNewInstance, "forName(\"kotlin.internal…entations\").newInstance()");
            } catch (ClassNotFoundException unused) {
                Object objNewInstance2 = Class.forName("g.f0.c.a").newInstance();
                l.e(objNewInstance2, "forName(\"kotlin.internal…entations\").newInstance()");
                try {
                    try {
                        aVar = (a) objNewInstance2;
                    } catch (ClassNotFoundException unused2) {
                        aVar = new a();
                    }
                } catch (ClassCastException e2) {
                    ClassLoader classLoader = objNewInstance2.getClass().getClassLoader();
                    ClassLoader classLoader2 = a.class.getClassLoader();
                    if (l.a(classLoader, classLoader2)) {
                        throw e2;
                    }
                    throw new ClassNotFoundException("Instance class was loaded from a different classloader: " + classLoader + ", base type classloader: " + classLoader2, e2);
                }
            }
        } catch (ClassNotFoundException unused3) {
            Object objNewInstance3 = Class.forName("kotlin.internal.JRE8PlatformImplementations").newInstance();
            l.e(objNewInstance3, "forName(\"kotlin.internal…entations\").newInstance()");
            try {
                try {
                    aVar = (a) objNewInstance3;
                } catch (ClassNotFoundException unused4) {
                    Object objNewInstance4 = Class.forName("kotlin.internal.JRE7PlatformImplementations").newInstance();
                    l.e(objNewInstance4, "forName(\"kotlin.internal…entations\").newInstance()");
                    try {
                        aVar = (a) objNewInstance4;
                    } catch (ClassCastException e3) {
                        ClassLoader classLoader3 = objNewInstance4.getClass().getClassLoader();
                        ClassLoader classLoader4 = a.class.getClassLoader();
                        if (l.a(classLoader3, classLoader4)) {
                            throw e3;
                        }
                        throw new ClassNotFoundException("Instance class was loaded from a different classloader: " + classLoader3 + ", base type classloader: " + classLoader4, e3);
                    }
                }
            } catch (ClassCastException e4) {
                ClassLoader classLoader5 = objNewInstance3.getClass().getClassLoader();
                ClassLoader classLoader6 = a.class.getClassLoader();
                if (l.a(classLoader5, classLoader6)) {
                    throw e4;
                }
                throw new ClassNotFoundException("Instance class was loaded from a different classloader: " + classLoader5 + ", base type classloader: " + classLoader6, e4);
            }
        }
        try {
            aVar = (a) objNewInstance;
            a = aVar;
        } catch (ClassCastException e5) {
            ClassLoader classLoader7 = objNewInstance.getClass().getClassLoader();
            ClassLoader classLoader8 = a.class.getClassLoader();
            if (l.a(classLoader7, classLoader8)) {
                throw e5;
            }
            throw new ClassNotFoundException("Instance class was loaded from a different classloader: " + classLoader7 + ", base type classloader: " + classLoader8, e5);
        }
    }
}
