mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
107 lines
2.5 KiB
Java
107 lines
2.5 KiB
Java
package com.google.android.exoplayer2.util;
|
|
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
|
|
import org.checkerframework.dataflow.qual.Pure;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class Assertions {
|
|
private Assertions() {
|
|
}
|
|
|
|
@Pure
|
|
public static void checkArgument(boolean z) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
}
|
|
|
|
@Pure
|
|
public static void checkArgument(boolean z, Object obj) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
}
|
|
|
|
@Pure
|
|
public static int checkIndex(int i, int i2, int i3) {
|
|
if (i < i2 || i >= i3) {
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
return i;
|
|
}
|
|
|
|
@Pure
|
|
public static void checkState(boolean z) {
|
|
if (!z) {
|
|
throw new IllegalStateException();
|
|
}
|
|
}
|
|
|
|
@Pure
|
|
public static void checkState(boolean z, Object obj) {
|
|
if (!z) {
|
|
throw new IllegalStateException(String.valueOf(obj));
|
|
}
|
|
}
|
|
|
|
@EnsuresNonNull({"#1"})
|
|
@Pure
|
|
public static <T> T checkStateNotNull(T t) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
@EnsuresNonNull({"#1"})
|
|
@Pure
|
|
public static <T> T checkStateNotNull(T t, Object obj) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new IllegalStateException(String.valueOf(obj));
|
|
}
|
|
|
|
@EnsuresNonNull({"#1"})
|
|
@Pure
|
|
public static <T> T checkNotNull(T t) {
|
|
t.getClass();
|
|
return t;
|
|
}
|
|
|
|
@EnsuresNonNull({"#1"})
|
|
@Pure
|
|
public static <T> T checkNotNull(T t, Object obj) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new NullPointerException(String.valueOf(obj));
|
|
}
|
|
|
|
@EnsuresNonNull({"#1"})
|
|
@Pure
|
|
public static String checkNotEmpty(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
return str;
|
|
}
|
|
|
|
@EnsuresNonNull({"#1"})
|
|
@Pure
|
|
public static String checkNotEmpty(String str, Object obj) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
return str;
|
|
}
|
|
|
|
@Pure
|
|
public static void checkMainThread() {
|
|
if (Looper.myLooper() != Looper.getMainLooper()) {
|
|
throw new IllegalStateException("Not in applications main thread");
|
|
}
|
|
}
|
|
}
|