form, which tells compiler: // "if this function returns successfully, then passed 'condition' is true" contract { returns() implies condition } if (!condition) throw IllegalArgumentException(...) } fun foo(s: String?) { require(s is String) // s is smartcasted to 'String' here, because otherwise // 'require' would have throw an exception }
version of the usual classes, in particular, inline classes must have exactly one property The Kotlin compiler will use this restriction to aggressively optimize runtime representation of inline classes and substitute their instances with the value of the underlying property where possible removing constructor calls, GC pressure, and enabling other optimizations
// In the next line no constructor call happens, and // at the runtime 'name' contains just string "Kotlin" val name = Name("Kotlin") println(name.s) }
suffixes val uint = 42u val ulong = 42uL val ubyte: UByte = 255u // You can convert signed types to unsigned and vice versa via stdlib extensions: val int = uint.toInt() val byte = ubyte.toByte() val ulong2 = byte.toULong() // Unsigned types support similar operators: val x = 20u + 22u val y = 1u shl 8 val z = "128".toUByte() val range = 1u..5u
(de)serializing objects in Kotlin. Previously, it was a separate project, but since Kotlin 1.3, it ships with the Kotlin compiler distribution on par with the other compiler plugins. The main difference is that you don't need to manually watch out for the Serialization IDE Plugin being compatible with the Kotlin IDE Plugin version you're using: now the Kotlin IDE Plugin already includes serialization!
JUST AROUND THE CORNER - KOTLIN 1.3 M2 https://blog.jetbrains.com/kotlin/2018/08/kotlin-1-3-m2/ SEE WHAT'S COMING IN KOTLIN 1.3 M1 https://blog.jetbrains.com/kotlin/2018/07/see-whats-coming-in-kotlin-1-3-m1/ JETBRAINS TV - KOTLIN CONF 2018 https://www.youtube.com/user/JetBrainsTV 23