From 5e2e6e557d20731683c671488330af167e50d006 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Sun, 10 Nov 2013 18:25:13 +0400 Subject: [PATCH] error (yet to decide what particular exception to throw) --- libraries/stdlib/src/kotlin/Preconditions.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/stdlib/src/kotlin/Preconditions.kt b/libraries/stdlib/src/kotlin/Preconditions.kt index a4676e88059..6b6b340a654 100644 --- a/libraries/stdlib/src/kotlin/Preconditions.kt +++ b/libraries/stdlib/src/kotlin/Preconditions.kt @@ -33,7 +33,7 @@ public inline fun require(value: Boolean, lazyMessage: () -> String): Unit { * * @includeFunctionBody ../../test/PreconditionsTest.kt requireNotNull */ -public inline fun requireNotNull(value: T?, message: Any = "Required value was null"): T { +public inline fun requireNotNull(value: T?, message: Any = "Required value was null"): T { if (value == null) { throw IllegalArgumentException(message.toString()) } else { @@ -70,7 +70,7 @@ public inline fun check(value: Boolean, lazyMessage: () -> String): Unit { * * @includeFunctionBody ../../test/PreconditionsTest.kt checkNotNull */ -public inline fun checkNotNull(value: T?, message: String = "Required value was null"): T { +public inline fun checkNotNull(value: T?, message: String = "Required value was null"): T { if (value == null) { throw IllegalStateException(message) } else { @@ -78,5 +78,4 @@ public inline fun checkNotNull(value: T?, message: String = "Required value } } - - +public inline fun error(message: String): Nothing = throw RuntimeException(message)