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 . 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 module-info.java. 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:

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:

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!

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

30 Responses to Kotlin 1.1.4 is out

  1. Igor says:

    “to enable this in a Gradle build, use the freeCompilerArgs option; in a Maven build, use . ”

    Link missing for Maven

  2. Andrey Mischenko says:

    Why Parcelable generation is a part of Android Extensions Plugin?
    I suppose that it should be a separate plugin.
    For example, we don’t use Android Extensions as a replacement for findViewById but really interested with Parcelable generation.

    • yanex says:

      The initial goal for Android Extensions was to provide various synthetic sugar in order to make Android application development easier and faster. But you are right, until 1.1.4, there was nothing in Android Extensions but the synthetic properties for Views.
      You can enable Android Extensions but use only its Parcelable part. If you worry about the extra methods Android Extensions generates for the View cache, you can disable the cache globally:

      androidExtensions {
          defaultCacheImplementation = "none"
      }

      Although Parcelable generator is now is a part of Android Extensions, we listen to our users, and we might change our decision in the future.

      • Andrey Mischenko says:

        Thank you for advice.

        As I understand, AS/Idea checks for android-extensions plugin and enables integration (auto complete) with synthetic properties for views.
        But it’s not expected behavior and can cause bugs (when you accidentally use syntetic property).

        I see no problem to have one Gradle dependency android-extensions plugin, but maybe better to apply only required plugin during configuration (like we have kotlin-android and kotlin-kapt plugins as parts of org.jetbrains.kotlin.android)

  3. SC says:

    Congrats on release guys!

    I love to hear performance improvements, it makes coding on kotlin much smoother, thanks a lot ♥

  4. ligi says:

    Great news!

    One question that came up when testing though:

    is

    always needed – I thought initially this is only needed for the new features – but it seems the synthetic properties that worked before without a flag need this one now. Not a big deal – just kinda try to keep experimental stuff out of production apps – and I am using synthetic properties (wonderful feature btw) all over the place..

    • yanex says:

      Do all synthetic properties for Views stop to work for you? Are such properties from the ‘main’ variant, or from flavors? Does it fail to compile also in Gradle, or you see errors only inside the IDE?
      Also, what IDE Kotlin plugin version do you use?

  5. edge says:

    thank you for a lot of fixes, features, improvements!

  6. Pingback: Kotlin 1.1.4: Verbesserter Support für Java 9 & neues Tool zum Entfernen von totem JavaScript Code - JAXenter

  7. Sebastian Schmitt says:

    Thank you so much! Words can’t tell how much I appreciate your work!

  8. After upgrading from “1.1.3-2” to “1.1.4”, I am getting plenty of these errors: “Cannot access class ‘<*>’. Check your module classpath for missing or conflicting dependencies”.

    Why was my comment removed?

    • Dmitry Jemerov says:

      Could you please file a YouTrack issue with more details? Your comment wasn’t removed; comments here are moderated manually, and it was simply waiting for approval.

  9. Rob Fletcher says:

    I guess this may be a facet of the bytecode improvements but upgrading from 1.1.3-2 to 1.1.4 means our project (https://github.com/spinnaker/orca — part of Netflix’s Spinnaker) no longer compiles with the error “Insufficient maximum stack size”. Is that a regression or a new constraint?

  10. Dhaval Jivani says:

    Hi,

    I have implemented below code but show me error “This Class Implement Parcelable but does not provide a CREATOR field”

    import android.os.Parcelable
    import kotlinx.android.parcel.Parcelize

    @Parcelize
    class User(var userRoleDetailId : Int) : Parcelable

  11. Chris Hatton says:

    JB team, I was already ‘developing with pleasure’ after finding AppCode for iOS Development. Since switching to Android Dev, Kotlin makes me feel even closer to the heavenly source! Thanks for this release and all your work to keep Kotlin & Android flourishing, and giving the JVM a truly new lease of life 😀

  12. Android Box says:

    Thanks for the continued work and updates provided by JB. Keep it up :-)

  13. frankie says:

    There is no way to access CREATOR field in classes annotated with @Parcelize, which is required when implementing custom view states with complex data like typed lists —
    https://developer.android.com/reference/android/os/Parcel.html#readTypedList(java.util.List, android.os.Parcelable.Creator)

  14. Julien Maffre says:

    Could you please indicate how to configure proguard with @Parcelize.
    I got a “can’t find reference class my.package.Creator”.

    Thanks

  15. he guangyu says:

    I have a question on interface.
    I create interface in Java:
    public interface HealthCheck {
    Result runHealthChecks();
    }
    and In kotlin:
    interface IHealthCheck {
    fun runHealthChecks(): Result
    }

    Then, I can write:
    (1)
    val s = HealthCheck {
    Result().ok()
    }
    (2)
    val s = object: IHealthCheck {
    override fun runHealthChecks(): Result {
    return Result().ok()
    }
    }
    The second part is tedious.

    What’s the difference of Java & kotlin interface? Can I get a instance of Kotlin interface by the same mode of Java interface?

  16. Teena says:

    This is a great release, Our team is looking forward to creating our android app in Katlin.
    All the best to team Katlin.

  17. Eric Liu says:

    Would love to be able to use Kotlin as the working language in React Native development! May I ask if there is any plan to integrate Kotlin with React Native please?

    • Dmitry Jemerov says:

      The Kotlin team is not currently working on React Native integration, but there are other teams at JetBrains who have explored that and will hopefully publish their results at some point.

Comments are closed.