- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package dagger.internal;
|
|
|
|
import dagger.Lazy;
|
|
import javax.inject.Provider;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class DoubleCheck implements Provider, Lazy {
|
|
public static final Object UNINITIALIZED = new Object();
|
|
public volatile Object instance = UNINITIALIZED;
|
|
public volatile Provider provider;
|
|
|
|
public DoubleCheck(Provider provider) {
|
|
this.provider = provider;
|
|
}
|
|
|
|
@Override // javax.inject.Provider
|
|
public Object get() {
|
|
Object obj = this.instance;
|
|
Object obj2 = UNINITIALIZED;
|
|
if (obj == obj2) {
|
|
synchronized (this) {
|
|
try {
|
|
obj = this.instance;
|
|
if (obj == obj2) {
|
|
obj = this.provider.get();
|
|
this.instance = reentrantCheck(this.instance, obj);
|
|
this.provider = null;
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
public static Object reentrantCheck(Object obj, Object obj2) {
|
|
if (obj == UNINITIALIZED || obj == obj2) {
|
|
return obj2;
|
|
}
|
|
throw new IllegalStateException("Scoped provider was invoked recursively returning different results: " + obj + " & " + obj2 + ". This is likely due to a circular dependency.");
|
|
}
|
|
|
|
public static Provider provider(Provider provider) {
|
|
Preconditions.checkNotNull(provider);
|
|
return provider instanceof DoubleCheck ? provider : new DoubleCheck(provider);
|
|
}
|
|
}
|