diff --git a/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt b/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt index e4210cb2404..c1e17d607a1 100644 --- a/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt +++ b/libraries/stdlib/src/kotlin/util/AssertionsJVM.kt @@ -6,10 +6,19 @@ private object _Assertions deprecated("Must be public to make assert() inlinable") public val ASSERTIONS_ENABLED: Boolean = _Assertions.javaClass.desiredAssertionStatus() +/** + * Throws an [AssertionError] if the [value] is false + * and runtime assertions have been enabled on the JVM using the *-ea* JVM option. + */ +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 }")) public fun assert(value: Boolean, message: Any = "Assertion failed") { if (ASSERTIONS_ENABLED) { if (!value) {