package c.e.b; import c.d.b.a.a; import h0.a.a.f; import h0.a.a.q; import java.lang.reflect.Modifier; import java.util.Objects; /* compiled from: ConstructorAccess */ public abstract class b { public static b a(Class cls) { Class cls2; int modifiers; Class enclosingClass = cls.getEnclosingClass(); boolean z2 = false; boolean z3 = enclosingClass != null && cls.isMemberClass() && !Modifier.isStatic(cls.getModifiers()); String name = cls.getName(); String t = a.t(name, "ConstructorAccess"); if (t.startsWith("java.")) { t = a.t("reflectasm.", t); } a b = a.b(cls); try { cls2 = b.loadClass(t); } catch (ClassNotFoundException unused) { synchronized (b) { try { cls2 = b.loadClass(t); } catch (ClassNotFoundException unused2) { String replace = t.replace('.', '/'); String replace2 = name.replace('.', '/'); String str = null; if (!z3) { try { modifiers = cls.getDeclaredConstructor(null).getModifiers(); if (Modifier.isPrivate(modifiers)) { throw new RuntimeException("Class cannot be created (the no-arg constructor is private): " + cls.getName()); } } catch (Exception e) { throw new RuntimeException("Class cannot be created (missing no-arg constructor): " + cls.getName(), e); } } else { str = enclosingClass.getName().replace('.', '/'); try { modifiers = cls.getDeclaredConstructor(enclosingClass).getModifiers(); if (Modifier.isPrivate(modifiers)) { throw new RuntimeException("Non-static member class cannot be created (the enclosing class constructor is private): " + cls.getName()); } } catch (Exception e2) { throw new RuntimeException("Non-static member class cannot be created (missing enclosing class constructor): " + cls.getName(), e2); } } String str2 = Modifier.isPublic(modifiers) ? "com/esotericsoftware/reflectasm/PublicConstructorAccess" : "com/esotericsoftware/reflectasm/ConstructorAccess"; f fVar = new f(0); fVar.c(196653, 33, replace, null, str2, null); q e3 = fVar.e(1, "", "()V", null, null); e3.t(25, 0); e3.o(183, str2, "", "()V"); e3.e(177); e3.n(1, 1); q e4 = fVar.e(1, "newInstance", "()Ljava/lang/Object;", null, null); e4.s(187, replace2); e4.e(89); e4.o(183, replace2, "", "()V"); e4.e(176); e4.n(2, 1); b(fVar, replace2, str); cls2 = b.a(t, fVar.b()); } } } try { b bVar = (b) cls2.newInstance(); if (!(bVar instanceof e)) { if (cls.getPackage() == cls2.getPackage()) { ClassLoader classLoader = cls.getClassLoader(); ClassLoader classLoader2 = cls2.getClassLoader(); ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); if (classLoader != null ? !(classLoader2 != null ? classLoader != classLoader2 : classLoader != systemClassLoader) : classLoader2 == null || classLoader2 == systemClassLoader) { z2 = true; } } if (!z2) { StringBuilder sb = new StringBuilder(); sb.append(!z3 ? "Class cannot be created (the no-arg constructor is protected or package-protected, and its ConstructorAccess could not be defined in the same class loader): " : "Non-static member class cannot be created (the enclosing class constructor is protected or package-protected, and its ConstructorAccess could not be defined in the same class loader): "); sb.append(cls.getName()); throw new RuntimeException(sb.toString()); } } Objects.requireNonNull(bVar); return bVar; } catch (Throwable th) { throw new RuntimeException(a.t("Exception constructing constructor access class: ", t), th); } } public static void b(f fVar, String str, String str2) { q e = fVar.e(1, "newInstance", "(Ljava/lang/Object;)Ljava/lang/Object;", null, null); if (str2 != null) { e.s(187, str); e.e(89); e.t(25, 1); e.s(192, str2); e.e(89); e.o(182, "java/lang/Object", "getClass", "()Ljava/lang/Class;"); e.e(87); e.o(183, str, "", "(L" + str2 + ";)V"); e.e(176); e.n(4, 2); return; } e.s(187, "java/lang/UnsupportedOperationException"); e.e(89); e.j("Not an inner class."); e.o(183, "java/lang/UnsupportedOperationException", "", "(Ljava/lang/String;)V"); e.e(191); e.n(3, 2); } public abstract T c(); }