JavaScript Releases

Kotlin 1.1.4 is out

We’re happy to announce the release of Kotlin 1.1.4, a new bugfix and tooling update for Kotlin 1.1. This update:

  • Fixes a major performance regression in the IntelliJ IDEA plugin
  • Adds support for package-default nullability annotations
  • Improves Java 9 support
  • Adds initial, experimental support for generating Android Parcelable implementations using the @Parcelize annotation
  • Adds a tool for JavaScript dead code elimination, improves sourcemap support for JS debugging and JS unit testing support
  • Generates more efficient bytecode
  • Adds many new features to the IntelliJ IDEA plugin

The update is compatible with all versions of IntelliJ IDEA from 2016.2 until 2017.2, as well as with Android Studio 2.3 and 3.0 Beta.

The complete list of changes in this release can be found in the changelog.

We’d like to thank our external contributors whose pull requests were included in this release: Andrius Semionovas, Bill Collins, Derek Alexander, Dimach, Ilya Zorin, Kirill Rakhman, Stuart Kent, takahirom, Toshiaki Kameyama, Vasily Kirichenko, Vitaly Khudobakhshov, Vladimir Koshelev, Yoshinori Isogai, Yuli Fiterman, and Zoltan Polgar.

Package-default nullability annotations

Starting with this release, Kotlin supports package-default nullability annotations (such as JSR-305’s @ParametersAreNonnullByDefault and the @NonNullApi annotation introduced in Spring Framework 5.0). To facilitate migration and avoid compilation errors due to more precise nullability information on used Java APIs, the support for such annotations is off by default, and needs to be enabled by passing the -Xjsr305-annotations=enable command line option to the compiler. To enable this in a Gradle build, use the freeCompilerArgs option; in a Maven build, use <args>. For more information, see the proposed specification.

Java 9 support

We’re moving forward with Java 9 support. Starting with this release, Kotlin performs module-based visibility checks based on information from Running the compiler under JDK 9 is now also supported.

Android Extensions plugin enhancements

Android Extensions plugin now supports not only Activities and Fragments, but also custom Views and even custom layout containers such as a ViewHolder. Also, variants are now fully supported.

You can read more about the new features in the KEEP proposal. All of them are considered experimental, so you will need to turn on an experimental flag in your build.gradle file:

androidExtensions {
    experimental = true

Parcelable support

Android Extensions plugin now includes an automatic Parcelable implementation generator. Declare the serialized properties in a primary constructor and add a @Parcelize annotation, and writeToParcel()/createFromParcel() methods will be created automatically:

class User(val firstName: String, val lastName: String) : Parcelable

Parcelable generator is also in experimental status. We make no compatibility guarantees related to it and welcome your feedback on the API. For more information, see the proposed specification.

JavaScript dead code elimination

Kotlin 1.1.4 adds a new tool to eliminate dead code from the .js files produced by the Kotlin/JS compiler. The tool is only supported in Gradle builds at this time; to enable, add apply plugin: 'kotlin-dce-js' to your build.gradle. See the documentation for more information.

JavaScript debugging

Kotlin 1.1.4 improves support for JavaScript sourcemap generation, making it easier to debug JS in browser debuggers such as Chrome DevTools. See the tutorial for more information.

JavaScript unit testing

This update extends JavaScript unit testing support to work with a broader variety of libraries. See the forum post for more information and links to sample projects.

Bytecode quality improvements

In this update, we’ve implemented many improvements for the quality of generated bytecode. Exceptions from named suspending functions now originate from the function itself, which makes their stack-tracer easier to read, and the bytecode performs better in many cases.

IntelliJ IDEA plugin improvements

The new release brings many improvements to the IntelliJ IDEA plugin:

  • Major performance improvements
  • New refactoring “Copy Class”
  • “Inline” refactoring can now be used on properties with accessors
  • Renaming labels is now supported
  • Many new options in the code style settings
  • Data flow analysis support (Analyze | Analyze Data Flow from/to Here)
  • “Configure Kotlin in project” now supports projects using Gradle Kotlin DSL
  • Many new inspections and quickfixes

How to update

To update the plugin, use Tools | Kotlin | Configure Kotlin Plugin Updates and press the “Check for updates now” button. Also, don’t forget to update the compiler and standard library version in your Maven and Gradle build scripts.

As usual, if you run into any problems with the new release, you’re welcome to ask for help on the forums, on Slack (get an invite here), or to report issues in the issue tracker.

Let’s Kotlin!

image description