Kotlin logo


A concise multiplatform language developed by JetBrains


Kotlin M2 is Out!

Some news websites told you that Kotlin M2 was out earlier this week. Well, now we make it come true :)

In the M2 Candidate post I told you about JavaScript and Android support, as well as new Language Features. Now it’s time for more updates, examples and plans.

Proceed to Kotlin M2 Installation Instructions.

A Little More on The Language

The previous post gave an overview of the new Language Features. Here’s a little more:

First, I’d like to remind you that in M1 we added the “assert not null” operator: !!, it replaces the sure() function we used to have in the standard library. Now, we removed sure() from the library, so some of you code might break, but it’s very easy to fix.

People keep asking whether Kotlin has literals for lists or maps. The answer is: strictly speaking, no, but we have function in the library that are good enough for that:

val list = arrayList(1, 2, 3)
val map = hashMap(
    "John" to "Doe",
    "Jane" to "Smith"

Note that to() is also a function.

Also note that now you can use any type that has a function named invoke() in a callee position:

fun foo(x : Method) {

You could only use function types in this role before, now you can turn any object into a “function” by providing an invoke() extension or member.

I have to apologize for not all of that being present in the docs yet. A little piece of good news is that we are working on making our docs open source as well as the rest of the project. Now you can find the sources (in Confluence wiki format) in our github repo, and thus contribute your corrections/additions in the for of pull-requests.

A little more news on the docs: our KDoc tool is maturing rapidly, thanks to James Strachan. Now it supports search and links to github sources of the libraries.


As I mentioned above, the big things in this milestone were JavaScript support in the IDE and Android. It’s always good to start with examples, so here’s a set of projects you can open in your IDE and play with. Please, find some instructions in the previous post.

Examples for JavaScript:

Examples for Android:

have fun playing with these examples, and contribute more!

IntelliJ IDEA Plugin

The IntelliJ IDEA plugin is progressing pretty fast. Most of the work is done behind the scenes (performance, tighter integration with the Java IDE), but there’re a few user-facing things to point out, too:

  • The IDE now displays error messages formatted in nice HTML-like way, which makes the messages more readable.
  • Enjoy the “Specify explicit type” refactoring when you need to add a type to your declaration.
  • Cross-language Find Usages and Rename between Kotlin and Java code is now supported.
  • Navigation to inheritors is supported. This also works across languages: inside Kotlin, for Kotlin classes extending Java classes, and vice versa.
  • Also, we changed the IDE icons, and they are very nice now. More work coming on this topic.

Our priority for the next milestone is IDE performance and improvements to null-safety support for Java classes.

To install the M2 plugin: If you had you M1 installed, it will update automatically from the plugin repository. It checks for updates once a day, so if you don’t want to wait, initiate the check manually:

You will be prompted to update your Kotlin library, since the annotation format has changed a little. If you miss the “Update Kotlin Runtime” balloon, open the message in the Event Log:

Note that you have to uninstall the M2 Candidate and any nightly builds of the Kotlin plugin or builds installed manually before installing M2 from the main plugin repository.

Build Tools: Ant and Maven

Our build tools integration, including Maven, has improved a little bit fewer repositories, easier set-up process. You may need to update your pom’s. See instructions here.


A little more on what we plan to do next. As mentioned above, the IDE priorities are performance and Java-integration wrt null-safety. The language work will bring the following improvements:

  • Kotlin will provide means of defining properties that turn into Java’s static final constants.
  • We will support the concept of data classes, that are somewhat similar to Scala’s case classes.
  • Kotlin will support a dynamic type, which is needed mostly to accommodate the JavaScript APIs that don’t fit with the statically typed approach.
  • We’ll also improve the type inference algorithm tremendously. We owe you this for a long time by now…

Library-wise the plans are as follows:

  • Port most of the Kotlin’s standard library to the JS platform.
  • Make Kotlin’s collections variant, but preserve the seamless interop with java.util.* collections. This actually deserves a separate post.
  • Provide good library support for Android. We suspect that most of Android’s XML files can be replaced with Kotlin’s builders that are much nicer in many ways…

Have a nice Kotlin!

And don’t forget to give us feedback. Thanks.

image description