Kotlin 1.0 Release Candidate is Out!

Posted on by Andrey Breslav

Finally, Kotlin has graduated the Beta and we are happy to present the Release Candidate Build!

NOTE: as we announced earlier, RC requires all code to be recompiled to make sure no code compiled with older versions is kept around (please recompile even if you were on the EAP version!).

This blog post gives an overview of the changes made since Beta 4. Library changes are the biggest in this build. Also, some bugs have been fixed. Full list of changes is available here.

Kotlin 1.0 RC

See the discussions on Hacker News and Reddit.

Language

First of all, as promised before, there has been a clean-up:

  • All previously deprecated language constructs are now errors, not warnings.
  • All deprecated declarations previously generated in the byte code (such as static fields in interfaces etc) have been removed.

Most other language changes are minor tweaks and bug fixes. Some highlights are given below. See the full list here.

Annotations on delegate fields

The new @delegate: annotation target (use-site) is now supported. For example, to mark the delegate object as @Transient, we can say:

class Example {
    @delegate:Transient
    val foo by Lazy { ... }
}

In the byte code, the field holding the delegate will be annotated.

Type checking for use-site variance

We have fixed a number of annoying bugs connected with use-site variance (type projections). As a result, the compiler may find some previously missed bugs in your code.
For example, in the following case:

val ints = mutableListOf(1, 2, 3)
val strs = mutableListOf("abc", "def")
val comps: MutableList<out Comparable<*>> = ints
comps.addAll(strs) // ?! Adding strings to a list of ints

This code was mistakenly accepted before and is rejected now on the last line with the message:

Projected type MutableList<out Comparable<*>> restricts the use of addAll()

Java Interoperability

Some improvements to synthesized properties derived from Java’s get/set pairs:

  • such declarations (as well as SAM-converted methods) are now resolved on par with members;
  • support added for Java setters that return values.

Support added for @Nullable/@NotNull annotations from various popular libraries such as javax.annotations, Android SDK, etc.
EAP users report:

Android annotations being recognized broke a lot of my code in a good way

And highlighted bug fixes:

  • Private top-level Kotlin classes are now compiled to package-private Java classes
  • Members of private classes can-not be accessed from non-private inline functions

Standard Library

  • Library code rearranged into more granular packages (no source changes should be required)
  • Some functions have been made inline
  • Many inline functions (most of them one-liners) can no longer be called from Java code. This will help us reduce the size of the runtime library in the future.
  • All old deprecations have been removed
  • Map.getOrElse() and Map.getOrPut() now treat keys associated with null values as missing.
  • mutableListOf, mutableSetOf, mutableMapOf added to construct mutable collections.
  • toMutableList added instead of toArrayList. The latter is deprecated
  • associate and associateBy are added to aid construction of maps (instead of toMap/toMapBy)
  • Comparator- and comparison-related functions are moved to kotlin.comparisons package (not imported by default)

More changes here

Tooling

To enable Android Extensions in Gradle in a more idiomatic way, we now say:

apply plugin: 'kotlin-android-extensions'

in the build.gradle file (individually for each project).

The old way doesn’t work any more and prints fixing instructions to the output.

IDE Changes

  • Intention to replace iteration over map entries with a loop using a destructuring declaration
  • Inspection and quickfix to cleanup redundant visibility modifiers
  • Inspection to replace ‘assert’ calls checking that a variable is not null with !! or ?: error(...)
  • Show “Kotlin not configured” notification when opening a .kt file in the IDE if the Kotlin runtime is not configured for the corresponding module
  • Action to generate the toString() method
  • Support for implementing members by primary constructor parameters
  • Parameter info popup works for showing type parameters
  • Completion offers name variants based on unresolved identifiers in current file
  • Quickfix for adding missing branches to a when expression
  • Support for moving nested classes to the upper level or into another top-level class
  • @Suppress now works for IDE inspections

Installation Instructions

For the users of IntelliJ IDEA, automatic updates may not work in the IDE, so you’ll need to download the plugin and install it from a zip file:

  • Download here
  • Go to Preferences | Plugins and click Install plugin from disk…

Sorry for the inconvenience.

Stay tuned

The final release is approaching, meanwhile — have a nice Kotlin! 🙂

