JetBrains has released a preview of the upcoming release of Kotlin. The Kotlin 1.4-M1 release includes a new, more powerful type inference algorithm that is enabled by default, as well as new features and language changes. 

Within the more powerful algorithm, SAM conversion for Kotlin functions and interfaces allows users to pass a lambda when an interface with one “single abstract method” is expected. Kotlin now supports SAM conversions for both Kotlin interfaces, however, developers need to mark functional interfaces explicitly unlike in Java, according to the company. 

RELATED CONTENT: JetBrains provides insights into Kotlin 1.4 and beyond

Standard library changes include the exclusion of the deprecated experimental coroutines, the removal of the deprecated mod operator, and the deprecation of conversions from floating types to Byte and Short. 

The developers behind Kotlin also revised the common reflection API and now it contains only the members available on all three target platforms (JVM, JS, Native) so that users can be sure that the same code works on all of them. The use of contracts for use() and time measuring functions have also been widened in the standard library.

The Kotlin 1.4-M1 preview also includes the availability of contracts for final member functions, and the Kotlin/JVM compiler now generates type annotations in the bytecode for Java 8+ targets.

“Since version 1.3.70, Kotlin has been able to generate type annotations in the JVM bytecode (target version 1.8+), so that they become available at runtime. This feature had been requested by the community for some time because it makes using some existing Java libraries much easier and gives more power to authors of new libraries,” the developers of Kotlin wrote in a post.

Additional changes include a new backend for Kotlin/JS that brings major improvements to the resulting artifacts, according to Kotlin.

Kotlin 1.4 is not backward-compatible with 1.3 in some corner cases. Details on the new release are available here.