Kotlin 1.1 Released with JavaScript Support, Coroutines and more

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

Today we release Kotlin 1.1. It’s a big step forward enabling the use of Kotlin in many new scenarios, and we hope that you’ll enjoy it.

Kotlin 1.1

Our vision for Kotlin is to enable the use of a single expressive, performant, strongly typed language across all components of a modern application. Kotlin 1.1 makes two major steps towards this goal.

First, the JavaScript target is no longer experimental, and supports all Kotlin language features, a large part of the standard library, as well as JavaScript interoperability. This allows you to migrate the browser frontend of your applications to Kotlin, while continuing to use modern JavaScript development frameworks such as React.

Second, we’re introducing support for coroutines. As a lightweight alternative to threads, coroutines enable much more scalable application backends, supporting massive workloads on a single JVM instance. In addition to that, coroutines are a very expressive tool for implementing asynchronous behavior, which is important for building responsive user interfaces on all platforms.

Below we describe these two changes further. In other news: we’ve added type aliases, bound callable references, destructuring in lambdas and more. See the details in our What’s new page (check out the runnable examples!).

Coroutines

Coroutines in Kotlin make non-blocking asynchronous code as straightforward as plain synchronous code.

Asynchronous programming is taking over the world, and the only thing that is holding us back is that non-blocking code adds considerable complexity to our systems. Kotlin now offers means to tame this complexity by making coroutines first-class citizens in the language through the single primitive: suspending functions. Such a function (or lambda) represents a computation that can be suspended (without blocking any threads) and resumed later.

Technically, coroutines are light-weight means of cooperative multi-tasking (very similar to fibers). In other words, they are just much better threads: almost free to start and keep around, extremely cheap to suspend (suspension is for coroutines what blocking is for threads), very easy to compose and customize.

We designed coroutines for maximum flexibility: very little is fixed in the language, and very much can be done as a library. The kotlinx.coroutines project features libraries on top of Rx, CompletableFuture, NIO, JavaFx and Swing. Similar libraries can be written for Android and JavaScript. Even many built-in constructs available in other languages can now be expressed as Kotlin libraries. This includes generators/yield from Python, channels/select from Go and async/await from C#:

Read more in our docs.

An important note. With all the benefits that they bring, Kotlin coroutines are a fairly new design that needs extensive battle-testing before we can be sure it’s 100% right and complete. This is why we will release it under an “experimental” opt-in flag. We do not expect the language rules to change, but APIs may require some adjustments in Kotlin 1.2.

JavaScript support

As mentioned above, all language features in Kotlin 1.1, including coroutines, work on both JVM/Android and JavaScript. (Reflection for JavaScript is not available, but we’re looking into it.) This means that a web application can be written entirely in Kotlin, and we already have some experience doing that inside JetBrains. We will publish tutorials and other materials about this soon.

Kotlin for JavaScript has dynamic types to interoperate with “native” JavaScript code. To use well-known libraries through typed APIs, you can use the ts2kt converter together with headers from DefinitelyTyped.

We support both Node.js and the browser. The Kotlin Standard Library is available for use through npm.

Read more in our docs.

Tooling

Kotlin 1.1 is not a major release for Kotlin tooling: we prefer shipping tooling features that do not affect the language itself as soon as they are ready, so you’ve seen many such improvements in Kotlin 1.0.x versions. To highlight a few:

  • Kotlin plugins for all the major IDEs: IntelliJ IDEA, Android Studio, Eclipse and NetBeans
  • Incremental compilation in both IntelliJ IDEA and Gradle
  • Compiler plugins for Spring, JPA and Mockito (making classses open and generating no-arg constructors)
  • kapt for annotation processing
  • Lint support for Android projects
  • Numerous IDE intentions, inspections, quick fixes, refactorings and code completion improvements

We’ll keep working to make our tooling even better and deliver the updates in 1.1.x versions.

First year of Kotlin: Adoption and Community

