Kotlin 1.1.2 is out

We’re happy to announce the release of Kotlin 1.1.2, the second bugfix and tooling update for Kotlin 1.1. The update brings performance improvements to the compiler and the IntelliJ IDEA plugin, several new features in the tools, and lots of bugfixes in all areas. Kotlin 1.1.2 also brings compatibility with version 2.4.0-alpha of the Android Gradle plugin.

The complete list of changes in this release can be found in the changelog.

Migration Notes

The Kotlin compiler now requires JDK 8 to run. You shouldn’t notice any changes, because most other Java development tools such as Gradle and the Android toolchain also require JDK 8, so you almost certainly already have it installed. For code generated by the compiler, Java 1.6 compatibility is still the default, and we have no plans to drop support for generating Java 1.6 compatible bytecode.

An object can no longer be declared inside an inner class. Such an object would be able to access the outer class instance, which is conceptually impossible because an object is always a singleton. inner sealed class’es are also prohibited. This is a temporary limitation which will be removed when we add the possibility to declare a subclass of an inner sealed class inside its outer class, and not inside the inner class itself. (KT-16232, KT-16233)

Using a declaration with a name consisting entirely of underscore characters now always requires backticks. (KT-16264)

Starting with this update, the Kotlin plugin no longer supports IntelliJ IDEA 2016.1. The plugin supports all IntelliJ IDEA versions starting from 2016.2, as well as all Android Studio versions starting from 2.2.

Maven Incremental Compilation

Since Kotlin 1.1.2, incremental compilation which was previously available for IntelliJ IDEA and Gradle builds is now supported for Maven. To enable, set the kotlin.compiler.incremental property to true, using either the -D command line argument or the properties tag:

1

2

3

4

<properties>

<kotlin.compiler.incremental>true</kotlin.compiler.incremental>

</properties>

Maven Annotation Processing

Kotlin’s annotation processing tool, kapt, can now be invoked from Maven builds. Just add an execution of the kapt goal from kotlin-maven-plugin before compile:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

<execution>

<id>kapt</id>

<goals>

<goal>kapt</goal>

</goals>

<configuration>

<sourceDirs>

<sourceDir>src/main/kotlin</sourceDir>

<sourceDir>src/main/java</sourceDir>

</sourceDirs>

<annotationProcessorPaths>

<!--Specify your annotation processors here.-->

<annotationProcessorPath>

<groupId>com.google.dagger</groupId>

<artifactId>dagger-compiler</artifactId>

<version>2.9</version>

</annotationProcessorPath>

</annotationProcessorPaths>

</configuration>

</execution>

Here is a complete example of the POM file with Java-Kotlin code support and tests.

Please note that kapt is still not supported for IntelliJ IDEA’s own build system. Launch the build from the “Maven Projects” toolbar whenever you want to re-run the annotation processing.

Inline Method Refactoring

We’ve finally implemented the support for Inline Method (Function) in Kotlin code.

Other IDE Improvements

A large percentage of our efforts in the 1.1.x timeframe is dedicated to improving the performance of the IntelliJ IDEA plugin. We’re releasing several major performance improvements, affecting primarily typing responsiveness, in 1.1.2, and we already have additional major improvements in the pipeline for the 1.1.3 release.

Beyond that, as usual, we’ve implemented a large number of new inspections, quickfixes and small IDE features in this release. Specifically worth mentioning are the support for folding Android String resource references in the editor, as well as new quickfixes for dealing with Android API version issues.

How to update

To update the plugin, use Tools | Kotlin | Configure Kotlin Plugin Updates and press the “Check for updates now” button. Also, don’t forget to update the compiler and standard library version in your Maven and Gradle build scripts.

As usual, if you run into any problems with the new release, you’re welcome to ask for help on the forums, on Slack (get an invite here), or to report issues in the issue tracker.

Can you clarify if this is somehow different than the Kotlin JS effort? Because our team is considering utilizing that for a similar concept of writing a simple shared library in Kotlin that could also used used in our JS client code.

Can’t update Android Studio. All my co-workers are getting the same error for the past couple of days:

2017-04-27 17:47:40,940 [112178768] WARN – Settings.impl.PluginDownloader – Cannot download ‘http://plugins.jetbrains.com/pluginManager/?action=download&id=org.jetbrains.kotlin&build=AI-162.2228.14&uuid=fea061f2-e20e-47da-a230-b1374ea9f287’: Read timed out
, response: 200 OK
java.io.IOException: Cannot download ‘http://plugins.jetbrains.com/pluginManager/?action=download&id=org.jetbrains.kotlin&build=AI-162.2228.14&uuid=fea061f2-e20e-47da-a230-b1374ea9f287’: Read timed out
, response: 200 OK
at com.intellij.util.io.HttpRequests$RequestImpl.saveToFile(HttpRequests.java:345)
at com.intellij.openapi.updateSettings.impl.PluginDownloader$1.process(PluginDownloader.java:242)
at com.intellij.openapi.updateSettings.impl.PluginDownloader$1.process(PluginDownloader.java:239)
at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:389)
at com.intellij.util.io.HttpRequests.process(HttpRequests.java:383)
at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:56)
at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:244)
at com.intellij.openapi.updateSettings.impl.PluginDownloader.downloadPlugin(PluginDownloader.java:239)
at com.intellij.openapi.updateSettings.impl.PluginDownloader.prepareToInstall(PluginDownloader.java:142)
at org.jetbrains.kotlin.idea.KotlinPluginUpdater$installPluginUpdate$2.run(KotlinPluginUpdater.kt:245)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:128)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:593)
at sun.security.ssl.InputRecord.read(InputRecord.java:532)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.MeteredStream.read(MeteredStream.java:134)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3336)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3329)
at com.intellij.util.net.NetUtils.copyStreamContent(NetUtils.java:191)
at com.intellij.util.io.HttpRequests$RequestImpl.saveToFile(HttpRequests.java:341)
… 22 more