Kotlin logo

The Kotlin Blog

Kotlin Programming Language by JetBrains

JavaScript Releases

Kotlin 1.2 Released: Sharing Code between Platforms

Members of our community have translated
this blog post into several languages:

Today we’re releasing Kotlin 1.2. This is a major new release and a big step on our road towards enabling the use of Kotlin across all components of a modern application.

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

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.


For more information on the feature, please check out the documentation.

As mentioned previously, we’re also working on a set of common libraries to allow you to move more of the logic to common code:

  • kotlin.test, included out of the box in Kotlin 1.2, lets you write your test once and run it under both the JVM and JS;
  • kotlinx.html supports isomorphic rendering – using the same code to render HTML in the backend and in the frontend;
  • kotlinx.serialization allows you to easily marshal Kotlin objects between different tiers of your application, using JSON or ProtoBuf as serialization formats.

Note that multiplatform projects are currently an experimental feature; it means that the feature is ready for use, but we may need to change the design in the subsequent release (and if we do, we’ll provide migration tools for existing code).

Compilation Performance

Over the course of development of 1.2, we’ve put a lot of effort in making the compilation process faster. We’ve already reached approximately 25% improvement over Kotlin 1.1, and we see significant potential for further improvements, which will be released in 1.2.x updates.

The graph below shows the difference in compilation times for two large JetBrains projects built with Kotlin:

Other Language and Library Improvements

We’ve also made a number of smaller improvements to the language and the standard library:

  • 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.

For more information and code examples, please see the What’s New in Kotlin 1.2 documentation page.

Kotlin Around the World

Since the release of Kotlin 1.1 in March of this year, Kotlin has made huge gains in adoption all around the world. The culmination of that was KotlinConf, our first worldwide conference, with around 1200 attendees gathering in San Francisco on November 2-3rd. We’ve recorded all the talks, and the videos are now available.

Kotlin is now an officially supported language for Android development, with out-of-the-box support in Android Studio 3.0, as well as official samples and style guides published by Google. As a result, Kotlin is already used in more than 17% of projects in Android Studio 3.0, including many apps from the hottest startups as well as Fortune 500 companies.


On the server side, Spring Framework 5.0 has been released with many Kotlin support features, and vert.x has been supporting Kotlin since their 3.4.0 release. Also, Gradle now comes with support for Kotlin DSL out of the box, and the Gradle Kotlin DSL project is rapidly approaching the 1.0 release.

The number of lines of open-source Kotlin code on GitHub has now exceeded 25 million. And on Stack Overflow, Kotlin is both one of the fastest-growing and one of the least-disliked languages.


The community growing around Kotlin is also really amazing. There are over 100 user groups all around the world, and so many talks that we have a hard time keeping track of all of them – but for those that we do know about, the talks map gives you a very good idea of how wide-spread the use of Kotlin really is.


And for those who’re just starting to learn Kotlin, there’s an ever-growing number of books (including our own “Kotlin in Action”, now available in English, Russian, Japanese, Chinese and Portuguese), online courses, tutorials and other resources.

Meet the Team: Webinar and Reddit AMA

To share with you more information on the new release, we plan to host a webinar on multiplatform projects with Kotlin 1.2 on December 7th, 18:00 CET. Please register; space is limited!

The Kotlin team will also conduct an AMA (Ask Me Anything) on the Kotlin Reddit on December 5th. We’ll start at noon CET, and we’ll be there with you for the next 24 hours.

How to Upgrade

As always, you can try Kotlin online at try.kotlinlang.org.

  • In Maven, Gradle and npm: Use 1.2.0 as the version number for the compiler and the standard library. See the docs here.
  • In IntelliJ IDEA: 2017.3 has Kotlin 1.2 bundled, in earlier versions Install or update the Kotlin plugin to version 1.2.
  • In Android Studio: Install or update the plugin through Plugin Manager.
  • In Eclipse: install the plugin using Marketplace.
  • The command-line compiler can be downloaded from the Github release page.

Compatibility. In Kotlin 1.2 the language and the standard library are backwards compatible (modulo bugs): if something compiled and ran in 1.0 or 1.1, it will keep working in 1.2. To aid big teams that update gradually, we provide a compiler switch that disables new features. Here is a document covering possible pitfalls.

Have a nice Kotlin!

Comments below can no longer be edited.

