days
-4
-4
hours
-2
0
minutes
-2
-9
seconds
-1
-1
search
What's new?

Kotlin 1.0.4: New bugfix and tooling update

Gabriela Motroc
Kotlin 1.0.5
Source: https://kotlinlang.org/

Kotlin 1.0.4 brings JavaScript support, as well as many improvements related to the IDE and build tools. Let’s see what else is new!

Dmitry Jemerov, principal engineer at JetBrains, announced the release of Kotlin 1.0.4 in a blog post and revealed that “this version brings many improvements related to the IDE and build tools, as well as JavaScript support.” He gave a shout-out to Kirill Rakhman and Yoshinori Isogai, and to everyone who tried the EAP builds of 1.0.4 and sent them feedback.

You can find the entire list of fixes and improvements here.

Changes in Kotlin 1.0.4

In previous versions, users could initialize the same val both in the try and catchbranches of a try/catch statement. Jemerov explained that a final variable could be assigned twice, and it was possible to observe two different values for it.

This is what happens in Kotlin 1.0.4: To preserve consistent semantics, the code which assigns the same val in both try and catch branches becomes a warning. Furthermore, it will become an error in the next version. “In most cases, the code can be easily fixed by converting the code to an expression form, and the IDE will offer a quickfix to convert this code automatically.”

This version also introduces a new experimental implementation of the annotation processing API. Add the following to your build.gradle if you want to enable it:
apply plugin: 'kotlin-kapt'

You will also have to remove the snippet that enables old annotation processing:

Screen Shot 2016-09-23 at 10.05.22 AM

Source: https://blog.jetbrains.com/kotlin/2016/09/kotlin-1-0-4-is-here/#more-4275

There are still known issues in the new annotation processing and may not be compatible with all annotation processors. Jemerov warned that you should enable it only if you’ve run into problems with the default kapt annotation processing implementation.

The JavaScript backend can now compile code to modules that are compatible with AMD, CommonJS and UMD module systems. Plus, a limited form of reflection is now supported: you can use the jsClass property to access the runtime class of any object and jsClass<TypeName>() to get the runtime representation of a specific class.

SEE ALSO: Kotlin 1.0.3 tackles bug fixes, tooling improvements and performance boosts

Compiler, build tools improvements

Compiler:

There is a better type inference for callable expressions, as well as better parser recovery after syntax errors. Kotlin 1.0.4 contains more efficient bytecode for several cases of when and for expressions and there are fixed several cases when “Cast never succeeds” warning was incorrectly reported.

Build tools:

There is now full compatibility with Gradle 2.14 and later and Gradle incremental compilation can now track changes between subprojects. Plus, CLI and Ant builds add the Kotlin reflection library to the classpath by default; you can use the no-reflect switch to disable.

New features in the IDE

You have the option to use Kotlin syntax when evaluating expressions and watches in Java files and there’s a new inspection to detect “leaking this” – possible NullPointerException issues caused by access to incompletely initialized data. A couple of other new features are the intention to convert a lambda to a function reference and the inspection to detect mismatches between Gradle version and Kotlin plugin version.

    DevOpsCon Whitepaper 2018

    Free: BRAND NEW DevOps Whitepaper 2018

    Learn about Containers,Continuous Delivery, DevOps Culture, Cloud Platforms & Security with articles by experts like Michiel Rook, Christoph Engelbert, Scott Sanders and many more.

Author
Gabriela Motroc
Gabriela Motroc is editor of JAXenter.com and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of