P.S. See the discussions on Hacker News and Reddit.

Comments below can no longer be edited.

41 Responses to Kotlin 1.0 Release Candidate is Out!

  1. jugglingcats says:

    February 4, 2016

    Exciting!

  2. Geobert Quach says:

    February 4, 2016

    RC!!! Yay!

  3. Christoph Lingg says:

    February 4, 2016

    final spurt!

  4. Kotlin awesome tricks for Android - Antonio Leiva says:

    February 4, 2016

    […] talking a lot about Kotlin in this blog, but now that Google is also talking about Kotlin, and that Kotlin 1.0 RC has been released, there’s no doubt that Kotlin is much more than just an alternative for Android. Kotlin is […]

  5. Dzmitry says:

    February 4, 2016

    Cool!

  6. Roberto Carlos Gonzalez Flores says:

    February 4, 2016

    Great 🙂
    This is good news

  7. Dave says:

    February 4, 2016

    Very very good!! 🙂

    What do we do about dependencies? Anko, Injekt, Kotson? Do I have to go back to beta version meanwhile? How do I go back until things are working?

    Thanks.

  8. Dave says:

    February 4, 2016

    It looks like Anko 0.8.2 and Injekt 1.12.+ resolves the problem, and issue was posted for Kotson…

  9. John D says:

    February 5, 2016

    Did kapt() get removed from the gradle plugin?

    • John D says:

      February 5, 2016

      Nevermind- I changed
      apply plugin: ‘kotlin-android’
      to
      apply plugin: ‘kotlin-android-extensions’

      which is incorrect.

  10. Kotlin 1.0 Release Candidate is Out! | Kotlin Blog – Temporary index says:

    February 5, 2016

    […] 記事詳細:https://blog.jetbrains.com/kotlin/2016/02/kotlin-1-0-release-candidate-is-out/ […]

  11. Oleg Dubrov says:

    February 5, 2016

    Nice to hear!

  12. Denis says:

    February 5, 2016

    What about Idea 14? I’m having trouble installing plugin from disk.
    Error message states that “Plugin ‘Kotlin’ is incompatible with this installation”.

    I’m using Idea 14.1.5

    Thanks!

  13. Dmitry Kalita says:

    February 5, 2016

    After updating from beta, I have a trouble with @get:JvmName annotation, that works fine before. So the next code:

    interface AppItem {
    @get:JvmName(“hasIcon”)
    val hasIcon: Boolean
    }

    throws compile-time error: “Error:(43, 2) ”@JvmName” annotation is not applicable to this declaration”.

    What is the right way to annotate getter now?

    • Andrey Breslav says:

      February 5, 2016

      This is the right way, but renaming virtual members is forbidden, so you can’t annotate a getter in a interface

      • Dmitry Kalita says:

        February 5, 2016

        May be it will good idea, if kotlin will not add “get” prefix to getter of property, that name starts with “has”. Like kotlin already does, if name starts with “is”. What do you think?

        • Andrey Breslav says:

          February 5, 2016

          Unfortunately, it’s too late for such changes, unless we put it under a compiler option or something

          • Dmitry Kalita says:

            February 5, 2016

            Yes, it would be great to have such compiler option and/or an option that unlocks whole virtual members renaming. Thanks a lot 🙂

  14. Eugene says:

    February 5, 2016

    Does Android module require both now to use kotlin-android-extensions?
    1. apply plugin: ‘kotlin-android-extensions’
    2. buildscript {
    dependencies {
    classpath “org.jetbrains.kotlin:kotlin-android-extensions:kotlinVersion”
    }
    }

    • yanex says:

      February 9, 2016

      You don’t need to add the “org.jetbrains.kotlin:kotlin-android-extensions:…” artifact dependency.

      • Eugene says:

        February 11, 2016

        Not true for me.
        If I remove #2 dependency and try to clean & rebuild the project, I see errors
        Error:(39, 8) Unresolved reference: kotlinx
        and so on.

      • Eugene says:

        February 11, 2016

        Ok, I went thru Stackoverflow question by link bellow. If I put “org.jetbrains.kotlin:kotlin-gradle-plugin” dependency instead, it works. But it strange, guys 🙂 You have to fix it. If plugin dependency defined in global script, why it is required in module script also?

  15. vasea says:

    February 5, 2016

    1.0.0-rc-1036 sources jar, doesn’t contain sources for basic types
    like Array or String
    Instead they have .kotlin_class extension,

    • Dmitry Jemerov says:

      February 5, 2016

      These sources don’t exist. Kotlin’s String is simply java.lang.String for which you can find source in the JDK, and Kotlin’s Array is a Java array which is defined by the JVM directly.

      • vasea says:

        February 8, 2016

        but Intellij IDEA 15 doesn’t know that, it shows decompiled version instead, so thats the problem, you cannot see source for some basic types in IDEA.

  16. Kotlin 1.0 RC announced, the Visa Developer Platform, and Python 3 comes to Scrapy—SD Times news digest: Feb. 5, 2016 - SD Times says:

    February 5, 2016

    […] Other features of 1.0 RC include a cleanup of the language from Beta 4, bug fixes, improvements to Java interoperability, and changes to the standard library. Full details are available here. […]

  17. Kotlin RC and kotlinx – XRubio.com says:

    February 6, 2016

    […] others that come from the same namespace. Resolution is easy: in the announcement for the release Kotlin 1.0 Release Candidate is Out! in the section Tooling, it reads (bold is […]

  18. Kotlin 1.0 RC announced, the Visa Developer Platform, and Python 3 comes to Scrapy—SD Times news digest: Feb. 5, 2016 | OnBrave Software says:

    February 6, 2016

    […] Other features of 1.0 RC include a cleanup of the language from Beta 4, bug fixes, improvements to Java interoperability, and changes to the standard library. Full details are available here. […]

  19. mintori says:

    February 8, 2016

    Kotlin is the best JVM language out there. Thanks so much!!!

  20. Kotlin dilinin 1.0 RC sürümü anons edildi | BTninja says:

    February 8, 2016

    […] ReSharper, Teamcity ve WebStorm gibi popüler yazılım geliştirme araçlarının üreticisi JetBrains, yeni geliştirdikleri programlama dili Kotlin‘in beta sürecinin tamamlandığını ve 1.0 Release Candidate sürümünün hazır olduğunu anons etti. […]

  21. Yiyo Castillo says:

    February 10, 2016

    Please, someone can help me? I have a problem with this release candidate. I can’t import nothing from kotlinx package even using apply “kotlin-android-extensions”. The full description of problem is here: http://stackoverflow.com/questions/35299825/unresolved-reference-kotlinx-kotlin-1-0-0-rc-1036

  22. Max says:

    February 10, 2016

    While the list of changes is great, there’s little additional information about what defines the release candidate here. What makes it different from a beta? What sort of changes can we expect to find or not find between now and 1.0? Is there a roadmap or timeline for 1.0, now that we’re relatively close, or is it still a “when it’s done” sort of thing? What are the main factors in determining when to release 1.0?

    • Andrey Breslav says:

      February 11, 2016

      That’s a lot of questions 🙂

      We are planning to publish 1.0 very-very soon (think days, not weeks). Only critical fixes will be included after the RC.

  23. Szumma #026 – 2016 4-6. hét | d/fuel says:

    February 15, 2016

    […] Kotlin 1.0 Release Candidate is Out! […]

  24. IntelliJ IDEA 16 EAP: Viel Neues für Spring Boot - JAXenter says:

    February 15, 2016

    […] IDEA 16 EAP. Weitere Details und eine komplette Liste der Änderungen seit der Beta 4 können den Release-Informationen von Kotlin entnommen […]

  25. Revue de Presse Xebia | Blog Xebia France says:

    February 15, 2016

    […] « release candidate » de son langage de programmation nommé Kotlin. Sur le de blog de JetBrains, JetBrains détaille les modifications apportées à cette version proche de la version […]

  26. Mobile digest #3 February 01-15.02.2016 | mfp.HELP() says:

    February 16, 2016

    […] Kotlin 1.0 Release Candidate is Out! […]

  27. Kotlin, el nuevo lenguaje de programación para Android | Androideity says:

    February 17, 2016

    […] Hace unos días, el 7 de febrero para ser exactos, la comunidad de desarrolladores Android se estremeció por el anuncio oficial de la versión Kotlin 1.0 Release Candidate. […]