From the time Kotlin was announced as the official Android app development language, developers have benefitted from the updates released for it. Each update brings along features that make Kotlin far better than its counterpart Java. The most recent updated version of Kotlin i.e., 1.3.60, is an excellent pick for backend projects.
The version has introduced a vast range of new features and improvements that are set to benefit app developers. The main highlights of Kotlin 1.3.60 as advertised are:
1. J2K converter
2. Gradle scripts written in Kotlin
3. Optimized comparison of inline classes.
4. Support for more Kotlin/Native platforms/targets.
5. Improved Kotlin/MPP IDE experience.
6. Added support for source maps for Kotlin/JS and improved platform test runner integration.
7. Preview for some already implemented features of Kotlin 1.4.
The All-New Java-to-Kotlin Converter
App developers found that the tool for converting Java codes to Kotlin was complicated to use. Dealing with Kotlin based solutions required mobile app development companies to deal with various corner-case issues.
There is a unique interoperability of character with Java in Kotlin that makes the transition from Java to Kotlin, an easy exercise for app developers. Developers can now convert several files to Kotlin at once, as they are analyzed together, and the usages form the other data does affect the outcome. The converter will be used for the process by default.
Sturdy Support for IntelliJ IDEA
a.) Better Scratch Files and Worksheets
The most innovative thing about Kotlin 1.3.60 is the redesigned scratch files and worksheets it features. The unique feature allows developers to conduct small experiments with their codebase and see the results in a different window simultaneously. This makes the task of app development and consequent demos for pitching business ideas a whole lot easier for app developers. While the multiline output is wrapped, and the output for the given line remains highlighted.
b.) Debugging Improvements
With 1.3.60 app, developers can set function breakpoints in the code they write. The all-new debugger stops the execution process of entering/exiting the related function. App developers can also introduce an additional entry condition, as and if required.
Kotlin/Native
Focused entirely on performance improvement, Kotlin 1.3.60 brings along several enhancement factors in terms of code optimization, which make Interface calls 5X times and type checks 50X times faster. Now Kotlin /Native comes with compatibility with the latest tooling bits: XCode 11 and LLVM 8.0. While Kotlin/Native compiler is yet to be deeply optimized for performance, this updated version brings a few improvements that result in some impressive speedups. Overall, the compilation speed, especially for large projects, has seen a steep increase by producing native libraries directly from klibs (instead of sources).
Kotlin/JS Updates
Developers will benefit from a more comfortable experience of code debugging. Kotlin brings new changes to focus on your quality of life and simplify working with the new org.jetbrains.kotlin.js plugin.
a.) Source Maps
With Kotlin 1.3.60, source maps are generated automatically for the code that targets JavaScript through the org.jetbrains.kotlin.js Gradle plugin. Developers will enjoy ample opportunities in terms of support for breakpoints, code annotations, and even ease the process of working with tests for the JS targets. They can easily debug their code, as it provides clear stack traces when it runs into an error.
b.) Test runner improvements
When developers run their tests on the JS platform, the standard output generated by them on the regular channels is also included in the generated Gradle reports. This particular functionality is available for the Node.js and browser targets. On integration with source maps, Kotlin makes the stack traces of the tests readable and easy to relate to the code, as it highlights the file names and line numbers pointing directly to the Kotlin sources.
With the latest Kotlin update, test filtering support for the JS target means that the tests can be run selectively instead of having to execute all tasks. App developers can also fix some “corner-case” behavioral peculiarities for tail-recursive functions with Kotlin 1.4. These changes are only noticeable if your tail-recursive function defines default values with side effects.
Kotlin/Multiplatform
MPP tooling is in the limelight with Kotlin 1.3.60. This release comes with a lot of improvements/fixes to the usability within the IDE. Future updates are set to further add to the functionality of the multiplatform side of Kotlin.
Although a developer’s favorite, Kotlin 1.3.60 is only a minor release. There are no significant changes in Kotlin’s 1.3.60 version. Kotlin version 1.4 is all set to be launched in 2020. Kotlin 1.3.60 offers developers to test out some of the upcoming features of Kotlin 1.4. Developers can try some implemented features by specifying the corresponding language version. Detailed below are some of the inclusions of Kotlin 1.4:
i.) NPE Assertions
The previous versions of Kotlin gather support for nullable types to lower down the chances of NullPointerExceptions (NPEs). However, it remained impossible to get rid of NPEs entirely due to interoperability with Java code. Conclusively, Kotlin compiler threw different types of runtime exceptions instead of pure NPEs.
It was important for developers to be familiar with the source of the nullability problem to gain benefit from it. Developers can set the apiVersion to 1.4. Null-check optimizations help developers observe the changed behavior. With Kotlin 1.4, the following code throws a NullPointerException instead of an IllegalStateException along with the old message “JavaCode.getNull() must not be null”:
ii.) Break & Continue Inside when
Kotlin 1.4 features language changes like break and continues inside when loop. The break and continue expressions without labels are forbidden in the current version of Kotlin. It is because these keywords were reserved to be used for fall-through in when possible. But using labels turned out to be confusing, so break and continue to get their expected meaning inside outer loops.
iii.) Changes for Tail-recursive Functions
Initialization Pattern of Default Values
In Kotlin 1.3 version, the default values in the tailrec function were initialized beginning from the last one and ending with the first one. This remained precisely opposite of what was observed in regular functions. With Kotlin 1.3.60, the initialization order of default values is reversed, for the better. This ensures a seamless experience while working with both regular and tailrec functions.
Prohibition of open tailrec functions
In the version of Kotlin that is in use, the open modifier was often ‘ignored.’ Users often faced a warning on combining open and tailrec modifiers together, leading them to confusion. However, with Kotlin 1.4, this will be treated as an error.
Developers can try Kotlin online at play.kotl.in
I. For Maven, Gradle, and npm, Kotlin 1.3.60 can be used as a version for the compiler and the standard library.
II. For IntelliJ IDEA and Android Studio, developers can update the Kotlin plugin to version 1.3.60. Access tools section and click on ‘Configure Kotlin Plugin Updates’ and check for updates.
III. For Eclipse, developers can install the plugin using the Marketplace.
IV. For the command-line, developers can download the compiler from its Github release page.
Most developers held Kotlin and Java in equal regard when it comes to android app development. However, since the release of android app development language-Kotlin’s latest version 1.3.60, app developers are keen on leveraging the diverse number of new updates and enhancements like tooling enhancements for debugging and Gradle scripts, new worksheet mode for IntelliJ IDEA, improved error messages and preview of some Kotlin 1.4 features. This has lead developers into an evident preference tilt towards Kotlin in the battle of Java v/s Kotlin.
Your concerns are legit, and we know how to deal with them. Hook us up for a discussion, no strings attached, and we will show how we can add value to your operations!