Kotlin 1.2 Released

JetBrains released version 1.2 of the Kotlin programming language.  Kotlin is a statically typed JVM based language that also has the ability to be compiled to JavaScript.  The goal of Kotlin is to be a “better Java”, while remaining fully intraoperative with the Java language and ecosystem.  AsKotlin of Android Studio 3.0, Kotlin is a first class language in that IDE.

In regards to the Kotlin 1.2 release:

In Kotlin 1.1, we officially released the JavaScript target, allowing you to compile Kotlin code to JS and to run it in your browser. In Kotlin 1.2, we’re adding the possibility to reuse code between the JVM and JavaScript. Now you can write the business logic of your application once, and reuse it across all tiers of your application – the backend, the browser frontend and the Android mobile app. We’re also working on libraries to help you reuse more of the code, such as a cross-platform serialization library.

Kotlin 1.2 is already bundled in IntelliJ IDEA 2017.3, which is being released this week. If you’re using Android Studio or an older version of IntelliJ IDEA, you can install the new version from the Tools | Kotlin | Configure Kotlin Plugin Updates dialog.

This release includes a lot of work done by external contributors, and we’d like to thank everyone who sent us feedback, reported issues, and especially those who submitted pull requests.

Multiplatform Projects

A multiplatform project allows you to build multiple tiers of your application – backend, frontend and Android app – from the same codebase. Such a project contains both common modules, which contain platform-independent code, as well as platform-specific modules, which contain code for a specific platform (JVM or JS) and can use platform-specific libraries. To call platform-specific code from a common module, you can specify expected declarations – declarations for which all platform-specific modules need to provide actual implementations.

Multiplatform projects isn’t the only new feature of Kotlin 1.2, other new 1.2 features include:

  • A more concise syntax for passing multiple arguments to an annotation (array literals);
  • Support for the lateinit modifier on top-level properties and local variables, as well as checking whether a lateinit variable is initialized;
  • Smarter smart casts and improved type inference in certain cases;
  • Compatibility of the standard library with the split package restrictions introduced in Java 9;
  • New kotlin.math package in the standard library;
  • New standard library functions for working with sequences and collections, including a set of functions for breaking a collection or sequence into potentially overlapping groups of a fixed size.

You can learn more about the release on their blog as well as in the more detailed What’s New article.  I did a cheat sheet for programmers used to other languages to get up to speed with Kotlin.  This was written shortly after the language was released however, so may not be current in regards to modern Kotlin language features.

Programming


Scroll to Top