60 lines
1.6 KiB
Java
60 lines
1.6 KiB
Java
|
package com.google.android.gms.common.internal;
|
||
|
|
||
|
import android.os.Looper;
|
||
|
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class Asserts {
|
||
|
private Asserts() {
|
||
|
throw new AssertionError("Uninstantiable");
|
||
|
}
|
||
|
|
||
|
public static void checkMainThread(String str) {
|
||
|
if (Looper.getMainLooper().getThread() == Thread.currentThread()) {
|
||
|
return;
|
||
|
}
|
||
|
Looper.getMainLooper().getThread();
|
||
|
throw new IllegalStateException(str);
|
||
|
}
|
||
|
|
||
|
public static void checkNotMainThread(String str) {
|
||
|
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
|
||
|
return;
|
||
|
}
|
||
|
Looper.getMainLooper().getThread();
|
||
|
throw new IllegalStateException(str);
|
||
|
}
|
||
|
|
||
|
@EnsuresNonNull({"#1"})
|
||
|
public static void checkNotNull(Object obj) {
|
||
|
if (obj == null) {
|
||
|
throw new IllegalArgumentException("null reference");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void checkNull(Object obj) {
|
||
|
if (obj != null) {
|
||
|
throw new IllegalArgumentException("non-null reference");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void checkState(boolean z) {
|
||
|
if (!z) {
|
||
|
throw new IllegalStateException();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@EnsuresNonNull({"#1"})
|
||
|
public static void checkNotNull(Object obj, Object obj2) {
|
||
|
if (obj == null) {
|
||
|
throw new IllegalArgumentException(String.valueOf(obj2));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void checkState(boolean z, Object obj) {
|
||
|
if (!z) {
|
||
|
throw new IllegalStateException(String.valueOf(obj));
|
||
|
}
|
||
|
}
|
||
|
}
|