Kotlin 1.1-M03 is here!

We are pleased to announce the third milestone of the upcoming Kotlin 1.1. This release brings new language features as well as improvements and fixes in the JavaScript backend, compiler and IDEA plugin. The new release also includes all tooling features introduced in Kotlin 1.0.5, and is compatible with IntelliJ IDEA 2016.3 EAP and Android Studio 2.2 and 2.3.

As with other milestone releases, we give no backwards compatibility guarantees for new language and library features. Anything introduced in milestone releases of 1.1 is subject to change before the final 1.1 release.

Please do share your feedback regarding the new features or any problems that you may run into with this release, via YouTrack, forums and Slack.

The full changelog for 1.1-M03 is available here.

Underscore for unused symbols

You can now use an underscore instead of the name of an unused parameter of a lambda:

foo { _, x -> ... }

And an unused variable name in destructuring declarations can now be replaced with an underscore as well.

val (x, _, z) = expr

Both cases are described in detail in the appropriate KEEP.

Underscore in numeric literals

In accordance with Java 8 specification, Kotlin supports now numeric literals with single underscore symbols between digits. For example:

val ONE_MILLION = 1_000_000

See the KEEP for more details and examples.

Generic Enum values access

The support of the proposal is landed to the standard library in a form of two intrinsic functions:

inline fun <reified T : Enum<T>> enumValues(): Array<T>
inline fun <reified T : Enum<T>> enumValueOf(name: String): T

They allow to enumerate the values of a generic enum type. E.g.

enum class RGB { RED, GREEN, BLUE }

print(enumValues<RGB>().joinToString { }) // prints RED, GREEN, BLUE

Scope control for builder-like DSLs

As described in details in the KEEP, DSL authors had problems in expressing scope restrictions for builder-like constructs. E.g., for some html-builder DSL:

table {
  tr {
    tr {} // PROBLEM: is valid here

To solve the problem we added the @DslMarker annotation that allows to control visibility scope in these cases more precisely. For usage example see  preview version of kotlinx.html library using this feature (see HtmlTagMarker and HTMLTag implementations and for the preview library usage info).

Standard library unification

The standard library unification process for different platforms is moving forward. We have started unifying exception types in 1.1-M2 and now some more common types, which are supported on all platforms, are available in kotlin.* packages, and are imported by default. These include:

  • ArrayList, HashSet, LinkedHashSet, HashMap, LinkedHashMap in kotlin.collections
  • Appendable and StringBuilder in kotlin.text
  • Comparator in kotlin.comparisons

On JVM these are just typealiases of the good old types from java.util and java.lang

New language features support in the JavaScript backend

JavaScript backend now supports the following Kotlin language features on par with JVM backend:

  • Coroutines
  • Destructuring in lambda parameters
  • Unused variable name in destructuring declaration

JS code generation improvements

JavaScript backend now generates more statically checkable code, which is friendlier to JS code processing tools, like minifiers, optimisers, linters, etc.

How to Try It

In Maven/Gradle: Add as a repository for the build script and your projects; use 1.1-M03 as the version number for the compiler and the standard library.

In IntelliJ IDEA: Go to Tools → Kotlin → Configure Kotlin Plugin Updates, then select “Early Access Preview 1.1” in the Update channel drop-down list, then press Check for updates.

Drive to Kotlin!

Comments below can no longer be edited.

11 Responses to Kotlin 1.1-M03 is here!

  1. Avatar

    Tim van der Leeuw says:

    November 24, 2016

    The generic value access works when I know at compile time what the Enum will be, but will it also work when at compile time I do not yet know which Enum I wish to access? If the enum class itself will be a runtime parameter of type Enum or something similar?

    How should I pass it to these enumValueXXX() functions in such a case?

    That’s a case which I’ve had to handle a couple of times.

  2. Avatar

    Sergey says:

    November 25, 2016

    JavaScript backend now generates more statically checkable code

    Good news! Are there any plans of integration with google closure compiler? For example, type info in js doc for DisambiguateProperties-like optimizations? If so, it will be really good alternative for dart/typescript (their IDE support is still missing of many refactorings, and coding is still painfull)

    • Avatar

      Alexey Andreev says:

      November 25, 2016

      There are plans, indeed. Google Closure Compiler does not require anything special, you can just try to process Kotlin-generated JS files by Google Closure Compiler. Or did you mean something else?

      You can try advanced mode, and leave feedback. What we really need is to investigate why GCC does not remove some code that it could have removed, and integrate GCC passes into our JS test suites.

  3. Avatar

    Max says:

    November 25, 2016

    Scope control for builder-like DSLs

    Hallelujah. I’ve been wanting this since last January:

  4. Avatar

    sandeep says:

    November 25, 2016

    guys – could you also publish zip files of this ? everything seems to mandate download of intellij first.

    i just want to try out kotlin scripting.

    • Avatar

      Ilya Chernikov says:

      November 25, 2016

      You can use bintray repo in maven or gradle, as it is mentioned at the end of the post, to get the compiler and the libs without Intellij IDEA.

    • Avatar

      Ilya Chernikov says:

      November 25, 2016

      and now the zip with compiler is released as well – see

  5. Avatar

    Kotlin>Java says:

    November 26, 2016

    I’m having trouble upgrading my Kotlin version to 1.1 in Android Studio. It tells me I have the latest version – 1.1-M03-release-Studio2.2-2 installed, but I can’t seem to get it working by upgrading my gradle ext.kotlin_version – I don’t know what to put in there – right now I have “1.0.5” and I tried “1.1-M03” and “1.1” and “1.1-M03-release-Studio2.2-2” and nothing will compile.
    What should I put in there?

    Also, since I’m posting here, I would just like to point out that after a few instant-runs, they stop working with changed Kotlin files (I get some dex errors) and the app has to be restarted the old-fashioned way. Are you aware of this?

    Best regards

    • Avatar

      Ilya Chernikov says:

      November 28, 2016

      From the blog-post above:

      In Maven/Gradle: Add as a repository for the build script and your projects; use 1.1-M03 as the version number for the compiler and the standard library.

  6. Java Annotated Monthly – December 2016 – WewUnik | Tips For Your Life says:

    December 5, 2016

    […] Kotlin stays a agency favorite with Android builders. Right here’s 5 stuff you in all probability didn’t know and an introduction to Kotlin configuration scripts. Additionally,  1.1-M03 is out now. […]