Kotlin 1.0.2 is Here

We’re happy to announce the release of Kotlin 1.0.2, the second bugfix and tooling update for Kotlin. In addition to compiler and language bugfixes, Kotlin 1.0.2 adds a number of major features to the IDE and the build tools.

Incremental Compilation in Gradle and the IDE

The new release continues our work on Kotlin incremental compilation support, speeding up the turnaround time during development. Incremental compilation in the IDE (which was previously marked as experimental) is now enabled by default. Also, the long-awaited support for incremental compilation in Gradle builds is now there.

To enable incremental compilation for Gradle, you need to set the kotlin.incremental property to true (for example, by adding the line kotlin.incremental=true to the gradle.properties file in the root directory of your project).

Android Lint Checks

Kotlin 1.0.2 introduces support for Android Lint checks for Kotlin code, ensuring that issues like using the API not available in the Android version you’re targeting are correctly detected.

The set of checks supported in Kotlin 1.0.2 corresponds to the checks supported in Android Studio 1.5; checks added or improved in Android Studio 2.0 will be supported in the next release of Kotlin. Also, the current version runs Lint checks for Kotlin code only inside the IDE (as part of on-the-fly code inspections, or in batch mode through Analyze | Inspect Code). Running checks from the command line will be supported in the next release.

Compact Standard Library

One other improvement relevant for Android developers is that the size of the standard library has been reduced by ~1500 methods (from approximately 6600 to 5100). Even before this change, the library was smaller than those of Kotlin’s main competitors, and now the situation is even better. Of course, the library is still fully binary compatible.

Java 7/8 Support Libraries

As a temporary workaround for better Java 7/8 support before full support is introduced in Kotlin 1.1, we’re now providing support libraries that expose the APIs added in Java 7 and 8 (such as the Stream API) as extension functions on Kotlin standard library classes. See the forum post for instructions on using the libraries.

IntelliJ IDEA Plugin features

The IntelliJ IDEA plugin has gained a number of major new features:

  • For users of Android Studio, there’s now a possibility to create a new activity in Kotlin;
  • For users of IntelliJ IDEA Ultimate, there is now initial support for the Spring Framework, including inspections, line markers, SpEL language injection support, actions to generate dependencies, and more;
  • A bunch of inspections and quickfixes have been added, such as an inspection for highlighting vars that can be val;
  • Improvements to Gradle integration, debugger, formatter, refactorings and other areas of the plugin.

JavaScript support

We’ve resumed work on our JavaScript backend, and the version 1.0.2 fills in most of the remaining gaps in the language feature support when targeting JavaScript. Newly supported features include nested classes, local classes, non-local returns in local lambdas, unsafe casts and more.

Maven Archetype

We’re now providing a Maven archetype to easily create Kotlin projects. Use “New project | Maven | Create from Archetype…” in IntelliJ IDEA, or the following command line:

Dokka 0.9.8

Together with Kotlin 1.0.2, we’re releasing a new version of Dokka, the Kotlin documentation generation tool. If you’re using Dokka in your project, you need to upgrade Dokka together with Kotlin, because older Dokka versions are incompatible with Kotlin 1.0.2. New features in Dokka 0.9.8 include:

  • Android Gradle plugin, for generating documentation for Android libraries and applications;
  • Support for generating a javadoc jar file in the Maven plugin.

Conclusion

You can see the full list of bugfixes and changes to the compiler, standard library and the tools in the changelog.

While working on the release, we received a lot of valuable feedback from the users of the Early Access Preview builds. We’re really grateful to everyone who has provided feedback, and we welcome you to join the EAP program for future updates.

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.

This entry was posted in Releases. Bookmark the permalink.

