Kotlin 1.1.50 is out
We’re happy to announce the release of Kotlin 1.1.50, a new bugfix and tooling update for Kotlin 1.1. This update:
- Introduces a new versioning scheme: 1.1.5x instead of 1.1.5-x
- Improves support for JSR-305 annotations (nullability problems can be reported as warnings, checks work when JSR-305 classes are not on the classpath)
- Improves generated bytecode performance
- Enables primitive array to TypedArray translation, adds source maps support to the dead code elimination tool and makes other improvements for the JS backend
- Fixes lots of bugs in the compiler and IDE
- Introduces new inspections, performance improvements and bugfixes in the IntelliJ plugin
- Supports extension points for preview of the Kotlin serialization plugin
The update is compatible with all versions of IntelliJ IDEA from 2016.3 until 2017.3, as well as with Android Studio 2.3 and 3.0.
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, Dimach, Kirill Rakhman, Toshiaki Kameyama, scache, André Oriani, Daniil Vodopian, Nagesh Susarla, and Knize.
Versioning scheme change
Starting with this release instead of using versions 1.1.5, 1.1.5-1, 1.1.5-2, etc. versions 1.1.50, 1.1.51, 1.1.52 will be used.
We want to publish our JS artifacts to NPM with the same version number as the version of the release. The issue here is that we use the number after that dash as the hotfix number, while NPM considering versions with the dash as being pre-release. This means that NPM considers Kotlin 1.1.5 to be more recent than 1.1.5-1, whereas the opposite is actually true. Changing the versioning scheme fixes the problem.
JSR-305 annotation support improvements
Kotlin 1.1.4 introduced initial experimental support for default nullability annotations, such as
@ParametersAreNonnullByDefault as an opt-in feature. In Kotlin 1.1.50, nullability problems detected thanks to such annotations are by default reported as warnings. To convert them into errors, add the command line parameter
-Xjsr305=strict. To disable the warnings, use
-Xjsr305=ignore. (Note that the command line parameter
-Xjsr305-annotations=enable, which was used to enable default nullability annotations in Kotlin 1.1.4, is now deprecated.)
Also, since this release, Kotlin no longer requires having a .jar file with JSR-305 annotations in the dependencies of a library in order to read the nullability information for this library.
Note that the strict mode JSR-305 support in the compiler is an experimental feature.
The way inline functions are translated to JS has been changed in order avoid using fully qualified names in the inlined function bodies. This reduces the size of the resulting JS file.
TypedArrays enabled by default
Primitive arrays are translated to TypedArrays by default now. This feature can be disabled by passing
-Xtypedarrays=false to the compiler. This change affects binary forward compatibility – using old compiler with new libraries is discouraged.
Note that the new array representation may also affect calling JS code from Kotlin. To call a JS function that expects a regular Array and not a TypedArray, use
toTypedArray extension function to convert a TypedArray to a regular Array. Functions like
toIntArray could be used to convert a regular Array of primitives to a TypedArray.
val intArray: IntArray = intArrayOf(1, 2, 3) // equivalent to Int32Array.of(1, 2, 3) val arrayOfInts: Array<Int> = intArray.toTypedArray() // arrayOfInts equals to [1, 2, 3] val otherIntArray: IntArray = arrayOfInts.toIntArray() // otherIntArray is Int32Array
This change also makes it possible to distinguish between Array
val intArray: Any = intArrayOf(1, 2, 3) // Int32Array.of(1, 2, 3) intArray is IntArray && intArray !is Array<*> // true val arrayOfInts: Any = arrayOf(1, 2, 3) // [1, 2, 3] arrayOfInts !is IntArray && arrayOfInts is Array<*> // true
Source maps support in DCE
Kotlin 1.1.50 improves the dead code elimination tool making it easier to debug its output. The tool detects existing sourcemaps and transforms them alongside with the code. See the tutorial to learn more about JS debugging.
IntelliJ IDEA plugin improvements
The new release brings many improvements to the IntelliJ IDEA plugin:
- Performance improvements
- Support for code completion of import aliases
- Better support for Gradle Kotlin DSL
- Inspections to verify that the code matches the formatting and naming conventions configured for the project
- Many other 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.
Subscribe to Blog updates
Thanks, we've got you!
Kotlin 1.9.0 Released
Kotlin 1.9.0 has been released! Highlights include: Kotlin K2 for JVM is in Beta, other K2 compiler updates, new enum class values function, new operator for open-ended ranges, preview of Gradle configuration cache in Kotlin Multiplatform, changes for Android target support in Kotlin Multiplatform, preview of custom memory allocator in Kotlin/Native. Learn more!
Introducing Kotlin Notebook
The first experimental version of the Kotlin Notebook plugin for IntelliJ IDEA is now available! This post will offer insight into the plugin’s functionality and use cases, but before launching into that, we’d like to let the plugin speak for itself: https://youtu.be/2PLYlDJPelQ W…
Kotlin 1.8.20 Released
Kotlin 1.8.20 has been released! Highlights include: Kotlin K2 compiler updates, AutoCloseable interface and Base64 encoding in stdlib, new JVM incremental compilation enabled by default, new Kotlin/Wasm compiler backend. Learn more!