Kotlin 1.2.50 is out!

We’re happy to announce the release of Kotlin 1.2.50, a new bugfix and tooling update for Kotlin 1.2. This release:

  • Updates Kotlin support in the Eclipse IDE plugin
  • Adds new functions in common and JS parts of the standard library
  • Brings JUnit 5 support to kotlin.test
  • Improves experimental scripting support
  • Introduces Runnable Kotlin scratch files in IntelliJ IDEA
  • Speeds up building multimodule Android projects with Gradle
  • Updates experimental @JvmDefault support with a binary compatibility mode
  • Introduces a progressive compiler mode
  • Fixes a lot of known issues in the compiler and the IDE plugin and provides performance improvements

The update is compatible with all versions of IntelliJ IDEA from 2017.2 to 2018.2 EAP, as well as with Android Studio 3.0, 3.1, and 3.2 Canary.

We’d like to thank our external contributors whose pull requests were included in this release: Toshiaki Kameyama, Mikaël Peltier, Raluca Sauciuc, meztihn, Ivan Gavrilovic, Denis Vnukov, Derek, Florian Steitz, Jim S, Evgeny Zakharov, Aaron Nwabuoku, Alexey Belkov, Claus Holst, Elifarley C, Felix Guo, Gabryel Monteiro, Gilkeson, Juan Chen, Mon_chi, Valeriy Zhirnov, Steven Spungin, Swapnil Sankla, TakuyaKodama, and Kenji Tomita

The complete list of changes in this release can be found in the changelog. Read on for the highlights.

Eclipse IDE plugin update

We are proud to present the new 0.8.5 release of our plugin for the Eclipse IDE. Along with support for the Kotlin 1.2.50 compiler, this update brings several features and improvements such as:

  • support for the Kotlin compiler plugins like kotlin-allopen and kotlin-spring
  • preferences in configuring the version of the generated JVM bytecode
  • bug-fixes in the debugger and J2K converter

Workspace-wide Kotlin compiler preferences, which allow you to configure compiler plugins and other compiler options, can be found in Preferences | Kotlin | Compiler. It is also possible to configure only project-level settings.

The updated Kotlin Eclipse Plugin is available on the Eclipse Marketplace. See the ‘Getting Started’ tutorial for details.

Library updates

In this update, a set of toString(radix: Int) extension functions for Byte, Short, Int, and Long were added to the common and Kotlin/JS parts of the standard library, thanks to our contributor Florian Steitz. They are ready for use in experimental multiplatform projects and projects targeting JavaScript.

Another addition to the common and Kotlin/JS standard library parts are the two constructors, String(chars: CharArray) and String(chars: CharArray, offset: Int, length: Int). These are meant for efficient conversion of a CharArray to String. This change was contributed by Valeriy Zhirnov.

Also, the kotlin.test library now supports testing with the JUnit 5 framework with a separate module kotlin-test-junit5, which provides an implementation of Asserter on top of JUnit 5 and maps the test annotations from kotlin-test-annotations-common to the JUnit 5 test annotations.

Improved experimental scripting support

This release introduced new experimental scripting support that allows easier kotlin scripts customization, simpler use of the scripts with standard compiler and IDEA plugin, and simpler scripting host creation and embedding. The complete Kotlin scripting proposal along with the current implementation state could be found in the appropriate KEEP. Some highlights include:

  • it is now possible to create a jar defining a script and if that jar is added to the compilation classpath, the scripts of this type will be automatically supported by the compiler and IDEA plugin
  • it is now possible to pass typed external variables to the script compilation, so they will be accessible as if they are global variables defined outside of the script
  • the structure of the scripting support is now much simpler and provided helpers allow to implement and embed a custom scripting host much easier than before

IntelliJ IDEA plugin improvements

Runnable Kotlin scratch files and Kotlin scripts

The update of the Kotlin IntelliJ IDEA plugin introduces support for runnable Kotlin scratch files. These can use the declarations from the code in the project as well:

Besides, IDE support for Kotlin Script (*.kts) files has been improved. You can now create new scripts in the Project View and run them within the classpath of the module they are placed in.

Raw strings input and indentation

