diff --git a/compiler/testData/integration/smoke/scriptException/script.expected b/compiler/testData/integration/smoke/scriptException/script.expected index f2ccb8b1988..6996b36d0ee 100644 --- a/compiler/testData/integration/smoke/scriptException/script.expected +++ b/compiler/testData/integration/smoke/scriptException/script.expected @@ -1,7 +1,7 @@ ERR: java.lang.IllegalStateException: my error - at kotlin.PreconditionsKt__PreconditionsKt.error(Preconditions.kt:142) + at kotlin.PreconditionsKt__PreconditionsKt.error(Preconditions.kt:88) at kotlin.PreconditionsKt.error(Unknown Source) at Script.main(Unknown Source) at Script.a(Unknown Source) diff --git a/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt b/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt index 71018bafc65..3592c756c0c 100644 --- a/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt +++ b/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt @@ -16,20 +16,6 @@ public fun assert(value: Boolean) { assert(value) { "Assertion failed" } } -/** -* Throws an [AssertionError] with an optional [message] if the [value] is false -* and runtime assertions have been enabled on the JVM using the *-ea* JVM option. -*/ -@Deprecated("Use assert with lazy message instead.", ReplaceWith("assert(value) { message }"), DeprecationLevel.ERROR) -public fun assert(value: Boolean, message: Any = "Assertion failed") { - @Suppress("DEPRECATION") - if (ASSERTIONS_ENABLED) { - if (!value) { - throw AssertionError(message) - } - } -} - /** * Throws an [AssertionError] calculated by [lazyMessage] if the [value] is false * and runtime assertions have been enabled on the JVM using the *-ea* JVM option. diff --git a/libraries/stdlib/src/kotlin/util/Preconditions.kt b/libraries/stdlib/src/kotlin/util/Preconditions.kt index 388318750ae..db138715d9f 100644 --- a/libraries/stdlib/src/kotlin/util/Preconditions.kt +++ b/libraries/stdlib/src/kotlin/util/Preconditions.kt @@ -11,18 +11,6 @@ import java.lang.IllegalStateException */ public fun require(value: Boolean): Unit = require(value) { "Failed requirement" } -/** - * Throws an [IllegalArgumentException] with an optional [message] if the [value] is false. - * - * @sample test.collections.PreconditionsTest.failingRequireWithMessage - */ -@Deprecated("Use require with lazy message instead.", ReplaceWith("require(value) { message }"), DeprecationLevel.ERROR) -public fun require(value: Boolean, message: Any = "Failed requirement"): Unit { - if (!value) { - throw IllegalArgumentException(message.toString()) - } -} - /** * Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is false. * @@ -40,21 +28,6 @@ public inline fun require(value: Boolean, lazyMessage: () -> Any): Unit { */ public fun requireNotNull(value: T?): T = requireNotNull(value) { "Required value was null" } -/** - * Throws an [IllegalArgumentException] with the given [message] if the [value] is null. Otherwise - * returns the not null value. - * - * @sample test.collections.PreconditionsTest.requireNotNull - */ -@Deprecated("Use requireNotNull with lazy message instead.", ReplaceWith("requireNotNull(value) { message }"), DeprecationLevel.ERROR) -public fun requireNotNull(value: T?, message: Any = "Required value was null"): T { - if (value == null) { - throw IllegalArgumentException(message.toString()) - } else { - return value - } -} - /** * Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is null. Otherwise * returns the not null value. @@ -75,18 +48,6 @@ public inline fun requireNotNull(value: T?, lazyMessage: () -> Any): T { */ public fun check(value: Boolean): Unit = check(value) { "Check failed" } -/** - * Throws an [IllegalStateException] with an optional [message] if the [value] is false. - * - * @sample test.collections.PreconditionsTest.failingCheckWithMessage - */ -@Deprecated("Use check with lazy message instead.", ReplaceWith("check(value) { message }"), DeprecationLevel.ERROR) -public fun check(value: Boolean, message: Any = "Check failed"): Unit { - if (!value) { - throw IllegalStateException(message.toString()) - } -} - /** * Throws an [IllegalStateException] with the result of calling [lazyMessage] if the [value] is false. * @@ -105,21 +66,6 @@ public inline fun check(value: Boolean, lazyMessage: () -> Any): Unit { */ public fun checkNotNull(value: T?): T = checkNotNull(value) { "Required value was null" } -/** - * Throws an [IllegalStateException] with the given [message] if the [value] is null. Otherwise - * returns the not null value. - * - * @sample test.collections.PreconditionsTest.checkNotNull - */ -@Deprecated("Use checkNotNull with lazy message instead.", ReplaceWith("checkNotNull(value) { message }"), DeprecationLevel.ERROR) -public fun checkNotNull(value: T?, message: Any = "Required value was null"): T { - if (value == null) { - throw IllegalStateException(message.toString()) - } else { - return value - } -} - /** * Throws an [IllegalStateException] with the result of calling [lazyMessage] if the [value] is null. Otherwise * returns the not null value.