Kotlin 1.1.2 is out
We’re happy to announce the release of Kotlin 1.1.2, the second bugfix and tooling update for Kotlin 1.1. The update brings performance improvements to the compiler and the IntelliJ IDEA plugin, several new features in the tools, and lots of bugfixes in all areas. Kotlin 1.1.2 also brings compatibility with version 2.4.0-alpha of the Android Gradle plugin.
The complete list of changes in this release can be found in the changelog.
We’d like to thank our external contributors whose pull requests were included in this release: Yoshinori Isogai, Jonathan Leitschuh and Kirill Rakhman. Thanks to everyone who tried the EAP builds and sent us feedback, too!
Migration Notes
The Kotlin compiler now requires JDK 8 to run. You shouldn’t notice any changes, because most other Java development tools such as Gradle and the Android toolchain also require JDK 8, so you almost certainly already have it installed. For code generated by the compiler, Java 1.6 compatibility is still the default, and we have no plans to drop support for generating Java 1.6 compatible bytecode.
An object can no longer be declared inside an inner class. Such an object would be able to access the outer class instance, which is conceptually impossible because an object is always a singleton. inner sealed class’es are also prohibited. This is a temporary limitation which will be removed when we add the possibility to declare a subclass of an inner sealed class inside its outer class, and not inside the inner class itself. (KT-16232, KT-16233)
Using a declaration with a name consisting entirely of underscore characters now always requires backticks. (KT-16264)
Starting with this update, the Kotlin plugin no longer supports IntelliJ IDEA 2016.1. The plugin supports all IntelliJ IDEA versions starting from 2016.2, as well as all Android Studio versions starting from 2.2.
Maven Incremental Compilation
Since Kotlin 1.1.2, incremental compilation which was previously available for IntelliJ IDEA and Gradle builds is now supported for Maven. To enable, set the kotlin.compiler.incremental
property to true, using either the -D command line argument or the properties
tag:
<properties> <kotlin.compiler.incremental>true</kotlin.compiler.incremental> </properties>
Maven Annotation Processing
Kotlin’s annotation processing tool, kapt, can now be invoked from Maven builds. Just add an execution of the kapt
goal from kotlin-maven-plugin before compile
:
<execution> <id>kapt</id> <goals> <goal>kapt</goal> </goals> <configuration> <sourceDirs> <sourceDir>src/main/kotlin</sourceDir> <sourceDir>src/main/java</sourceDir> </sourceDirs> <annotationProcessorPaths> <!-- Specify your annotation processors here. --> <annotationProcessorPath> <groupId>com.google.dagger</groupId> <artifactId>dagger-compiler</artifactId> <version>2.9</version> </annotationProcessorPath> </annotationProcessorPaths> </configuration> </execution>
Here is a complete example of the POM file with Java-Kotlin code support and tests.
Please note that kapt
is still not supported for IntelliJ IDEA’s own build system. Launch the build from the “Maven Projects” toolbar whenever you want to re-run the annotation processing.
Inline Method Refactoring
We’ve finally implemented the support for Inline Method (Function) in Kotlin code.
Other IDE Improvements
A large percentage of our efforts in the 1.1.x timeframe is dedicated to improving the performance of the IntelliJ IDEA plugin. We’re releasing several major performance improvements, affecting primarily typing responsiveness, in 1.1.2, and we already have additional major improvements in the pipeline for the 1.1.3 release.
Beyond that, as usual, we’ve implemented a large number of new inspections, quickfixes and small IDE features in this release. Specifically worth mentioning are the support for folding Android String resource references in the editor, as well as new quickfixes for dealing with Android API version issues.
How to update
To update the plugin, use Tools | Kotlin | Configure Kotlin Plugin Updates and press the “Check for updates now” button. Also, don’t forget to update the compiler and standard library version in your Maven and Gradle build scripts.
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.
Let’s Kotlin!
Zuhaerr Mansiv says:
February 14, 2012Congratulations on releasing Kotlin! I’ve downloaded kotlin-plugin-0.1.1358.zip and installed it in IntelliJ IDEA 11.0.2 build IC-111.277, but there is no mention of Kotlin that I can find anywhere in the new project/module dialogs or project/module settings. How can I create a new Kotlin project?
Andrey Breslav says:
February 14, 2012You don’t need to. Create a normal Java project, and as you add a Kotlin file to it, the IDE will propose you to set up the libraries. That’s it.
Check out the video on the home page: http://jetbrains.com/kotlin, there is all the process step-by-step
Dmitry Jemerov says:
February 14, 2012Note that the plugin will not work correctly with IntelliJ IDEA 11.0.2. You need to use the latest EAP build of IntelliJ IDEA 11.1: http://confluence.jetbrains.net/display/IDEADEV/IDEA+11.1+EAP
Zuhaerr Mansiv says:
February 14, 2012I’ve successfully added a Kotlin file now.
Thanks to both of you.
pron says:
February 14, 2012Kongratulations!
tom says:
February 14, 2012This is great news, but please do not adopt the habit of prefixing/starting words with a K (Kompiler, Kontributors). This has proven to be annoying by the Linux desktop project KDE (same with J* for Java and G* for GNU projects).
Ingo says:
February 14, 2012Really amazing stuff, seems to work quite well so far.
There’s a problem with the kotlin plugin that everyone will face immediately when opening the example projects in IDEA: The kotlin runtime is set up with the JAR file
kotlin-0.1.429\dist\kotlinc\lib\kotlin-runtime.jar
That directory does not exist, after changing it to
kotlin-0.1.429\kotlinc\lib\kotlin-runtime.jar
it works correctly.
Andrey Breslav says:
February 14, 2012Thanks, we’ll fix it soon
Mark Derricutt says:
February 14, 2012Is there an update site XML for the kotlin plugin at all?
Andrey Breslav says:
February 16, 2012Currently, there isn’t. We will set one up at some point, of course.
Buster says:
February 14, 2012Exactly where do I set this??
Buster says:
February 14, 2012Nevermind. Found it at bottom of guice-kotlin.jpr. It appears to have compiled and run correctly.
Anton Arhipov says:
February 14, 2012Kool! 🙂
Andrey Breslav says:
February 14, 2012Indeed! Thanks
Dirk Möbius says:
February 14, 2012What a nice Valentine’s Day present! Thanks, and congrats!
Otto Christian says:
February 14, 2012Agreed. I’m feeling the love!
guest says:
February 14, 2012Is there any tutorial, how compile something simple like
fun add(x: Int, y: Int): Int{ return x + y; }
to javascript
function add(x,y) {return x + y;}
?
Andrey Breslav says:
February 15, 2012Sorry, JavaScript is currently only supported on the Web Demo:
http://kotlin-demo.jetbrains.com
guest says:
February 14, 2012Is there any forum or community there I can ask some questions about kotlin?
Andrey Breslav says:
February 15, 2012A forum is being set up at http://devnet.jetbrains.net/community/kotlin
We haven’t migrated to it from our internal resources yet, but this is on the way.
fn says:
February 14, 2012pairless with one access only?
The hint states “there’s a solution that looks at each element only once and uses no data structures like collections or trees.”
This is a fact I doubt. If the array is not sorted, I have to search for each “partner”. Technically, “contains()” is also touching elements inside the array.
This is my shortest solution – any hints or clarifications to the comment?
fun findPairless(a : IntArray) : Int {
a.sort()
for(i in 0..(a.size/2)-1)
if(a[2*i] != a[2*i+1]) return a[2*i]
return a[a.size-1]
}
Andrey Breslav says:
February 15, 2012I can email you a solution that reads every element only once, if you like
Throwable says:
February 14, 2012Ofigenno! 🙂
And is there a planned date for the 1.0 release?
Andrey Breslav says:
February 15, 2012Not really, the design is being settled, and it’s hard to predict how much work will all the changes take.
Ilmari Vacklin says:
February 14, 2012You mention Maven. What does that mean here, exactly? Can I use Kotlin in my Maven-based Java projects right now?
Evgeny Goldin says:
February 14, 2012Hi,
Yes, in a couple of days. Kotlin-Maven-plugin is ready and will be published this week together with Ant task and Gradle plugin.
Steve Holmes says:
February 14, 2012Mmmm… Kotlin Gradle plugin. Me wants!
Andrey Breslav says:
February 14, 2012Sorry, it was a mistake in the announcement: the Gradle support is coming really soon, but it’s not done yet.
Mark Derricutt says:
February 14, 2012Once the maven plugin is setup, will you also be maintaining a maven repository for the plugin? Maybe talk to Sonatype and setup an oss.sonatype.org or repository and start strong with maven central support.
Andrey Breslav says:
February 16, 2012Out public TeamCity server provides an Ivy repository that can be used by Maven.
We’ll consider having something like an oss.sonatype.org as well.
Evgeny Goldin says:
February 16, 2012Please, see the Kotlin Build Tools page for details about compiling Kotlin with Ant and Maven. As Andrey mentioned, Gradle plugin will be released very soon.
Ashwin Jayaprakash says:
February 14, 2012Congrats! Looking forward to try it out.
Buster says:
February 14, 2012I have not used the IDE before. I tried to install the Kotlin plugin by using the “Install Plugin from Disk” option and pointing it to the Kotlin plugin zip file. I get “Fail to load plugin descriptor from file kotlin-0.1.429.zip” error. I am using the latest IU-114.98 IDE.
Zuhaerr Mansiv says:
February 14, 2012Download kotlin-plugin-0.1.1358.zip, not kotlin-0.1.429.zip (this is the standalone compiler).
MuppetGate says:
February 14, 2012Can’t seem to get it to set up the Kotlin runtime. If I click on the link, it just puts up a dialog box saying, ‘kotlin-runtime.jar’ is not found’. Where is the runtime supposed to go?
Buster says:
February 14, 2012Message “Kotlin runtime library is not configured for module ‘guice-kotlin'”
When I click on the Setup Kotlin Runtime link, nothing happens.
Jake Mitchell says:
February 15, 2012You probably need to add the KotlinRuntime library to the project’s External Libraries list. Do this by opening the Project Structure dialogue and provide the path to kotlinc/lib.
MuppetGate says:
February 15, 2012Fixed!
Wrong version
🙂
I’m still not liking the ‘fun’ keyword though.
Koder says:
February 14, 2012Ok, I give up. How do you make this work:
class Data(vararg elements: String) {
fun toString(): String = els.join(“,”)
var els:Array = elements.sort() // doesn’t work
}
Also tried Arrays.sort, Collections.sort, etc. Nothing works.
Andrey Breslav says:
February 16, 2012They return void instead of Array, so it shouldn’t work.
It seems that an extension for Array.sort() is missing in the standard library for now. Please, file a request about it, and feel free to contribute a fix.
Issue tracker: http://youtrack.jetbrains.com/issues/KT
GitHub: http://github.com/jetbrains/kotlin
Koder says:
February 17, 2012I know, that Arrays.sort returns void. I also tried:
fun sort(v: ArrayList):ArrayList {
Collections.sort(v); // error
Collections.sort(v, {(a:String, b:String):Int -> a.compareTo(b) }); // error, too
return v;
}
inline fun <T: Comparable> Array.sort():Array {
Arrays.sort(this); // also an error
Arrays.sort(this, {(a:String, b:String):Int -> a.compareTo(b) }); // here too
return this;
}
Koder says:
February 17, 2012The blog removed all angle brackets, so with []:
fun sort(v: ArrayList[String]):ArrayList[String] {
Collections.sort(v);
Collections.sort(v, {(a:String, b:String):Int -> a.compareTo(b) });
return v;
}
inline fun [T: Comparable[T]] Array[T].sort():Array[T] {
Arrays.sort(this);
Arrays.sort(this, {(a:String, b:String):Int -> a.compareTo(b) });
return this;
}
guangyu says:
February 15, 2012Waiting for IDEA 11.1……
Chris Kent says:
February 15, 2012Is there going to be a Kotlin mailing list or forum? At the moment it’s not clear where the best place is to post questions. There is this blog, Confluence and the bug tracker.
Andrey Breslav says:
February 15, 2012We’ll soon have a forum here:
http://devnet.jetbrains.net/community/kotlin
It’s being set up right now.
jlist says:
February 17, 2012I registered an account for the forum. The Kotlin related three forums are grayed out when I want to post. Forum configuration issue?
Andrey Breslav says:
February 18, 2012Probably, we’ll look into it.
Curtis Stanford says:
February 15, 2012Does the module feature work in Kotlin? The documentation on modules is fairly sparse.
Thanks and congratulations! Can’t wait to use Kotlin for real.
Andrey Breslav says:
February 16, 2012Kotlin modules are in a toddler state now, but they are improving. And thanks for your interest and support!
MuppetGate says:
February 17, 2012Can you pattern match an array of strings? If so, how do you do it?
Fabian says:
February 18, 2012How can we build the stand-alone compiler? The Readme.md on Github only produces the plugin, and the build.xml does not include a target to pack up the stand-alone version of the compiler. I’d really like to fiddle around with Kotlin without having to run IntelliJ.
Andrey Breslav says:
February 18, 2012Actually, build.xml does not produce the plugin, it’s the compiler, as it is built here: http://teamcity.jetbrains.com/viewLog.html?buildId=60069&tab=artifacts&buildTypeId=bt344
Rien says:
February 18, 2012Forum doesn’t seem to be up yet, so I’ll ask here.
Under ubuntu (IC-144.145) the plugin doesn’t seem to work. I get the following error when trying to compile an example:
“Cannot find kotlinc home. Make sure plugin is properly installed”
Plugin seems to be installed fine, can I edit the location of “kotlinc home” manually somewhere?
Andrey Breslav says:
February 19, 2012kotlinc must be coming together with the plugin. Could you file an issue to our tracker: http://youtrack.jetbrains.com/issues/KT ?
Thanks
Rien says:
February 19, 2012My bad, I installed the plugin jar file found in the zip file. Installing the plugin from the zip file fixed my problems.
Andrey Breslav says:
February 20, 2012The forum should be fixed now.
Интересные материалы для Android-разработчика #68 - Подкасты Android Dev says:
April 25, 2017[…] Kotlin 1.1.2 […]
Omar Assadi says:
April 26, 2017Glad to hear kapt works on Maven now! Not having built-in support was what finally made me switch to Gradle, actually.
Bagičan K. says:
April 26, 2017Is possible to write a simple shared library (platform-independent) and use it in JVM project and also in JavaScript project?
Thanks for answer.
Dmitry Jemerov says:
April 26, 2017We’re working on a set of features to enable this, and we plan to announce them in one of the future releases of Kotlin.
Bagičan K. says:
April 26, 2017Thanks for reply. Great! It would be very huge improvement for development experience.
David R. says:
April 26, 2017Can you clarify if this is somehow different than the Kotlin JS effort? Because our team is considering utilizing that for a similar concept of writing a simple shared library in Kotlin that could also used used in our JS client code.
Dmitry Jemerov says:
April 26, 2017This is different, yes. We will support multiplatform libraries that will contain both shared code and code specific to different platforms.
Kotlin 1.1.2 发布,基于 JVM 的编程语言 | News Pod says:
April 26, 2017[…] 更新内容较多,详情请参阅 发布主页。 […]
Suresh says:
April 26, 2017When will gradle plugin get updated (https://plugins.gradle.org/search?term=org.jetbrains) ? It’s showing as 1.1.2-test-2.
Chrisitan says:
April 26, 2017This minor release introduces breaking changes and hence doesn’t follow semantic versioning. Why are version numbers used as if they were expensive? Version numbers are so cheap these days! 😉
Dmitry Jemerov says:
April 26, 2017These breaking changes are essentially bugfixes: things that didn’t work properly before are now expressly forbidden.
Ryba says:
April 26, 2017Normally those type of bugfixes increment the “minor” version, not the “patch” version. So really if this followed the actual semantics then it would be 1.2.0 not 1.1.2.
Dmitry Jemerov says:
April 26, 2017Kotlin does not use semantic versioning. Instead, it has its own policy for compatibility and version numbers, which is described here: http://kotlinlang.org/docs/reference/compatibility.html
Arild J. says:
April 26, 2017Aw yeah, I’ve really been missing that Inline Method intent!
Kotlin 1.1.2 erschienen: Gute Nachrichten für Maven-Nutzer - JAXenter says:
April 26, 2017[…] Mehr Informationen zum aktuellen Release finden Sie auf dem Kotlin Blog. […]
ov7a says:
April 26, 2017You have a bug in your pie chart: “bug fixes” label is upside down 🙂
SnakeEys says:
April 27, 2017Chinese translation
https://www.kotliner.cn/2017/04/25/Kotlin%201.1.2%20is%20out/
Jerry Destremps says:
April 28, 2017Can’t update Android Studio. All my co-workers are getting the same error for the past couple of days:
2017-04-27 17:47:40,940 [112178768] WARN – Settings.impl.PluginDownloader – Cannot download ‘http://plugins.jetbrains.com/pluginManager/?action=download&id=org.jetbrains.kotlin&build=AI-162.2228.14&uuid=fea061f2-e20e-47da-a230-b1374ea9f287’: Read timed out
, response: 200 OK
java.io.IOException: Cannot download ‘http://plugins.jetbrains.com/pluginManager/?action=download&id=org.jetbrains.kotlin&build=AI-162.2228.14&uuid=fea061f2-e20e-47da-a230-b1374ea9f287’: Read timed out
, response: 200 OK
at com.intellij.util.io.HttpRequests$RequestImpl.saveToFile(HttpRequests.java:345)
at com.intellij.openapi.updateSettings.impl.PluginDownloader$1.process(PluginDownloader.java:242)
at com.intellij.openapi.updateSettings.impl.PluginDownloader$1.process(PluginDownloader.java:239)
at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:389)
at com.intellij.util.io.HttpRequests.process(HttpRequests.java:383)
at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:56)
at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:244)
at com.intellij.openapi.updateSettings.impl.PluginDownloader.downloadPlugin(PluginDownloader.java:239)
at com.intellij.openapi.updateSettings.impl.PluginDownloader.prepareToInstall(PluginDownloader.java:142)
at org.jetbrains.kotlin.idea.KotlinPluginUpdater$installPluginUpdate$2.run(KotlinPluginUpdater.kt:245)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:128)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:593)
at sun.security.ssl.InputRecord.read(InputRecord.java:532)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.MeteredStream.read(MeteredStream.java:134)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3336)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3329)
at com.intellij.util.net.NetUtils.copyStreamContent(NetUtils.java:191)
at com.intellij.util.io.HttpRequests$RequestImpl.saveToFile(HttpRequests.java:341)
… 22 more
Dmitry Jemerov says:
April 28, 2017If downloading from the IDE doesn’t work, you can use your Web browser to download the plugin from https://plugins.jetbrains.com/plugin/6954-kotlin and then use Settings | Plugins | Install from disk to install it.
Igor Ganapolsky says:
May 24, 2017I am unable to compile with Kotlin 1.1.2-3 in Android Studio. I get this error:
Dmitry Jemerov says:
May 24, 2017If you’re using Android build tools version 3.0.0-alpha1, you need to update your Kotlin version to 1.1.2-4.