Kotlin 1.1 Beta 2 is here

We’re happy to announce the second beta of Kotlin 1.1. Please give the new version a try – your feedback is essential for ensuring that we can deliver a quality release.

Since the first beta release, we’ve mostly been focused on stability, bugfixes, and improving the key focus areas of this release: coroutine support and the JavaScript backend. The full list of changes since 1.1 Beta can be found in the changelog. And if you’re interested in a recap of everything added in version 1.1, check out our what’s new page.

Migration Notes

For JavaScript projects, we’ve changed the name of the artifact for the standard library. Instead of kotlin-js-library, it is now kotlin-stdlib-js. You’ll need to update your Maven and Gradle scripts accordingly when you update to 1.1 beta 2 or a newer build.

In addition to that, testing support classes (in the package kotlin.test) for JavaScript are now packaged as a separate artifact, as it was previously done for the Java version. If you’re using kotlin.test in your JS project, add a dependency on kotlin-test-js.

The coroutines APIs in the Kotlin standard library have been moved to the kotlin.coroutines.experimental package; you need to update your imports if you’ve used these APIs in your code. See Andrey’s forum post for the background on this change.

We’ve also made it easier to enable the experimental coroutine support in your Gradle projects. Instead of editing gradle.properties, you can add the following snippet to your build.gradle:

If you’re using the kotlinx.coroutines library, please update your dependency to version 0.6-beta. Earlier versions of the library are incompatible with this Kotlin update.

New Features

We did add a few last-minute features in this beta. Here are the most important ones:

  • The compiler now reports a warning if you declare an extension that has the same signature as a member of the same class and will always be shadowed (for example, String.length())
  • Type inference for member references passed to generic functions is now much improved (KT-10711)
  • The minus operator can now be used with maps, returning a copy of the map with the given keys removed. The -= operator can be used on mutable maps to remove the given keys from the map.
  • It is now possible to access the delegate instance of a delegated property using KPropertyN.getDelegate() (see KT-8384 for details);
  • Intention (contributed by Kirill Rakhman) to merge two nested if statements;
  • Support for building Android projects when the Jack toolchain is enabled (jackOptions { true });
  • Intention (contributed by Kirill Rakhman) to generate View constructors in Android applications.

Source Compatibility with Kotlin 1.0

Another area to which we paid a lot of attention in this update is source compatibility with Kotlin 1.0. This allows you to try Kotlin 1.1, even if your team is using Kotlin 1.0, without worrying that you’ll break the build by using some of the features added in the new release.

To enable the compatibility mode:

  • For Maven, Ant and the command-line compiler, set the -language-version compiler argument to 1.0.
  • In a Gradle build, add kotlinOptions { languageVersion = "1.0" } to your compileKotlin task.
  • In the IDE, specify the language version in the Kotlin facet settings or in Settings | Build, Execution, Deployment | Compiler | Kotlin Compiler

How to try it

In Maven/Gradle: Add http://dl.bintray.com/kotlin/kotlin-eap-1.1 as a repository for the build script and your projects; use 1.1.0-beta-38 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.

The command-line compiler can be downloaded from the Github release page.

On try.kotlinlang.org. Will be available soon.

Let’s Kotlin!

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

8 Responses to Kotlin 1.1 Beta 2 is here

  1. Pingback: JVM-Sprache Kotlin: Zweite Beta-Version von Kotlin 1.1 erschienen [Update] - JAXenter

  2. Reposting here from the Beta 1 blog post since I didn’t see the newer one:

    I first off love the coroutines effort and want to thank the team for taking the big leap to tackle this big advancement in the Kotlin/JVM ecosystem.

    Our piece of feedback however is that you guys badly need an integrated, end-to-end tutorial/example of how this would be applied in real-world scenarios. For example:

    How would a team integrate this end-to-end in an Android project? You guys need to provide an end-to-end example of how to integrate from networking to biz layer to presentation. How does Kotlin integrate with Retrofit (prob the most popular networking lib on Droid right now), parse JSON, propagate networking errors/exceptions to upper levels, allow chain/parallel continuations up in the business & presentation layers, and thread switch appropriately so that network results process on BG and marshal back to UI hydration?

    Even with our team having a lot of familiarity with async/futures (we use C#./.NET on the back-end, a Swift futures library and Bolts on Android – ie: each toolset it’s best-of-breed approach)…. we find it prohibitively complicated trying to figure out how to mix all this on Android/Kotlin 1.1 from just the blog posts you guys have been putting out.

    We shouldn’t need a full research sprint to figure out how to get off the ground with this. A tutorial / blog post from you guys should suffice and get everyone in the Kotlin community on the right track for adopting and picking it up in their projects.

    Right now a practical stack looks on Android something like:
    – Retrofit (“com.squareup.retrofit2:retrofit”) – networking
    – Retrofit GSON (“com.squareup.retrofit2:converter-gson”) – JSON parsing
    – Bolts (“com.parse.bolts:bolts-tasks”) – continuations
    – Retrofit Bolts adapter (hand-rolled) – error handling ie: map Retrofit representation of errors to Bolts representation of errors

    What is the Kotlin async alternative to this?

    • Roman Elizarov says:

      Kotlin coroutines is a language feature, not a library. One of the goals of Kotlin coroutines in the language is to help writers of asynchronous libraries to avoid callback hell. Coroutines in Kotlin are designed in such a way, as to allow writing asynchronous (suspendable) computations naturally, reaping the full power of language control constructs.

      Coroutines are useful in variety of domains: games and animations, backend enterprise applications, parsers, networks protocols, actor-baser services, etc. Android apps is just one domain among those. Kotlin team has neither resources nor desire to cover all those domains. It is up to the authors of the libraries to use Kotlin coroutines to give their users simple and easy-to-use asynchronous APIs.

      The answer to your question is that coroutines in Kotlin are not designed to replace any of the libraries that you are currently using, but rather let you and the authors of those libraries to augment them with nicer and easier to use APIs.

  3. Hey guys, quick question: how far back does Jack support backport to?
    ie: What’s the min SDK version of Android that we can support while having Jack enabled?
    NOTE: Totally fine not to use the Java 8 features, which I believe is 7.0 forward (WAY too new)

    Kind thanks :)

    • Dmitry Jemerov says:

      Our Jack support means that the Kotlin compiler no longer fails to build the project when you have Jack enabled. The minimum supported SDK version is the same one as the one that you have when you use Jack without Kotlin. None of the Kotlin features have a minimum SDK version requirement.

  4. Richard Hundt says:

    Annotations metadata doesn’t seem supported by the JavaScript backend. I was hoping to use them to create PolymerJS bindings sugar. Should I stop holding my breath?

    • Zalim Bashorov says:

      Right, annotations don’t work in Kotlin JS and, unfortunately, it will not work in 1.1. We going to support it in the future versions but don’t have any ETA yet.

      I’ve created the issue (KT-16314), feel free to vote.

    • Louis CAD says:

      Hi Richard,
      Are you still planning to create a Polymer Kotlin binding?
      I’d like to talk about this if you’re interested (search my name on Google to contact me if you want to discuss this)

Comments are closed.