discord-jadx/app/src/main/java/j0/o/o.java

150 lines
5.1 KiB
Java

package j0.o;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicReference;
/* compiled from: RxJavaPlugins.java */
/* loaded from: classes3.dex */
public class o {
public static final o a = new o();
/* renamed from: b reason: collision with root package name */
public static final b f3795b = new a();
public final AtomicReference<b> c = new AtomicReference<>();
public final AtomicReference<m> d = new AtomicReference<>();
public final AtomicReference<q> e = new AtomicReference<>();
public final AtomicReference<a> f = new AtomicReference<>();
public final AtomicReference<p> g = new AtomicReference<>();
/* compiled from: RxJavaPlugins.java */
/* loaded from: classes3.dex */
public static class a extends b {
}
/* compiled from: RxJavaPlugins.java */
/* loaded from: classes3.dex */
public class b extends a {
public b(o oVar) {
}
}
/* JADX WARN: Code restructure failed: missing block: B:14:0x0060, code lost:
r2 = "rxjava.plugin." + r7.substring(0, r7.length() - 6).substring(14) + ".impl";
r1 = r10.getProperty(r2);
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0087, code lost:
if (r1 == null) goto L_0x008a;
*/
/* JADX WARN: Code restructure failed: missing block: B:18:0x00a8, code lost:
throw new java.lang.IllegalStateException("Implementing class declaration for " + r0 + " missing: " + r2);
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public static Object d(Class<?> cls, Properties properties) {
Properties properties2 = (Properties) properties.clone();
String simpleName = cls.getSimpleName();
String property = properties2.getProperty("rxjava.plugin." + simpleName + ".implementation");
if (property == null) {
try {
Iterator it = properties2.entrySet().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Map.Entry entry = (Map.Entry) it.next();
String obj = entry.getKey().toString();
if (obj.startsWith("rxjava.plugin.") && obj.endsWith(".class") && simpleName.equals(entry.getValue().toString())) {
break;
}
}
} catch (SecurityException e) {
e.printStackTrace();
}
}
if (property == null) {
return null;
}
try {
return Class.forName(property).asSubclass(cls).newInstance();
} catch (ClassCastException e2) {
throw new IllegalStateException(simpleName + " implementation is not an instance of " + simpleName + ": " + property, e2);
} catch (ClassNotFoundException e3) {
throw new IllegalStateException(b.d.b.a.a.w(simpleName, " implementation class not found: ", property), e3);
} catch (IllegalAccessException e4) {
throw new IllegalStateException(b.d.b.a.a.w(simpleName, " implementation not able to be accessed: ", property), e4);
} catch (InstantiationException e5) {
throw new IllegalStateException(b.d.b.a.a.w(simpleName, " implementation not able to be instantiated: ", property), e5);
}
}
public static Properties g() {
try {
return System.getProperties();
} catch (SecurityException unused) {
return new Properties();
}
}
public a a() {
if (this.f.get() == null) {
Object d = d(a.class, g());
if (d == null) {
this.f.compareAndSet(null, new b(this));
} else {
this.f.compareAndSet(null, (a) d);
}
}
return this.f.get();
}
public b b() {
if (this.c.get() == null) {
Object d = d(b.class, g());
if (d == null) {
this.c.compareAndSet(null, f3795b);
} else {
this.c.compareAndSet(null, (b) d);
}
}
return this.c.get();
}
public m c() {
if (this.d.get() == null) {
Object d = d(m.class, g());
if (d == null) {
this.d.compareAndSet(null, n.a);
} else {
this.d.compareAndSet(null, (m) d);
}
}
return this.d.get();
}
public p e() {
if (this.g.get() == null) {
Object d = d(p.class, g());
if (d == null) {
this.g.compareAndSet(null, p.a);
} else {
this.g.compareAndSet(null, (p) d);
}
}
return this.g.get();
}
public q f() {
if (this.e.get() == null) {
Object d = d(q.class, g());
if (d == null) {
this.e.compareAndSet(null, r.a);
} else {
this.e.compareAndSet(null, (q) d);
}
}
return this.e.get();
}
}