Kotlin 1.4 to improve null-check capabilities
- 28 August, 2019 05:13
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
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
Kotlin has gained a higher profile since being endorsed by Google in May 2017 as an official language for building Android mobile apps, alongside Java. In addition to detailing the plans for Kotlin 1.4, the Kotlin Foundation released Kotlin 1.3.50 with the following features:
- An API for bit manipulation in the standard library, available in a beta form.
- An improved Time and Duration API, also in a beta stage.
- For the JetBrains IntelliJ Idea IDE, Kotlin 1.3.50 improves the Java-to-Kotlin converter to minimize the volume of “red code” to fix manually after a conversion.
- Experimental generation of external dependencies for NPM dependencies in Gradle Kotlin/JS projects, using the Dukat converter. Dukat converts TypeScript files to Kotlin external declarations.
- Java compilation support in multiplatform projects, by calling the new
withJava()function of the DSL.
Where to download Kotlin
You can find instructions on getting started with Kotlin on GitHub.