23 Responses to Kotlin 1.0.2 is Here

  1. Simophin says:

    Congratulations! Can’t wait to try out incremental compilation!

  2. mintori says:

    Another great release. Thanks!

  3. soywiz says:

    We have a problem that used to work on 1.0.1. This is an intended change not documented in this post or just a regression?

    open class Test(val parent:Demo) : Demo() {
    override fun a() {
    parent.a() // cannot access ‘a’: it is ‘protected’ in Demo (it worked on 1.0.1 and 1.0.1-2 but doesn’t work anymore on 1.0.2)
    }
    }

    abstract class Demo {
    abstract protected fun a(): Unit
    }

    • Dmitry Jemerov says:

      Yes, this is an intended change, mentioned in the changelog. Previous versions of Kotlin did not implement proper checks for ‘protected’ visibility, and the new one does.

  4. Bruno Ortiz says:

    Congratulations! But the spring support doesn’t work in my project :/

    • Dmitry Jemerov says:

      Please file a YouTrack issue with more details (a code sample and a description of what exactly you expect to work and what does not).

    • ache says:

      Sorry for inconvenience. To use spring please try newly uploaded version 1.0.2-release-IJ143-96.

  5. unixxx says:

    Are there any plans on making web framework for Kotlin?

  6. Ranie Jade Ramiso says:

    I get this when setting kotlin.incremental to true in a gradle based project.

    Caused by: java.lang.NoSuchFieldError: FILE_HASHING_STRATEGY
    at org.jetbrains.kotlin.incremental.storage.FileKeyDescriptor.getHashCode(externalizers.kt:188)
    at org.jetbrains.kotlin.incremental.storage.FileKeyDescriptor.getHashCode(externalizers.kt:180)
    at com.intellij.util.containers.hash.HashUtil.hash(HashUtil.java:40)
    at com.intellij.util.containers.hash.LinkedHashMap.remove(LinkedHashMap.java:147)
    at com.intellij.util.containers.SLRUMap.remove(SLRUMap.java:113)
    at com.intellij.util.io.PersistentHashMap.doPut(PersistentHashMap.java:351)
    at com.intellij.util.io.PersistentHashMap.put(PersistentHashMap.java:332)
    at org.jetbrains.kotlin.incremental.storage.LazyStorage.set(LazyStorage.kt:70)
    at org.jetbrains.kotlin.incremental.storage.FileToIdMap.set(FileToIdMap.kt:30)
    at org.jetbrains.kotlin.incremental.LookupStorage.addFileIfNeeded(LookupStorage.kt:129)
    at org.jetbrains.kotlin.incremental.LookupStorage.access$addFileIfNeeded(LookupStorage.kt:32)
    at org.jetbrains.kotlin.incremental.LookupStorage$addAll$pathToId$1.invoke(LookupStorage.kt:73)
    at org.jetbrains.kotlin.incremental.LookupStorage$addAll$pathToId$1.invoke(LookupStorage.kt:32)
    at org.jetbrains.kotlin.utils.CollectionsKt.keysToMap(collections.kt:22)
    at org.jetbrains.kotlin.incremental.LookupStorage.addAll(LookupStorage.kt:73)
    at org.jetbrains.kotlin.incremental.BuildUtilKt.update(buildUtil.kt:151)
    at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler(Tasks.kt:426)
    at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler(Tasks.kt:149)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:110)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    … 60 more

  7. Misha says:

    Is it possible to instantiate javascript class from Kotlin without declaring corresponding kotlin class?
    Example:
    foo.js:
    function Point() {
    this.x = 0
    this.y = 0
    }
    Point.prototype = …
    Point.prototype.constructor = Point

    bar.kt:
    val point = Point() //this is translated to function call, i.e. Point() instead of new Point()

    Ofcourse if I add:
    @native(“Point”)
    class Point() {
    }

    then everything works as expected.

    • Alexey Andreev says:

      In your case Point() won’t be translated to anything, rather compiler reports “Unresolved reference” error. If you want to invoke JS directly, use the following notation:

      val point = js(“new Point()”)

  8. Pingback: Issue #205 | 神刀安全网

  9. someone says:

    Is it possible to set kotlin.incremental in build.gradle?

    • Alexey Tsvetkov says:

      I’m afraid it’s not possible. You can use either gradle.properties or local.properties file.

      If it is not convenient for you, please create an issue in our bugtracker.

  10. Kostya says:

    How detect that incremental compilation is working fine?

    • Alexander Udalov says:

      The following warning message in your build log means that the IC is working: “Using experimental kotlin incremental compilation”

  11. Pingback: JVM-Sprache Kotlin: Version 1.0.2 führt inkrementellen Compiler ein [Update] - JAXenter

  12. Trevor says:

    Thanks everyone! Kotlin is by far my favorite language to develop in, but unfortunately we’re still having trouble with developing Kotlin libraries.

    According to the change log, https://youtrack.jetbrains.com/issue/KT-8592 was fixed in this release, but we’re still having problems attaching Kotlin source (from the “Choose Sources” dialog).

    In the dialog, if we choose the top-level module, it doesn’t show the actual source as a source root, but it does show generated files in the /build/ directory as well as unit test files. If we manually dive down into /src/main the dialog will dismiss and we’ll get the permanent “Attaching…” problem seen in the ticket and the forum post.

    Found in Android Studio 2.1.1, Kotlin 1.0.2 and plugin 1.0.2-release-IJ143-96.

  13. SliBo says:

    Thank you, Kotlin team.

    I’m Android developer.

    I decided to try to create an application using Kotlin language. So I decided to do to start something very simple. And I chose the quiz. Thus was born the app – Quizio: Geography

    https://play.google.com/store/apps/details?id=com.quizio

    Please donate it by your votes!

    Thanks a lot!

Comments are closed.