Menu
Kotlin gains Java coding enhancements

Kotlin gains Java coding enhancements

Kotlin 1.5.20 adds experimental support for Java libraries that help to reduce boilerplate coding and to maintain null safety when interoperating with Java code.

Credit: Robert Shunev

With the Kotlin 1.5.20 update, the JetBrains-developed Kotlin language gets preliminary backing for the Lombok Java library, which is intended to make coding easier, along with JSpecify Java nullness capabilities.

Released June 23, Kotlin 1.5.20 has experimental support for calling Lombok-generated methods. The addition of the Lombok compiler plug-in allows generation of Lombok declarations in Java by Kotlin code in the same mixed Java/Kotlin module.

The Lombok library plugs into an editor and build tools and works to reduce the need to write boilerplate code with capabilities such as automation of logging variables.

Kotlin 1.5.20 also has experimental support for JSpecify, which provides standard Java annotations for static analysis. A unified set of Java nullness annotations is featured in JSpecify, providing more nullability information to help Kotlin maintain null safety when interoperating with Java.

Instructions on installing Kotlin 1.5.20 can be found at blog.jetbrains.com. Other capabilities in Kotlin 1.5.20 include Gradle - parallel execution of Kotlin tasks is now fully controlled by the Gradle parallel execution mechanism while the kotlin.parallel.tasks.in.project property has been deprecated.

Also for Gradle, Kotlin 1.5.20 implements experimental caching of annotation processors' classloaders in kapt, to speed up kapt for consecutive Gradle runs in some cases.

In addition, the Kotlin/Native compiler now can export documentation comments from Kotlin code to Objective-C frameworks. This experimental support also works for the Swift language.

Work continues on stabilising the Kotlin/JS IR back end. A migration guide is offered to assist with migrating to the new JavaScript back end.

For the standard library, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-lower-case.html" rel="nofollow">isLowerCase()</a> and isUpperCase() now provide the same result on all platforms by checking all characters, not just letters. Also, digi tToInt() now supports all Unicode digit characters for all Kotlin platforms, including the JVM, native, and JavaScript.


Tags javaKotlin

Show Comments
 

Events

05 Aug
Channel Asia WIICTA 2021
View all events