Kotlin 1.3.50: New APIs and improved Java to Kotlin converter
The latest version of Kotlin arrives with a new time measurement and duration API preview, tooling improvements, plans for an improved Java to Kotlin converter, various debugging improvements, and more. Come check out the latest versioning and see what other news Kotlin has been keeping up its sleeve lately.
The good news for Kotlin keeps on rolling. Since Google announced that it is officially the first-class language for Android in 2017, it has been eating away at Java’s Android throne. According to a recent Facebook poll taken by Dice, 15% of Android developers prefer using Kotlin over Java.
While this number may sound small, for this newcomer of a language it’s gaining a steady foothold and is well-loved by developers. Take a peak at the Kotlin 2019 state of development ecosystem report to see what devs love about the language and how they use it.
This update includes some tooling improvements, new intentions and inspections, debugging improvements, and more.
We’re happy to announce the release of #Kotlin 1.3.50 with quality and tooling improvements, Duration and Time measurement API preview, IntelliJ IDEA Ultimate Kotlin/Native debugging plugin, and other updates: https://t.co/0kTr1Ua8eO 🎉 pic.twitter.com/zI4Z8Habhl
— Kotlin (@kotlin) August 22, 2019
Some of the latest features and changes included in this update:
New duration and time measurement API
Version 1.3.50 introduces an experimental preview of a new duration and time measurement API. Potential use cases for the API include measuring code block execution time, enabling typed API for passing duration values, noting time elapsed from a particular point, and noting time remaining to a future point.
Support for the monotonic clock
MonoClock also arrives.
According to the KEEP on GitHub:
The goal of this proposal is to introduce the following API into the common Kotlin Standard Library:
- the class
Durationrepresenting the duration of time interval between two instants of time;
- the enum class
DurationUnitthat lists the possible units in which a duration can be expressed;
- the functions
measureTimedValueallowing to measure execution time of a code block;
- the interface
Clockabstracting the source of time and allowing to notch a mark on the clock and then read the amount of time elapsed from that mark.
Refer to the KEEP on GitHub for more information about this API, its operators, components and more.
An array of improvements to Kotlin/Native has been made in this update. Now, both Kotlin and Native versioning align. The standard library updates to support the
kotlin.reflect.typeOf() function for Kotlin/Native types.
This also brings more pre-imported Apple frameworks for all platforms, improvements for interop, standard library updates, and more.
Other changes and improvements
Some miscellaneous updates included in this version:
- Functions for bit manipulation API: Currently in the initial experimental state.
- Debugging improvements: Changes made to how to the ‘Variables’ view chooses which variables to display and highlight relevant variables. Users can set a breakpoint at the end of the function.
- Kotlin/JS: Support for building and running Kotlin/JS Gradle projects with the
org.jetbrains.kotlin.jsWindows plugin. Performance updates also enhanced, improving upon the project compilation time.
- Dukat: Kotlin/JS ships with experimental Dukat integration for Gradle projects. Refer to Dukat on GitHub to learn more about it.
- Scripting improvements and features added: Includes default JSR-223 implementation library.
- New intentions and inspections
- Java to Kotlin converter: Work continues to improve on the Java to Kotlin converter, making it easier than ever to convert your code with fewer compilation errors. It is available for preview and awaiting feedback.