In short, Kotlin is growing. We’ve seen over 160’000 people using it during the last year. OSS projects on Github grew from 2.4M to 10M lines of Kotlin code (about 4x). Our Slack community has grown from 1’400 to over 5’700 people (over 4x). Numerous meet-ups and user groups are organized by the community around the world. We are seeing more and more Kotlin books and online courses published.


Kotlin GitHub Stats

Kotlin is equally strong with server-side and Android developers (roughly 50/50 divide). Spring Framework 5.0 has introduced Kotlin support, so did vert.x 3.4. Gradle and TeamCity are using Kotlin for build scripts. More projects using Kotlin can be found at kotlin.link.

Many well-known companies are using Kotlin: Pinterest, Coursera, Netflix, Uber, Square, Trello, Basecamp, amongst others. Corda, a distributed ledger developed by a consortium of well-known banks (such as Goldman Sachs, Wells Fargo, J.P. Morgan, Deutsche Bank, UBS, HSBC, BNP Paribas, Société Générale), has over 90% Kotlin in its codebase.

We are grateful to all our users, contributors and advocates in all parts of the world. Your support is very important to us!

Organize your own Kotlin 1.1 Event

Kotlin 1.1 is a good reason to meet up with your local user group and friends. We have prepared some materials to help you organize such an event. On March 23 we’ll stream live sessions featuring the Kotlin team members, plus there’s an organizers pack that includes some swag and a Future Features Survey. Get more info and register your event here.

What’s next

To make Kotlin a truly full-stack language, we are going to provide tooling and language support for compiling the same code for multiple platforms. This will facilitate sharing modules between client and server. We will keep working on improving the JavaScript tooling and library support. Among other things, incremental compilation for the JavaScript platform is in the works already. Stay tuned for 1.1.x updates.

Java 9 is coming soon, and we will provide support for its new features before it ships.

We expect a lot of feedback on coroutines in the upcoming months, and improving this area of the language (in terms of both performance and functionality) is among our priorities.

Apart from this, our next release will be mostly focused on maintenance, performance improvements, infrastructure and bugfixing.

P.S. Running on multiple platforms is a strategic direction for Kotlin. With 1.1 we can run on servers, desktops, Android devices and browsers, but in the future we are going to compile Kotlin to native code and run on many more platforms (including, for example, iOS and embedded devices). A great team here at JetBrains is working on this project, and we are expecting to show something interesting fairly soon. This does not target any particular release yet, though.

Installation instructions

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

In Maven/Gradle: Use 1.1.0 as the version number for the compiler and the standard library. See the docs here.

In IntelliJ IDEA: 2017.1 has Kotlin 1.1 bundled, in earlier versions Install or update the Kotlin plugin to version 1.1.

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.1 the language and the standard library are backwards compatible (modulo bugs): if something compiled and ran in 1.0, it will keep working in 1.1. 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!

P.S. See discussions on Reddit and Hacker News

This entry was posted in Releases and tagged . Bookmark the permalink.

