Kotlin
A concise multiplatform language developed by JetBrains
Kotlin 1.2.70 is Out!
We’re happy to announce the release of Kotlin 1.2.70, a new bugfix and tooling update for Kotlin 1.2. This release:
- Significantly improves incremental compilation for Kotlin/JS
- Marks a number of
kotlin-stdlib-common
annotations with@OptionalExpectation
- Contains native binaries built with Excelsior JET for the standalone Kotlin compiler
- Adds new refactorings, inspections, and intentions to the IntelliJ IDEA plugin
- Fixes a lot of known issues in the compiler and the IDE plugin and provides performance improvements
The update is compatible with all versions of IntelliJ IDEA from 2017.3 to 2018.3, as well as with Android Studio 3.1, 3.2 RC, and 3.3 Canary.
We’d like to thank our external contributors whose pull requests were included in this release: Toshiaki Kameyama, Lucas Smaira, Raluca Sauciuc, Denis Vnukov, Jonathan Lermitage, Jake Wharton, gen, Takasy, Bloder, Artem Zinnatullin, Kenji Tomita, Nico Mandery and Juan Chen
The complete list of changes in this release can be found in the changelog. Read on for the highlights.
Incremental compilation improvements for Kotlin/JS
Incremental compilation has been greatly improved for Kotlin/JS. Depending on the project structure, this can speed up development builds up to 7 times and even more. Also, Kotlin/JS Gradle builds now support cross-module incremental compilation.
Note that it is still experimental and disabled by default. To try it, you need to enable it explicitly:
- In a Gradle project, add
kotlin.incremental.js=true
intogradle.properties
orlocal.properties
- In a project built with IntelliJ IDEA, go to Settings | Build, Execution, Deployment | Compiler | Kotlin Compiler | Kotlin to JavaScript and check Enable incremental compilation (experimental).
Your feedback is welcome, and if you face any issues with Kotlin/JS incremental compilation, please tell us.
Multiplatform projects update
A number of platform-specific annotations were introduced in kotlin-stdlib-common
. They are marked with the @OptionalExpectation
annotation introduced in 1.2.60. The compiler will ignore these annotations on common declarations during compilation of platform modules that have no corresponding actual annotation class.
For example, this allows you to use some JVM-specific annotations such as @JvmName
in the common code of a multiplatform project and compile it to JavaScript without any problems.
Those annotations are @JsName
, @JvmOverloads
, @JvmStatic
, @JvmName
, @JvmMultifileClass
, @JvmField
, @JvmSuppressWildcards
, @JvmWildcard
, @Volatile
, @Transient
, @Strictfp
, and @Synchronized
IntelliJ IDEA support improvements
Quick Fix to convert chains of collection functions into sequences
There’s a new inspection with a quick fix for converting a non-lazy collection transformations chain into a sequence equivalent. Using sequences helps avoid unnecessary temporary allocations overhead and, may significantly improve performance of complex processing pipelines:
Other improvements in the IntelliJ IDEA plugin
- Intentions to replace an
if
null-check with?.let
and the other way around - Inspection to detect unnecessary
with
calls - Intention to convert a property getter to initializer
- Inspection and quickfix to replace
assertTrue(a == b)
withassertEquals(a, b)
- “Redundant return label” inspection
- Quick-fix for default parameter value removal
- “
forEach
parameter unused” inspection - Lots of bug fixes and performance improvements
Standalone Kotlin compiler native binaries
In addition to the JVM version of the standalone Kotlin compiler, the Github releases now contain a native, system-dependent version for every major platform (Linux, macOS, and Windows). Those binaries are built with the Excelsior JET AOT compiler and have faster startup times, which is suitable for building small files or scripts.
The Excelsior JET runtime supports some JVM and specific options that you may pass with -J
using the kotlinc
wrapper script. All recognized options may be found in the Excelsior JET documentation.
How to update
To update your IntelliJ IDEA or Android Studio plugin, use Tools | Kotlin | Configure Kotlin Plugin Updates and click the “Check for updates now” button. The Eclipse IDE plugin can be installed or updated via the Eclipse Marketplace (Help | Eclipse Marketplace and search for the Kotlin plugin).
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!