Kotlin has emerged as both substitute and supplement to C++ and Java. In 2018, the language had over 96,000 repositories on GitHub and had already reached 1.5M+ users.
More than 50% of professional Android developers now use the language to develop their apps. Google claims that this figure will increase dramatically. Since in future Kotlin will be the first to receive new Jetpack features.
The new Kotlin 1.3.50 release kicks off with various tooling and quality improvements to develop applications much faster. Let’s take a look at the major improvements from this release.
Convert Java-Kotlin with fewer compilation errors
The one-click Java to Kotlin converter tool helps to convert an existing Java project, one file at a time. The converter is not meant to produce 100% error-free code, instead it’s built to reduce compilation errors.
The converted code might show nullability issues that require human intervention. Manual corrections fixes the code for the time being but it doesn’t foolproof the code from runtime errors that show up in the form of nullability mismatch.
The new improved version of Java-to-Kotlin converter (available in preview) tries to infer nullability more correctly based on the Java type usages in the code. And helps in making it easier than ever to convert code with fewer compilation errors. The generated Kotlin code is easier to manipulate too.
Bytecode has a lot of technical information and displaying all of that can make the code bulkier and unreadable. Kotlin ‘Variables’ view now highlights only the most relevant variables, which aids in easier debugging.
- You can set a breakpoint inside lambda expression or at the end of the function as well.
- Improved support for the “Evaluate expression” functionality in the debugger for many non-trivial language features. You can now modify variables via “Evaluate expression”.
New Intentions and Inspections in IntelliJ IDEA
This addition helps in learning how to write idiomatic Kotlin code, improve performance of IDE actions, and fix several known situations that were causing the UI to freeze.
- IntelliJ IDEA now highlights deprecated imports from the completion list
- You can convert normal properties to lazy properties and vice versa
- You can automatically replace the primitive lateinit property with the by Delegates.notNull () syntax
Kotlin/JS now supports Dukat-Gradle integration
Dukat is a converter of TypeScript definition files to Kotlin declarations. By running the build task in Gradle, typesafe wrappers are automatically generated for npm dependencies and can be used from Kotlin.
Other Kotlin/JS updates
- Incremental compilation for Kotlin/JS is now up to 30% faster compared to 1.3.41.
- Support for running and building Kotlin/JS Gradle projects using the org.jetbrains.kotlin.js plugin on Windows.
- As with other platforms, you can use Gradle tasks to build and run projects and resolve NPM dependencies needed for Gradle configuration.
Earlier version names of Kotlin and Kotlin/Native differed from each other. This release uses version 1.3.50 for both Kotlin and Kotlin/Native binaries, reducing the complexity. As the standard library updates to support the kotlin.reflect.typeOf() function for Kotlin/Native types.
- Kotlin Native now ships with an exhaustive set of platform libraries on macOS/iOS and embeds actual bitcode in produced frameworks.
- Kotlin-platform-native is now replaced with Kotlin-multiplatform
Here’s a link to the change log if you’re curious about the other features that are packaged in the Kotlin 1.3.50.
Let us know how you feel about the multiplatform Gradle plugins and handling nullibility errors manually. And ping us here if you need Kotlin development assistance.