79 Responses to Kotlin 1.1 Released with JavaScript Support, Coroutines and more

  1. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Ace Infoway

  2. Pingback: [速報]Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Kotlin Blog|話題|オートアンテナ

  3. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and More – #OpIcarus

  4. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Kotlin Blog:ニュースシェア2chまとめアンテナ

  5. Nguyen says:

    Thanks for your amazing work! I cannot wait to test it!!!

  6. Cesar Arcila says:

    Great, now I can feel that my project (onmind.co) could be wrote all in kotlin. May be you could consider a kotlin loader for “webpack”. Thanks a lot and congratulations.

    • Alexey Andreev says:

      Is absence of webpack loader is a show-stopper for you? What about building JS files from Gradle and then feeding these files to webpack? It’s not very convenient, but at least makes it possible to develop apps for browser.

    • Dmitry Jemerov says:

      We’re working on a Gradle plugin to integrate the Kotlin JS compiler with webpack, and we’ll publish it fairly soon.

      • Benjamin says:

        Thanks for info. I’m really looking forward to this. We’re using Webpack + Maven currently but I’d be happy to test KotlinJS for frontend code since we now use Kotlin on the backend part of the application with great success.

        The project has a fairly large JavaScript code base (ES6 via Babel). Migrating all the code to Kotlin wouldn’t be an option but it would be really nice if we could use KotlinJS for new modules and integrate them into the existing Webpack bundle.

      • Cesar Arcila says:

        It would be very good, the idea is to simplify and feel fluent in the web development process, I will be following this. Thanks

    • Zalim Bashorov says:

      Also, feel free to vote (or star) the issue about it to get notifications about updates

  7. Eugene says:

    Hi. Speaking about tooling, do you plan to support Kotlin in code quality measurement tools (Sonarqube, Cobertura etc.)?

    • Dmitry Jemerov says:

      Cobertura works by analyzing .class files and should work with Kotlin without any special support from our side. For SonarQube, we don’t have any short-term plans to create a plugin, but it doesn’t have to be us – anyone from the community can build one.

      • Alexander Blake says:

        What’s the difference between Kotlin and Haxe? Isn’t Haxe a cross platform language and environment that does everything Kotlin does but is more mature?

  8. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Kotlin Blog レビュー

  9. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Kotlin Blog/話題/ノマドアンテナ

  10. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and more | ExtendTree

  11. Pingback: Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Kotlin Blog /ニュースラボ2ちゃんねる

  12. Pingback: [2ch]Kotlin 1.1 Released with JavaScript Support, Coroutines and more | Kotlin Blog|話題|2blog

  13. Jacob Moncur says:

    Are there any good samples/examples of using React from Kotlin?

    • he guangyu says:

      In addition, are there any example of using React and Redux? I think such a example will attract web developers, such as Kotlin for Android Developers.

    • Dmitry Jemerov says:

      We plan to publish a sample project for Kotlin with React in the coming days.

      • Roman Ivanov says:

        Are you using ts2kt converter or use custom lib in this React project? When I tried to apply it to DefinetilyTyped/react, there were a lot of unresolved references.

        • Zalim Bashorov says:

          Are you using ts2kt converter or use custom lib in this React project?

          Right now we are using handwritten declarations.

          When I tried to apply it to DefinetilyTyped/react, there were a lot of unresolved references.

          Thank you, I see some bugs in converter with it and I’ll take a look to it.
          Unfortunately, not all TS declarations can be converted to Kotlin fully automatically, sometimes it requires some manual works. We’ll continue working on the converter to minimize the number of manual works.

          In general, right now ts2kt works better with declarations from types branch since master branch heavily use futures from TS 2.0+

      • Tom Tantisalidchai says:

        That’s awesome! Is it possible to have early access to the sample project with React, or is it already there somewhere?

  14. Michał says:

    Great! Congratulations!

  15. Pingback: DBmaestro’s DevSecOps feature, JetBrains’ Kotlin 1.1, and Tableau 10.2—SD Times news digest: March 1, 2017 - Khabri No 1

  16. Lionel says:

    What about light weight JavaScript?
    The kotlin.js and stdlib.js are several MB…
    We’ll work on it…

  17. How are couroutines related to Actors? Can you implement the Actor model using coroutines? Will there be a Kotlin couroutine based “Akka implementation”?

    • Roman Elizarov says:

      An actor is a combination of a coroutine, the state that is confined and is encapsulated into this coroutine, and a channel to communicate with other coroutines. You can read more here: https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md It has an example on actors, but I’d suggest to start reading it from the start.

      • Eric Fruttero says:

        While you’re here, thanks for the Guide.
        Very nice.

      • Thanks, it would be interesting to have — at least a reference — to an explanation how your Actors approach is different to Scala’s Actors implemented in Akka. And in case you create something similar to Akka, please don’t call it “KAkka” 😉

        • Roman Elizarov says:

          For one key difference, actor with coroutines is just one particular code pattern (a coroutine that receives on its inbox channel). You are not limited in combining channels with coroutines in this particular way that an actor model prescribes. Look at other examples. You can have coroutines that produce streams of elements (they don’t have an inbox at all) or ones that receive from multiple channels simultaneously.

          The other difference is that Akka is a pretty big framework, while coroutines and channels (that you can combine to write actors) are just small library utilities.

    • Oliver Plohmann says:

      Coroutines are based on “communicating sequential processes” or short CSP (see https://en.wikipedia.org/wiki/Communicating_sequential_processes) as created by Tony Hoare. This is the guy who invented the null value and called this his billion dollar mistake.

      CSP and actors are a very different approach to concurrency. Go from Google is entirely based on CSP (well, the Go-variant of CSP). There is this very famous presentation about CSP in Go by Robert Pike (the Go language development lead) with the title: “Concurrency is not parallelism”. This will give you some idea about it, see https://blog.golang.org/concurrency-is-not-parallelism.

      Actually, CSP makes concurrent programming a lot easier than actors as you don’t have actors that send messages asynchronously to other actors. Asynchronous programming is inherently difficult and Akka makes no difference to this (although the marketing slogans are sometimes different …). In CSP you have coroutines that do blocking takes from channels. So you can see exactly how the message flow is taking place in your application, because you can see who puts what into which channel and who takes from them. A blocking take means that the thread is waiting on the channel and cannot be reused till the channel receives some items. This is not a problem in CSP, because there can be many many coroutines (think fibers instead of threads). This is because coroutines have a reduced context and therefore do not use up that much memory. The downside of this is that coroutines in CSP are not pre-emptive.

      I suggest you have a look at CSP in Go and CSP in general. This will give you some pretty good idea of this approach.

      • Eric Fruttero says:

        That, and JCSP. I also recommend the excellent book by Jon Kerridge “Using Concurrency and Parallelism Effectively”

  18. Pingback: Kotlin 1.1 正式版来了,基于 JVM 的编程语言 | 客家网络

  19. Tom Davies says:

    Is there any good way of making statically typed calls between Kotlin running as Javascript in the browser and a JVM back end? That is, something like GWT-RPC?

    • Dmitry Jemerov says:

      We don’t offer anything at this time, but we’re working on ways of making it easy to transfer data between the JVM backend and a JS frontend in a type-safe manner.

  20. Pingback: Kotlin 1.1 正式版来了,基于 JVM 的编程语言 | News Pod

  21. Pingback: Доступен Kotlin 1.1: теперь с поддержкой JavaScript и сопрограмм – Русский Эпик

  22. Peter says:

    When checking the plugins in 2016.3 the latest version I see for the Kotlin plugin is 1.0.5-release-IJ2016.3-1.

    How to update the plugin?

    • Dmitry Jemerov says:

      You can use Tools | Kotlin | Configure Kotlin plugin updates and press the “Check for updates now” button.

  23. Joshua Rosen says:

    Congrats! Thank you for all the hard work put into creating Kotlin. It really has made me a happier programmer :)

  24. Pingback: DBmaestro’s DevSecOps feature, JetBrains’ Kotlin 1.1, and Tableau 10.2—SD Times news digest: March 1, 2017 – Ok Huge

  25. Zheng Keli says:

    Oh yeah! It’s great. Kotlin is such an amazing programing language! I’ve been addicted to it . Hope that someday Kotlin becomes a top-rank programing language!

  26. Pingback: Kotlin 1.1 erschienen: Coroutines & verbesserter JavaScript Support - JAXenter

  27. carlos says:

    Is Kotlin going to be a viable alternative to TypeScript and Dart? Do you guys have an Angular application example written in Kotlin? What is the development process like? Is it tedious or as simple as hitting refresh on the browser?

  28. Ahmed Tarek says:

    Thanks Kotlin :)

  29. Greg says:

    I got the plugin notification in IntelliJ (2016.3.4) about 1.1.0 being released so I let it update and then I restarted. Then in my maven pom file I updated it to 1.1.0 but it says 1.1.0 can’t be found. 1.0.6 is found but not 1.1.0… I get this error:
    Plugin ”’org.jetbrains.kotlin:kotlin-maven-plugin:1.1.0”’ not found

    Anyone know why?

  30. Leandrit Ferizi says:

    Will it work good with Angular 2? I am currently using WebStorm and I am loving it.

  31. Haris Sulaiman says:

    Good job on releasing kotlin 1.1, But the release broke my android studio setup now there is no java interop and data binding just fails. but the project compiles nonetheless. Wielrd

  32. Pingback: Java Web Weekly, Issue 166 | Baeldung

  33. Santagada says:

    Is there a webassembly version of kotlin being worked on? It seems a better target than Javascript in the very near future.

    • Alexey Andreev says:

      WebAssembly is a very new technology. Browser still provide it as experimental feauture, which is disabled by default. There’s no debugging support, no good interop with JavaScript APIs. WebAssembly does not provide support for GC and exception handling (and it’s very hard to implement own GC and exceptions, since WebAssembly does not provide access to stack). So I don’t see why it’s a better target than JavaScript. In long term prospect (I believe, not even this year) it might be.

      Compiler to WebAssembly is quite easy to get. There’s LLVM backend that produces WebAssembly binary file, so when Kotlin Native team releases LLVM version of Kotlin compiler, we’ll get WebAssembly support almost for free.

  34. Pingback: [Kotlin] มาใช้งาน AsyncAwait สำหรับ Android app กัน

  35. Pingback: baeldung - Coding and Testing Stuff: Java Web Weekly, Issue 166 - Tech Geek Eden

  36. Pingback: NewsBits - S3, CloudPets and MongoDB, Google's Rosehub, MySQL's Optimizer and a universal S... - Tech Geek Eden

  37. Pingback: Kotlin 1.1 brings JavaScript support and coroutines - Tech Geek Eden

  38. Pingback: Year2017. Week10 -

  39. Pingback: Kotlin 1.1正式版来了,基于JVM的编程语言-JX BLOG

  40. Shinelw says:

    It’s so cool!!!

  41. In regard to “Running on multiple platforms is a strategic direction for Kotlin…”, are there any current plans/initiatives for making Kotlin run on .NET (or .NET Core in particular)? Similar to what RemObjects is doing with Swift – allowing it to run on both .NET and Java/Android (https://docs.elementscompiler.com/Silver/)?

    This would open up a huge direction for working on top of a mature, battle-tested web stack (ASP.NET and Entity Framework) which is CENTRALIZED unlike the fragmented and ill-supported Java alternatives. .NET is really one of the only centralized server stacks that provides a model similar to iOS/Android on the server-side, and is mature/scalable/enterprise-grade.

    I think this would be a huge advantage for Kotlin and open up a new phase for our industry.

    • Mike-EEE says:

      (To be sure, I am not asking for .NET Kotlin support as I noticed you have said above you do not plan to do, but rather, to create something similar for .NET whereby you could run a .NET application any and everywhere, including — and especially — the browser process.)

  42. Pingback: ¿Será 2017 el año de Kotlin? Repasamos su evolución y por qué deberías darle una oportunidad | Esther Claravalls

  43. Pingback: Kotlin 1.1新增协程、类型别名特性,提升了对JavaScript的支持 - 莹莹之色

  44. waqas says:

    Nice I should take a look at kotlin again I guess.

  45. Foti Dim says:

    Some React Native love would also be nice. The single thing that I hate most about RN is that I have to work with JS.

  46. Pingback: Анонс: BKUG #3 – Belarus Kotlin User Group

  47. Pingback: Kotlin 1.1 を始めよう | ギャップロ

  48. Pingback: Java vs. Kotlin для Android. День 2: А может ну его, этот Kotlin? : IT лента новостей ⋆ iAMX - Развлекательно-информационный портал

Leave a Reply

Your email address will not be published. Required fields are marked *