Kotlin 1.2.60 is out!
We’re happy to announce the release of Kotlin 1.2.60, a new bugfix and tooling update for Kotlin 1.2. This release:
- Adds optional expected annotations to multiplatform projects
- Allows building multiplatform projects with IntelliJ IDEA
- Introduces experimental kapt mode aimed to speed up Gradle builds
- 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.2 to 2018.2, as well as with Android Studio 3.1, 3.2 Beta, and 3.3 Canary.
We’d like to thank our external contributors whose pull requests were included in this release: Toshiaki Kameyama, Ivan Gavrilovic, Juan Chen, Raluca Sauciuc, Valeriy Zhirnov, Evgeny Zakharov, Derek Schaller, Egor Neliuba, Lucas Smaira, Miha-x64, Mon_chi, Rodrigo B. de Oliveira, Tudor Luca, cobr123, and Kenji Tomita
The complete list of changes in this release can be found in the changelog. Read on for the highlights.
Multiplatform projects update
Optional expectation for annotations
This update introduces the
@OptionalExpectation annotation that is suitable for marking
expect annotation class declarations in common code whose
actual counterparts may be omitted in the platform implementations. Doing so will then make the compiler ignore the annotations on the common declarations during compilation of the platform modules that have no corresponding
actual annotation class.
This change, in particular, will allow for using annotations such as
@JsName in common code of a multiplatform project. We’re planning to provide these annotations in
kotlin-stdlib-common starting with 1.2.70.
Building a multiplatform project with IntelliJ IDEA
A multiplatform project may now be built with the integrated build system of IntelliJ IDEA without delegating the task to Gradle, which improves build times for IDE run configurations. These builds already benefit from incremental compilation of Kotlin code.
In addition to performance improvements, we added an experimental option to run kapt, the Kotlin annotation processing tool, directly using Gradle workers. In some cases, this may significantly improve the overall build speed. To switch to the Gradle worker implementation, add the
kapt.use.worker.api=true key to the
gradle.properties file. Note that it is only available with Gradle 4.3 and above. We plan to enable it by default in Kotlin 1.2.70, so we kindly ask for your feedback. Please let us know if you have any problems with the Worker API option enabled.
Besides, information messages produced by the annotation processors used with kapt, which were shown as warnings in Gradle builds, are now printed with the
INFO logging level for cleaner build outputs. To revert to the old behavior and print them as warnings, set the Gradle project property
true in the
IntelliJ IDEA support improvements
Quick fixes for wrapping a value into a collection
There’s a new quick fix for wrapping a value into a singleton list, set, array, or sequence on type mismatch and corresponding postfix templates for the functions
Other improvements in the IntelliJ IDEA plugin
- A quick fix for removing the
lateinitmodifier when it conflicts with a custom property accessor
- A quick fix to either move a
const valproperty into the companion object or remove an illegal
- An intention for replacing
String.format(...)with a string template
- Other useful inspections and intentions
- Lots of bug fixes and performance improvements
Changes in the compiler
The Kotlin 1.2.60 update fixes a lot of known issues in the compiler and delivers performance and stability improvements.
New checks were added for the following erroneous constructs:
- Smart casts of local delegated properties that led to type safety guarantees violation and runtime failures (KT-22517)
- Annotation arguments erroneously accepted even though they are not compile time constants (KT-23153)
staticmember usages that were inconsistent with Kotlin companion object members visibility (KT-25333)
- Annotations with
EXPRESSIONtarget and non-
All of these are reported as warnings in Kotlin 1.2.60+ and will become errors in Kotlin 1.3. The corresponding checks already report errors in the progressive compiler mode (with the
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.
Also, don’t forget to update the compiler and standard library version in your Maven and Gradle build scripts.