orThrow

inline fun <T : Any> T?.orThrow(exception: () -> Throwable): T(source)

如果 this 为 null,抛出 exception 返回的异常对象。


@JvmName(name = "orThrowNotNull")
inline fun <T : Any> T.orThrow(exception: () -> Throwable): T(source)

Deprecated (with error)

orThrow() on a non-null T is redundant

Replace with

this

用于在编译期拦截对于非空类型的冗余 orThrow 调用。