discord-jadx/app/src/main/java/j0/o/o.java
2021-07-27 02:35:07 +02:00

137 lines
4.7 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 */
public class o {
public static final o a = new o();
public static final b b = new a();
/* renamed from: c reason: collision with root package name */
public final AtomicReference<b> f2870c = 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 */
public static class a extends b {
}
/* compiled from: RxJavaPlugins */
public class b extends a {
public b(o oVar) {
}
}
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())) {
String str = "rxjava.plugin." + obj.substring(0, obj.length() - 6).substring(14) + ".impl";
property = properties2.getProperty(str);
if (property == null) {
throw new IllegalStateException("Implementing class declaration for " + simpleName + " missing: " + str);
}
}
}
} 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(c.d.b.a.a.t(simpleName, " implementation class not found: ", property), e3);
} catch (InstantiationException e4) {
throw new IllegalStateException(c.d.b.a.a.t(simpleName, " implementation not able to be instantiated: ", property), e4);
} catch (IllegalAccessException e5) {
throw new IllegalStateException(c.d.b.a.a.t(simpleName, " implementation not able to be accessed: ", 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.f2870c.get() == null) {
Object d = d(b.class, g());
if (d == null) {
this.f2870c.compareAndSet(null, b);
} else {
this.f2870c.compareAndSet(null, (b) d);
}
}
return this.f2870c.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();
}
}