What’s New in Kotlin 1.2.10

Nsikak Thompson
DroidPlate
Published in
3 min readJan 24, 2018

--

The Kotlin 1.2.20 update release was announce on January 17, 2018, a new bugfix and tooling update for Kotlin 1.2.

This updates:

  • Adds support for Gradle build cache
  • Improves incremental compilation for Android and mixed Kotlin/Java projects
  • Provides IDE support for the new Kotlin style guide
  • Adds inlay hints in the editor for implicit parameters and receivers of lambdas, as well as values returned from lambdas
  • Supports development mode in JavaScript DCE Gradle task
  • Introduces new inspections, performance improvements and bug fixes in the IntelliJ plugin

The update is compatible with all versions of IntelliJ IDEA from 2017.1 until 2017.3, as well as with Android Studio 3.0 and 3.1 Canary.

Compilation Performance Improvements

Compilation performance continues to be a major focus for the kotlin team, and in this release we’ve mostly delivered improvements related to the Gradle plugin.

The first improvement is the support for Gradle build cache. If you’re using Gradle 4.3 or newer and the build cache is enabled (it’s not by default, requires --build-cache or org.gradle.caching=true), the plugin will reuse compilation results from previous executions of the Kotlin compile task. For example, if you build the master branch of your code, then switch to a different branch, build again, and switch back to master, the code will not be recompiled – previous results of master compilation will be reused.

Build caching for Kotlin annotation processors is disabled by default, because the dependencies of annotation processors cannot be tracked precisely by Gradle, so it may incorrectly reuse results of a previous execution of an annotation processors. To enable caching anyway, add the following lines to the build script:

Kotlin Style Guide

The new official Kotlin style guide, covering the formatting of Kotlin code and the idiomatic use of language and library features was released also.

Source File name

  • Kotlin file with single class should be named after the class name with the .kt extention appended to it.
  • If file contains multiple classes choose the name that best describes the file contain.
  • Use camel case with Upper case as the first letter e.g. ProcessDeclarations.kt

Class layout

Generally, the contents of a class is sorted in the following order:

  • Property declarations and initializer blocks
  • Secondary constructors
  • Method declarations
  • Companion object

Naming rules

Names of classes and objects start with an upper case letter and use camel humps:

open class DeclarationProcessor { ... }

object EmptyDeclarationProcessor : DeclarationProcessor() { ... }

Get a full picture of the new style guide from here

Check for Update in Android Studio

Kotlin update will alway pop up requesting for permission to install the lastest version on the kotlin plugin

Reference

http://kotlinlang.org/docs/reference/coding-conventions.html

--

--

Nsikak Thompson
DroidPlate

Android developer | Technical writer | Community Enthusiast