fabianhjr
07/30/2022, 1:24 AM// ^ Try different backends
// v And commenting out or not
// @JvmInline
value class NonEmptyString(val value: String) {
init {
require(value.isNotEmpty())
}
}
fun main() {
println(NonEmptyString("Hello"))
try {
println(NonEmptyString(""))
} catch(e: Throwable) {
println("Woops!")
}
}
Jeff Lockhart
07/30/2022, 2:53 AM@Static
annotation which would map to @JvmStatic
on Kotlin/JVM, while introducing a similar annotation for Kotlin/Native, maybe @NativeStatic
. I created this YouTrack for this.fabianhjr
07/30/2022, 2:54 AM@Static
would work on all backends (even non implemented ones in that hypothetical such as Kotlin/JS)Tlaster
07/30/2022, 6:33 AM#if JVM
to define anything for just JVM code, and there will be no need to define a common @Static
Jeff Lockhart
07/30/2022, 9:32 AMfabianhjr
07/30/2022, 4:36 PM