Kotlin M6 is here!

We’ve reached our sixth milestone, and with it, have some great features in store, both in terms of language improvements as well as tooling.

Language Improvements

SAM Conversions

We have completed the initial support we provided for calling Java interfaces with Single Abstract Methods in M5.2. You can now simply do

SwingUtilities.invokeLater { doItNow() }

and is now on any SAM interface (i.e. Callable(), Comparator(), etc.). The Runnable function is still available for those cases where required.

Annotation Improvements

You can now have annotations with arguments of type enum, as well as arrays and the possibility of passing in a variable number of arguments with vararg.

annotation class validate(val side: Side, vararg val props: String)

where Side can be an enum

enum class Side {
   Client
   Server
   Both
}

Static Fields

We covered Static constants in Kotlin previously. With this release, you can now use class objects and have their properties represented as true static fields in Java to assure 100% interoperability.

Maven

For those of you using Maven, you’ll be pleased to know that Kotlin is now available on Maven Central. Snapshot repository has also been moved to oss.sonatype.org. For more information about Maven support please see the documentation on Maven support.

Android Studio Support

You probably heard the news a few months back that Google has been working on a new development IDE called Android Studio for developing Android applications, based on IntelliJ IDEA Community Edition. With this milestone, we now provide support for this IDE. You now have all the functionality you get for Kotlin in IntelliJ IDEA, in Android Studio also. Android Studio We’ll be taking a more in-depth look at Android Studio support including how to set up Gradle in to work with Kotlin as well as laying out the project in a separate post.

New Refactorings

In addition to supporting Android Studio, we also have some new IDE refactoring available in M6.

Inline Variable

You can make a variable inline with a simple key press. image

Split / Join Property Declarations

As you know, Kotlin allows properties to initialized on the declaration. IntelliJ IDEA now allows us to easily refactor this to two separate expressions using the Split property declaration intention or join them up again in a single one (using Edit | Join Lines). image

Safe Delete

You can now safely remove symbols that are not referenced in the project, including checking for references in comments and strings image

Unwrap / Remove Expressions

Same as the support for other languages in IDEA, you can now unwrap or remove expressions from inside the enclosing statements, via the Code | Unwrap/Remove Refactoring. image

Other Features and Improvements

In addition to the above features, this release also brings some other goodies

  • Performance improvements. We have been working to improve performance including faster completion and some other general performance enhancements. More work is needed but we’re on the right track.
  • TestNG. You can now right-click on a class or function and run the test using TestNG (thanks to Jayson Minard).

Download it now and give it a try and please let us know if you have any issues. Important: If you’re using IntelliJ 13 EAP, please note you need the latest build to work with this release.

This entry was posted in General and tagged . Bookmark the permalink.

10 Responses to Kotlin M6 is here!

  1. Amal says:

    Thank you for the release!

    P.S. Error in the url of “Download” link in the end of text.

  2. Sergey says:

    Thanks for Maven. Guess it’s time to play around with kotlin in our project.

  3. sqhua says:

    Greate ! Kotlin is the best land on JVM

  4. HE Guangyu says:

    Now it’s not compatible with Android studio 0.2.7…… The plugin was removed from plugin repository. What happened?

  5. mhshams says:

    What about SAM support for within Kotlin ?

    Any plan to support this:

    trait Action { fun execute() }

    fun executeAction(action: Action) { action.execute() }

    fun main(args: Array) {
    executeAction( { println("Hello World!") } )
    }

    • We are not planning to support SAM conversions for Kotlin. We think function types are good enough. What we are planning to have, though, is type aliases, so that you can use name Action instead of a function type signature.

  6. bsantos says:

    Regarding the enums, would it be possible to easily create alias to same values?

    For example, in some cases it would be convenient to have something like:


    enum class UnitsOfLength(value:Double) {
    KILOMETER, km : UnitsOfLength(1000.0)
    METER, m : UnitsOfLength(1.0)
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>