title | date | author | tags | keywords | categories | reward | reward_title | reward_wechat | reward_alipay | source_url | translator | translator_url |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Kotlin M2 Candidate |
2012-06-04 01:53:00 -0700 |
Andrey Breslav |
官方动态 |
false |
Have a nice Kotlin! |
It’s been seven weeks since Kotlin M1 release , and I’m happy to invite you to try out a candidate build of Kotlin M2! This post gives an overview of the upcoming milestone release along with come usage instructions.
Our M1 build did a pretty good job: got about 800 downloads , and brought extensive feedback in our forum and issue tracker .
Seems like you have had some fun with it, and we are aiming at even more fun
- Little Things
- Language Features
- JavaScript
- Android
- How to Install the Candidate Build
{% raw %}
{% endraw %}
As usual, it’s been a lot of bugs fixed . I’d like to point out that we are working on the IDE performance. It has been somewhat improved in M2, and will get to its real speed by the next milestone.
Kotlin now respects visibility modifiers. We have four of them:
- private, protected, public — as usual,
- internal — visible inside a module (that is more than a package).
You can now pass an array of values to a vararg-function:
{% raw %}
{% endraw %}fun printAll(vararg a : String) {
for (item in a) println(item)
}
fun main(args: Array<String>) {
printAll("one", "two")
printAll(*args)
}
{% raw %}
{% endraw %}The spread operator “converts” an array into a vararg-list. Unlike Java, this does not present any ugly corner-cases. There will a few more nice things shortly.
While you can still play with Kotlin directly in your browser with Kotlin Web Demo , there’s now a real IDE for Kotlin compiled to JavaScript. When you install the M2 Candidate build of the IntelliJ IDEA plugin , follow these instructions to try out some Kotlin-to-JS compilation:
- Check out kotlin-js-hello project from github
- Open it as an IntelliJ IDEA project
- Set it up as a Kotlin-JS project
- Select your favorite browser and run. The result will open in the browser.
- Have fun editing the JavaScript file as you like and re-running…
Currently, the API documentation is only being prepared. Meanwhile, you can study Kotlin’s JS APIs here .
After fixing some bugs and finding out a lot of interesting stuff (special thanks to Aleksandro Eterverda ), we are ready to run Kotlin on Android!
{% raw %}
{% endraw %}- You’ll need Android SDK installed and set up
- IDE support for Android is available in the Open Source version of IntelliJ IDEA
- Install the M2 Candidate build of the IntelliJ IDEA plugin
- For a quick start, check out kotlin-android-hello project from github
- Set up your run configuration, and run the project (step-by-step here)
- Enjoy
Some other Kotlin programs running on Android:
- We are working on porting standard Android samples to Kotlin: kotlin-samples-for-android. Feel free to contribute!
- Vladimir Lichonos assembled a set of useful Kotlin utilities for Android: kotlinAndroidLib
- Get IntelliJ IDEA (Community or Ultimate) version 11.1.
If you want to separate your work environment from your Kotlin experiments, follow the instructions from here
- If you want to separate your work environment from your Kotlin experiments, follow the instructions from here
- Set up the Integration Build Plugin Repository and install the plugin. Step-by-step instructions here.
{% raw %}
{% endraw %}
{% raw %}
{% endraw %}
Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License .