News

Kotlin 1.4 to improve null-check capabilities

admin Written by admin · 33 sec read >

Kotlin 1.4, a planned upgrade to the statically typed JVM language created by JetBrains, is set to add null-check optimizations.

Starting with the Kotlin 1.4 release, all runtime checks will throw a java.lang.NullPointerException instead of a KotlinNullPointerException, IllegalStateException, IllegalArgumentException, and TypeCastException

The change is designed to open up more possibilities for null check optimizations by the Kotlin compiler or bytecode processing tools such as the Android R8 optimizer. It will apply to the !! operator, parameter full checks in the method preamble, the as operator with a non-null type, and platform-typed expression null checks. The change will not apply to lateinit null checks and explicit library calls such as checkNotNull or requireNotNull.

To read this article in full, please click here