Kotlin 1.3 Adds Duration And Time API
Written by Mike James   
Thursday, 29 August 2019

The latest release of Kotlin, the open source language originated by JetBrains as "a better Java", is available with a new Duration and Time Measurement API, as well as an improved Java-to-Kotlin converter.

Kotlin has achieved prominence and popularity thanks to Google promoting it as a first class language for Android to replace or supplement Java, making it the lead language for Android development back in 2017. Kotlin makes Android programming easier by reducing the need for long chunks of boilerplate code that the average programmer just doesn't get, or perhaps more accurately doesn't bother understanding at a deep level.

kotlinlogo

This latest update brings in a beta of the new Duration and Time Measurement API. This lets you measure durations in a variety of units including seconds, milliseconds, and nanoseconds. The developers hope that having a regular class to store duration will avoid errors caused by data being passed in the wrong unit. If the API expects the duration stored as primitive value like Long, it is possible to erroneously pass the value in the wrong unit, and the type system until now hasn't helped prevent that.

The second improvement available in preview is an improved Java-to-Kotlin converter designed to minimize the amount of “red code” that has to be fixed manually after the conversion. The current converter almost always generates non-nullable types, which can lead to runtime errors from nullability mismatch later. The new version of the Java-to-Kotlin converter tries to infer nullability more correctly based on the Java type usages in the code, as well as fixing many other known bugs, such as incorrect handling of implicit Java type casts.

Other improvements include experimental generation of external declarations for npm dependencies in Gradle Kotlin/JS projects; a separate plugin for debugging Kotlin/Native code in IntelliJ IDEA Ultimate; and Java compilation support in multiplatform projects.

 

 

 

kotlinlogo

 

More Information

Kotlin Home Page

Related Articles

Kotlin Enters RedMonk's Top 20

Kotlin Gains A Foundation and A Portal

Kotlin 1.2 Released With Cross Platform Support

The Programmers Guide To Kotlin - Type

Android Studio 3.0 Released

Kotlin Begins Its Takeover Of Android

New Kotlin Style Guides Unveiled

Kotlin - New Language For Android

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Windows 11 Overtakes Windows 10 - But Not In Europe
08/07/2025

With the end of support of Windows 10 just three months away, Windows 11 has finally edged ahead of Windows 10 in terms of  Desktop Windows Version Market Share on a Worldwide Basis. In Europe, h [ ... ]



Parasoft Adds AI Assistant To C/C++ Test
30/06/2025

Parasoft has updated its C/C++ Test software with an AI-powered documentation assistant, along with complete support for MISRA C:2025 and auto-suppression of equivalent violations. C/C++ Test can be u [ ... ]


More News

pico book

 

Comments




or email your comment to: comments@i-programmer.info

 

Last Updated ( Thursday, 29 August 2019 )