46 Responses to Kotlin 1.2 Released: Sharing Code between Platforms

  1. soywiz says:

    November 28, 2017

    Spanish translation: http://kotlin.es/2017/11/1.2.0/


    November 28, 2017

    Is the Multiplatform Projects initiative competing with Xamarin and React Native? I’m trying to decide which platform to study right now.

    • Dmitry Jemerov says:

      November 28, 2017

      This depends on when you want to have results. Sharing Kotlin code between Android and iOS is not quite there yet; it’ll take some more time for us to build the missing pieces. Also, our approach is focused on sharing only business logic between platforms, not UI code. If you want to share UI between platforms, you should look into other technologies.

      • Antoni Mysliborski says:

        December 5, 2017

        Would it be possible to write using React Native but with Kotlin instead of JavaScript?

        • Dmitry Jemerov says:

          December 5, 2017

          It is possible now, but React Native is not the technology stack that we’re currently focusing on supporting.

          • Antoni Mysliborski says:

            December 7, 2017

            Do you know about anyone who managed it? I tried to search for some examples but couldn’t find any. Given the rising popularity of RN it would be nice to be able to use it with some saner language than JS 🙂

            • Dmitry Jemerov says:

              December 7, 2017

              A team at JetBrains did that, but as far as I know they never published any code (and the code they had wasn’t really production quality).

    • yeradis says:

      November 29, 2017

      Check Flutter.io

  3. Sroka says:

    November 28, 2017

    Great work guys! I have question regarding availability of coroutines in JS target. Is it already there?

  4. Даниил Водопьян says:

    November 28, 2017

    Mutating the backing field of a read-only property by assigning field = … in the custom getter has been deprecated

    Was it done for a technical reason, or just to prevent terrible code?

  5. David Scrève says:

    November 28, 2017

    Why kotlin is not available in WebStorm while kotlin native is shipped with CLion ?

    • Dmitry Jemerov says:

      November 28, 2017

      We plan to build a WebStorm version of the Kotlin plugin similarly to the way the CLion plugin was done; it’s simply not implemented yet.

  6. Werner Punz says:

    November 28, 2017

    Btw. is there any reason why you guys compile against a huge kotlin.js runtime library in your javascript compile target. Even for things which javascript perfectly fine can handle itself (like classes, inheritance etc…)
    I wanted to use kotlin as high level frontend for a js library but the kotlin.js dependency basically prevented that, oh well back to typescript then.

    • Dmitry Jemerov says:

      November 28, 2017

      There is much more than one possible set of semantics for classes; both C++ and Java have classes, but they look completely different. In the same way, Kotlin/JS needs to support the Kotlin semantics for classes, and not whatever is supported by JS.

      We’ve also built a dead code elimination tool that greatly reduces the size of the standard library dependency in most projects.

      • Marius K says:

        November 29, 2017

        Well, Scala.js supports defining real JS classes:


        • Werner Punz says:

          December 1, 2017

          You do not have to go to Scala for examples here.
          Typescript is the perfectly fine example with its approach of it must be compilable into pure ecmascript on all supported language levels.

          class bla {

          is compiled against real javascript classes in es6 and higher
          and against prototype inheritance in lower dialects of es.
          Heck if pure es classes do not do it you always can fall to prototypes which are one level deeper.

          But that is just an example. The problem simply is that every compilation relies on a runtime file which is a no go for third party libraries. Kotlin itself is a nice language however and it might be a viable option for many js projects, just not for mine.

  7. Jan Vladimir Mostert says:

    November 29, 2017

    This is great news, well done!!

  8. Melanie Myers says:

    November 29, 2017

    I just updated today.

    When I create a new Kotlin file in my Kotlin project, it opens as .kt file but Intellij treats it as a regular text file (no auto-complete of main, etc.).

    However, when I create a new Kotlin class, it opens as a .kt file but treats it as an actual Kotlin file. This is true even after I delete the class declaration in the new file.

    Is this a bug or a part of the new design?


    • Dmitry Jemerov says:

      November 29, 2017

      This is an IntelliJ issue. To fix it, please open Settings | Editor | File Types, select “Text” in the list and make sure that there are no Kotlin-related file names in the “Registered Patterns” list.

  9. Dima Rostopira says:

    November 29, 2017

    HI! I can’t update plugin in Android Studio 3.0.1 from latest stable (1.1.61), it tells me “Plugin not installed” where I can share log?

  10. Nhuy S Van says:

    November 29, 2017

    I like Java but, man, Kotlin will take its place on the chart in no time. I love Kotlin. Thank you for creating such an awesome language. By the way, do you guys plan on having array, list and map literals like Groovy does?

    • Dmitry Jemerov says:

      November 29, 2017

      Possibly. This is still being discussed.

  11. Uwe Aime Van says:

    November 29, 2017

    Do you guys have plan to allow kotlin works along side of OIS platorm

    • Dmitry Jemerov says:

      November 29, 2017

      We have recently announced support for iOS development in Kotlin, using Kotlin/Native. Support for reusing code between iOS and other platforms is planned for a future update.

      • kiquetal says:

        December 14, 2017

        I’d love to see an example using swift and kotlin 😀

    • Drc_ZeaRot says:

      December 1, 2017

      This translation is mismarked as Taiwanese.

  12. smallufo says:

    November 29, 2017

    Can I depend my common code on Java’s libraries ? such as Optional / Stream / LocalDateTime ? Will they be translated to JS too ? Or it’s better make the common code as Kotlin as possible ?

    • Dmitry Jemerov says:

      November 30, 2017

      No, common code can only depend on other common libraries. Kotlin has no support for translating Java bytecode into JS.

  13. xilin says:

    November 30, 2017

    is there any chinese translation?


    December 1, 2017

    Thanx guys for such good work. Kotlin spb one love

  15. Jakub Błaszczyk says:

    December 2, 2017

    do you plan to enhance kotlin.test library with compiler-driven mock generation in spirit of Mockito? that would positively impact performance of CI pipelines out there 🙂
    how about AssertJ-inspired DSL? or Cucumber? do you have a clear roadmap for testing side of kotlin?

    • Dmitry Jemerov says:

      December 4, 2017

      We have no plans to build a mock generation library for Kotlin at this time. For fluent assertions, there are quite a few third-party solutions, including hamkrest and kotlintest. Cucumber already works with Kotlin, as far as I understand; the only thing missing is IDE support, which we’ll likely add at some point.

  16. Samson Ajax says:

    December 3, 2017

    I love Kotlin. I have chosen it as my language. Can i use Kotlin to develop Window application and probably to work on other platform too?

    • Dmitry Jemerov says:

      December 4, 2017

      Yes, you can. The JVM runs on all modern desktop operating systems, so you can run Kotlin code under any OS.

  17. Sevil says:

    December 10, 2017

    Such a great news – looking forward to try it with both iOS and Android when it is a little bit more mature. Android development hasn’t been so much fun for really long time for me. Thank you so much!

  18. João Fonseca says:

    December 19, 2017

    It looks like a very promising language, and I’m eager to start using it in my projects. Compatible and in many ways better than Java, and a suitable replacement for Javascript – the promise of unifying the front-end and back-end with a single programming language is a very powerful concept.

    What’s missing: better IDE support. If we don’t have reliable code-completion, syntax checking, snippets, etc, we’re back in the 90s. I won’t change programming language until this is fixed. The IDEA support is understandably better, but all other IDEs are treated as distant cousins – specially Netbeans, the plugin seems not to be maintained (last commit from August).

    Focus on IDE support and you’ll have more people using it!

    • Dmitry Jemerov says:

      December 19, 2017

      We are focusing heavily on IDE support, and the IDE we’re focusing on is IntelliJ IDEA. The statistics we saw for our NetBeans plugin were so low that unfortunately we cannot invest further into the development of the plugin.

      • João Fonseca says:

        December 19, 2017

        That’s unfortunate, in my view that will hurt the adoption rate of Kotlin.

        It’s difficult enough to convince people to move into a new programming language, but it’s even harder (or impossible) to make them switch from their favourite IDE into a new one.

        To promote Kotlin, all IDEs should be supported, including the HTML5 code editors (Atom, etc).

        • Dmitry Jemerov says:

          December 19, 2017

          Android Studio and Xcode show that this is totally possible to make people switch from their favorite IDE if they need to do this in order to build the app they want to build.

  19. Plamen says:

    December 27, 2017

    Any plans to have value semantic objects similar to struct-s in Swift ? Kotlin data classes are close and nice but still have a reference semantic.

    • Dmitry Jemerov says:

      December 28, 2017

      This requires support from the JVM. We’re tracking Project Valhalla, which plans to add value types support to the JVM, and plan to also support it in Kotlin once the JVM support is available.

Discover more