What Kotlin’s Latest Version, 1.3.60 Means to App Developers?
Kotlin, since the day it has been announced an official Android app development language, has released various updates. It has not only come up with features that makes it win the Kotlin vs Java battle, but also offers better options to developers using it for backend projects.
One such recent update that hit the market in Kotlin 1.3.60.
The Kotlin’s latest version, 1.3.60 has introduced a vast range of new features and improvements to improve the quality of work of app developers. Something about which we will talk in this blog in detail.
What’s New in the Kotlin Latest Version, Kotlin 1.3.60?
1. New Java-to-Kotlin Converter
Kotlin offers the characteristic of interoperability with Java, which makes it easier for various popular apps to migrate from Java to Kotlin.
However, the tool for converting Java codes to Kotlin was somewhat complicated. There were various corner-case issues that app development agencies were required to overcome while creating a Kotlin-based solution. This includes:-
- Conversion for static imports.
- A comprehensive analysis of usages of a collection, etc.
But now, in Kotlin’s latest release, it will be much easier to analyze and convert multiple files together. Also, the converter will be used by default; cutting down the hassles of developers.
For example, if you pass null
as a String
argument to a foo
function in Java. On converting the function and its usage together, the covered Kotlin function will accept a nullable String? as an argument:-
2. Robust Support for IntelliJ IDEA
- Enhanced Scratch Files and Worksheets
When it comes to answering what is new in Kotlin 1.3.60 for developers, the foremost thing to mention is redesigned scratch files and worksheets. This will aid developers with the opportunity to conduct small experiments with their codebase (even use sandbox of the whole project) and see the results in a different window at the same time.
This functionality will make it easier for developers to create demo projects and presentations, which will take forth the Google’s objective behind release of two new courses for learning Kotlin.
- Debugging Improvements
Another update that the latest version of Kotlin language has come up with is the functionality to set function breakpoints. That means, you can now decide when should debugger stops the execution process on entering/existing the related function. In addition to this, you can also introduce an additional entry condition, whenever required.
3. Kotlin/Native Updates
- Better Performance
The new Kotlin version 1.3.60 has also come up with several improvements in terms of code optimization. A result of which is that interface calls will be 5x times and type checks will be 50x times faster than before.
4. Kotlin/JS Updates
- Source Maps
In Kotlin version 1.3.60, source maps for your code that triggers JavaScript through the org.jetbrains.kotlin.js
Gradle plugin is also automatically generated.
This will facilitate developers with a more comfortable experience of code debugging and ample of opportunities in terms of support for breakpoints, code annotations, and even ease the process of working with tests for the JS targets.
Now, while these are some of Kotlin 1.3.60 updates that will change your experience, it is not the only thing that JetBrains have planned for. As already announced, JetBrains is releasing Kotlin 1.4 update in 2020, that will enhance your experience of using Kotlin for Android app development in numerous ways. A few of which we will look at in the next section of this blog.
What are the Upcoming Changes in Kotlin 1.4 Update?
1. NPE Assertions
In the previous Kotlin versions, support for nullable types were provided to lower down the chances of NullPointerExceptions (NPEs). However, it was somewhat impossible to get rid of NPEs completely due to interoperability with Java code. So, Kotlin compiler used to throw different types of runtime exceptions instead of pure NPEs.
However, to be able to take benefit from this, it was a must for developers to be familiar with the source of the nullability problem.
To solve this issue, Kotlin 1.4 update has come up with a new idea. In the upcoming Kotlin programming language version, all runtime null checks will throw java.lang.NullPointerException
rather than KotlinNullPointerException
, IllegalArgumentException
, IllegalStateException
, and TypeCastException
.
2. Use of Break and Continue in When
One of the prime features of Kotlin 1.4 that would bring a difference in the development ecosystem is use of break
and continue
inside when
loop.
In the present scenario, break
and continue
expressions without labels are prohibited since these keywords were reserved to possible be used for fall-through in when. However, using labels was a hectic task. But now, when break
and continue
will get their expected meaning inside outer loops, the changes that hoped to change for the android app development companies.
3. Changes in Tail-Recursive Functions
Last but not least, the upcoming version of Kotlin programming language will bring most awaited changes in tail-recursive functions. A few of which are:-
4. Initialization Pattern of Default Values
In Kotlin 1.3 version, the default values in the tailrec function were initialized from the last one to the first one. This was exactly opposite of what is observed in regular functions.
So, in the new Kotlin update, the initialization order of default values is made reverse. This will help developers enjoy a seamless experience while working with both regular and tailrec functions.
5. Prohibition of open
tailrec
functions
In the current kotlin version, the open modifier was often ‘ignored’ and you get only a warning on combining open and tailrec modifiers together. This results in some confusing behavior.
However, in Kotlin 1.4 update, this will be treated as an error which gives a hope that some steps would be taken in terms of lowering down the associated confusing state.
Now as you know what’s new in Kotlin version 1.3.60 and what would be probable changes in Kotlin 1.4, let’s move ahead to the last section of this blog. That is, the process of updating your development environment to Kotlin 1.3.60.
How to Upgrade to Kotlin 1.3.60?
An option to test the latest Kotlin features is available at play.kotl.in. However, if you wish to update your development environment to Kotlin 1.3.60, here are the steps to take:-
1. For IntelliJ IDEA and Android Studio
In the case of Android Studio and IntelliJ IDEA, you’ve to update the plugin to Kotlin’s latest version by following this path:-
- Go to Tools.
- Then, choose Kotlin.
- Configure Kotlin Plugin Updates
- Click on ‘Check for updates now’ button.
The latest version of the programming language will soon be downloaded and installed on your system.
2. For Eclipse
Here, all you need to do is to install the plugin via the Marketplace.
3. For Maven, npm, and Gradle
Use 1.3.60
as the version for the standard library and compiler, as described in these docs.
Besides, you can download the command-line compiler from the GitHub release page and start with your development.
And in case you come across any problems while updating your development environment to Kotlin’s latest version, you can seek for help on the forums on Slack or report an issue in the issue tracker.
strategies your digital product..