New bugfix and tooling update for Kotlin 1.1

On the road to Kotlin 1.2: Kotlin 1.1.4 brings improvements to the IntelliJ IDEA plugin

Gabriela Motroc
Kotlin 1.1.4

© Shutterstock / Alexey Stiop

The second milestone release for Kotlin 1.2 was announced less than a week ago but now it’s time for Kotlin 1.1.4 to shine. Read on to find out what’s new and what has been improved.

Kotlin 1.1.4 is here and it comes bearing a lot of gifts. It fixes a major performance regression in the IntelliJ IDEA plugin and adds many new features to the IntelliJ IDEA plugin but there’s also a tool for JavaScript dead code elimination and improved Java 9 support.

Let’s have a look at this new bugfix and tooling update for Kotlin 1.1.

Kotlin 1.1.4 highlights

Dmitry Jemerov, Principal Engineer at JetBrains revealed in a blog post announcing the release that Kotlin 1.1.4

  • 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

Kotlin now supports package-default nullability annotations (such as JSR-305’s @ParametersAreNonnullByDefault and the @NonNullApi annotation introduced in Spring Framework 5.0), Jemerov wrote.

Keep in mind that the support for such annotations is off by default —to facilitate migration and avoid compilation errors due to more precise nullability information on used Java APIs— so it must 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>. Starting with 1.1.4, Kotlin also performs module-based visibility checks based on information from module-info.java.

As far as Android Extensions plugin is concerned, in addition to Activities and Fragments, it now supports custom Views, custom layout containers such as a ViewHolder and variants. However, keep in mind that they are all considered experimental, so be sure to turn on an experimental flag in your build.gradle file:

androidExtensions {
    experimental = true
}

Read more about the new features in the KEEP proposal.

Speaking of Android Extensions plugin, the family has welcomed a new member: an automatic Parcelable implementation generator. This is also considered experimental so there are no compatibility guarantees related to it.

How does it work, you ask? Here’s what Jemerov says: Declare the serialized properties in a primary constructor and add a @Parcelize annotation, and writeToParcel()/createFromParcel() methods will be created automatically:

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

SEE ALSO: Serverless Kotlin tutorial — You get the best of both worlds

This release also adds a new tool to eliminate dead code from the .js files produced by the Kotlin/JS compiler. Keep in mind that this new tool is only supported in Gradle builds right now. You can enable it by adding apply plugin: 'kotlin-dce-js' to your build.gradle.

Last but not least, Kotlin 1.1.4 brings quite a few improvements to the IntelliJ IDEA plugin such as:

  • 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

Check out the rest of the highlights in Jemerov’s blog post and the complete list of changes in the changelog.

asap

Author
Gabriela Motroc
Gabriela Motroc is an online editor for JAXenter.com. Before working at S&S Media she studied International Communication Management at The Hague University of Applied Sciences.

Comments
comments powered by Disqus