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. 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.
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).
Safe Delete
You can now safely remove symbols that are not referenced in the project, including checking for references in comments and strings
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.
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.
Amal says:
August 14, 2013Thank you for the release!
P.S. Error in the url of “Download” link in the end of text.
Hadi Hariri says:
August 14, 2013Thank you Amal. We’ve fixed the error.
Sergey says:
August 14, 2013Thanks for Maven. Guess it’s time to play around with kotlin in our project.
sqhua says:
August 16, 2013Greate ! Kotlin is the best land on JVM
HE Guangyu says:
September 9, 2013Now it’s not compatible with Android studio 0.2.7…… The plugin was removed from plugin repository. What happened?
Andrey Breslav says:
September 13, 2013It was not removed, the UI simply doesn’t show incompatible plugin versions. We’ll deploy a new version of the plugin soon.
mhshams says:
September 12, 2013What 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!") } )
}
Andrey Breslav says:
September 13, 2013We 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.
bsantos says:
December 28, 2013Regarding 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)
}
Hadi Hariri says:
December 28, 2013Not currently
Roadmap de #kotlin | Kotlin.es says:
August 22, 2015[…] oficial en inglés, […]