The updated IDE plugin makes it easier to type raw string literals, as it now inserts the pairing """ automatically and provides an intention to indent the literal (thanks to our contributor Toshiaki Kameyama). This is useful when you paste a multiline string:

Other improvements in the IntelliJ IDEA plugin

  • A few new inspections and intentions that are here to help with kotlinx.coroutines – these detect unused Deferred and async results and convert async(ctx) { }.await() to withContext(ctx) { }.
  • An intention to convert end-of-line comments into block ones and vice versa.
  • A lot of bugfixes, stability improvements and performance optimizations.

Faster Gradle builds

Starting with Kotlin 1.2.50, Kotlin tracks changes incrementally across the modules of a multimodule Android project. This results in significantly faster incremental builds of large Android projects with multiple interdependent modules.

Changes in the compiler

The Kotlin 1.2.50 update fixes a lot of known issues in the compiler, delivers performance and stability improvements, and adds the new features listed below.

Progressive compiler mode

While most bugs and inconsistencies found in the Kotlin compiler are fixed as soon as possible, some of the fixes may potentially be backward-incompatible. The Kotlin compatibility policy requires us to introduce such fixes only in major releases (such as 1.1 and 1.2) and go through lengthy migration cycles. We, however, believe that many users will benefit from these bug-fixes being delivered quicker, making their code safer and cleaner.

In this release, we introduce an experimental progressive compiler mode intended for actively developed codebases whose maintainers regularly update to latest versions of the Kotlin compiler and tools. In this mode, some of the deprecations and bug-fixes for unstable code take effect immediately. Consequently, some code may break upon enabling the mode or upon updating Kotlin to future versions while keeping the progressive mode enabled.

Fixes that are chosen to be enabled in the progressive mode won’t affect too many places in the codebases, though they won’t work silently and will require the maintainers to fix the erroneous pieces of code. We are going to provide automated migration tools in the IDE plugin for this where possible. Any code fixed in this way will stay valid outside the progressive mode, too. For examples of issues with fixes applied in the progressive mode, see KT-9580, KT-16681, or KT-17981.

You can enable the progressive mode on a per-module basis by adding the flag -Xprogressive to the arguments passed to the Kotlin compiler.

@JvmDefault binary compatibility mode

Experimental support for generating default methods for JVM interfaces with @JvmDefault has been updated to compile the default methods in a way that is binary-compatible with normal default implementations in Kotlin interfaces. To switch to this mode, use the compiler flag -Xjvm-default=compatibility.

Also note that the compiler flag -Xenable-jvm-default introduced in Kotlin 1.2.40 is no longer supported. Please use -Xjvm-default=enable instead.

Argument files

Kotlin 1.2.50 supports passing compiler arguments in a file with the command line option -Xargfile=args.txt, which helps call the command line compiler with long filesystem paths in the arguments.

How to update

To update your IntelliJ IDEA or Android Studio plugin, use Tools | Kotlin | Configure Kotlin Plugin Updates and click the ‘Check for updates now’ button. The Eclipse IDE plugin can be installed or updated via the Eclipse Marketplace (Help | Eclipse Marketplace and search for the Kotlin plugin).

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!

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

22 Responses to Kotlin 1.2.50 is out!

  1. Louis CAD says:

    Thanks all for this great release!
    I already enjoy the fixes (especially for ReplaceWith in @Deprecated annotation).
    Looking forward trying scratch files and improved scripting support!

  2. RenYuZhuo says:

    Cool! I will update to 1.2.50 immediately!

  3. Juan Saravia says:

    I’m trying kapt.use.worker.api=true but after enabling this the project compilation fails with:
    File ‘/my_app_path/app’ specified for property ‘projectDir’ is not a file.

    If I just change the flag value to false the project compiles successfully again.

    Using gradle 4.4
    kotlin_version = ‘1.2.50’
    classpath ‘com.android.tools.build:gradle:3.1.3’

    Same problem with:
    Using gradle 4.3
    kotlin_version = ‘1.2.50’
    classpath ‘com.android.tools.build:gradle:3.0.1’

    Project used to test this:
    https://github.com/juanchosaravia/KedditBySteps

  4. Andre Artus says:

    Having updated to 1.2.50 the build for my multi-module Android application fails with:

    FAILURE: Build failed with an exception.

    What went wrong:
    A problem was found with the configuration of task ‘:remoteApi:kaptKotlin’.
    > File ‘..\remoteApi’ specified for property ‘projectDir’ is not a file.
    If I revert to 1.2.41 the error disappears.

  5. Pingback: Kotlin 1.2.50 发布,在 Eclipse IDE 插件中获支持 – 技术成就梦想

  6. Norbert Sándor says:

    Updates Kotlin support in the Eclipse IDE plugin

    This is great news!
    One q: is the Javascript target supported in Eclipse?

    Thanks.

  7. Pleased to see Eclipse plugin support updated. I’m using IntelliJ anyway, but lack of current Eclipse support was an impediment to adoption in some environments. I don’t care if Eclipse is the best environment for Kotlin, but I would like it to be a supported environment.

  8. Aung Kyaw Paing says:

    I keep getting unable to delete directory in my multi-module project. here’s the log. idk how to report it on issue tracker.

    app:clean
    :data:clean
    :domain:clean
    :domain:kaptGenerateStubsKotlin
    :app:clean FAILED

    FAILURE: Build failed with an exception.

    What went wrong:
    Execution failed for task ‘:app:clean’.
    > Unable to delete directory: /Users/{my_name}/AndroidStudioProjects/{App_Name}/app/build

  9. Pingback: Kotlin 1.2.40 erschienen: Multi-Plattform-Features & Verbesserung des Compilers - JAXenter

  10. Pingback: Kotlin 1.2.50 发布,在 Eclipse IDE 插件中获支持 – 开源中国社区 – 技术成就梦想

  11. MIsha says:

    How to enable progressive mode in my gradle project?

  12. Robert says:

    The improvements for Eclipse are great, but it would be even greater if you could bring Gradle Kotlin DSL support to Eclipse.
    Is this planned in the near future?

  13. Daniel Ferreira Monteiro Alves says:

    Nice work, guys!

  14. Alexander. Iljushkin says:

    Thank you, guys for the new release.

  15. Lars Hansen says:

    I just updated to 1.2.50, both Idea and Kotlin plug-in. Now I get:

    Build cache is an incubating feature.
    e: java.lang.IllegalStateException: The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:188)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:120)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:433)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:295)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:147)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:95)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:50)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:88)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:454)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:101)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:224)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:36)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:86)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:98)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:545)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:98)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:418)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:927)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
    at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:957)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:926)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:417)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.AbstractMethodError: org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar.registerProjectComponents(Lorg/jetbrains/kotlin/com/intellij/mock/MockProject;Lorg/jetbrains/kotlin/config/CompilerConfiguration;)V
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:186)
    … 41 more

    :compileKotlin FAILED

    FAILURE: Build failed with an exception.

    What went wrong:
    Execution failed for task ‘:compileKotlin’.

    Internal compiler error. See log for more details

    Try:
    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
    Get more help at https://help.gradle.org

    BUILD FAILED in 0s
    1 actionable task: 1 executed
    Internal compiler error. See log for more details
    2:25:35 AM: Task execution finished ‘jar’.

    I use gradle to build. Tried a clean build to no avail.

Leave a Reply

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