package dagger.internal; /* loaded from: classes3.dex */ public final class Preconditions { private Preconditions() { } public static void checkBuilderRequirement(T t2, Class cls) { if (t2 != null) { return; } throw new IllegalStateException(cls.getCanonicalName() + " must be set"); } public static T checkNotNull(T t2) { t2.getClass(); return t2; } public static T checkNotNullFromComponent(T t2) { if (t2 != null) { return t2; } throw new NullPointerException("Cannot return null from a non-@Nullable component method"); } public static T checkNotNullFromProvides(T t2) { if (t2 != null) { return t2; } throw new NullPointerException("Cannot return null from a non-@Nullable @Provides method"); } public static T checkNotNull(T t2, String str) { if (t2 != null) { return t2; } throw new NullPointerException(str); } public static T checkNotNull(T t2, String str, Object obj) { String valueOf; if (t2 != null) { return t2; } if (str.contains("%s")) { if (str.indexOf("%s") == str.lastIndexOf("%s")) { if (obj instanceof Class) { valueOf = ((Class) obj).getCanonicalName(); } else { valueOf = String.valueOf(obj); } throw new NullPointerException(str.replace("%s", valueOf)); } throw new IllegalArgumentException("errorMessageTemplate has more than one format specifier"); } throw new IllegalArgumentException("errorMessageTemplate has no format specifiers"); } }