Travis Griggs
03/24/2020, 5:55 PMassert()
to do something meaningful. I note that I’m supposed to run the JVM with -ea
(as per https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/assert.html). But where do I actually do that at?jw
03/24/2020, 6:19 PMTravis Griggs
03/24/2020, 6:39 PMpublic inline fun affirm(value: Boolean, lazyMessage: () -> String = {""}) {
if (!value) {
val message = lazyMessage()
throw AssertionError(message)
}
}
works for for my needsStavFX
03/24/2020, 7:38 PMcheck
and require
will throw IllegalStateException
and IllegalArgumentException
So I’d use them unless you specifically need AssertionError to be thrown.
However, they’ll throw regardless of the JVM args (non development builds)trevjones
03/24/2020, 8:45 PMif condition throw
. Hopefully we see the kotlin assert support added in short order.jw
03/24/2020, 11:10 PMtrevjones
03/24/2020, 11:11 PMjw
03/24/2020, 11:22 PMtrevjones
03/24/2020, 11:23 PMjw
03/25/2020, 2:27 PMStavFX
03/25/2020, 5:48 PMtrevjones
03/25/2020, 5:49 PMjw
03/25/2020, 7:06 PM