Kotlin 1.2 Release Candidate now out; with support for Java 9

Kotlin, the newly endorsed language for Android app development, has hit version 1.2 and offers an experimental feature enabling reuse of code across platforms, as well as compatibility with the Java 9 module system.

The experimental multiplatform projects capability will allow developers reuse code between target platforms: starting with JVM and JavaScript, and native support, coming later.

While code compilation is produced for both the common and platform-specific parts, and placement can be either in a common module; or platform-dependent parts placed in platform-specific modules.

And developers can express dependencies of common code on platform-specific parts via expected and actual declarations.

The declaration specifies an API, with an actual declaration either platform-specific to the API or a type alias that refers to an existing implementation of the API in an external library. While the standard library features the kotlin.math package for performing mathematical operations in cross-platform code.

Kotlin.math package also offers better precision for math polyfills for JavaScript, with the standard library compatible with newly introduced Java 9 module system, which forbids split packages (multiple .jar files declaring classes in the same package).

In version 1.2, the kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8 artifacts replace the old kotlin-stdlib-jre7 and kotlin-stdlib-jre8.

It eliminates the deprecated declarations in the kotlin.reflect package from the kotlin-reflect library to make support for Java 9 possible.

Other improvements in Kotlin 1.2 include the option to treat all warnings as errors; and enabling the compiler to use information from type casts in type inference. This is especially relevant for Android app development, for the compiler to correctly analyze findViewById calls in Android API Level 26.

The Kotlin version 1.2 release candidate is now available for download on GitHub.
Next Post »