Kotlin 1.2.70 is Out!

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

  • Significantly improves incremental compilation for Kotlin/JS
  • Marks a number of kotlin-stdlib-common annotations with @OptionalExpectation
  • Contains native binaries built with Excelsior JET for the standalone Kotlin compiler
  • Adds new refactorings, inspections, and intentions to the IntelliJ IDEA plugin
  • 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.3 to 2018.3, as well as with Android Studio 3.1, 3.2 RC, and 3.3 Canary.

Continue reading

Posted in Releases | Tagged | 20 Comments

Kotlin/Native v0.9 is here!

Summer may be almost over, but our Kotlin/Native team has been breaking a sweat to give you the Kotlin/Native v0.9 release… and here it is! Don’t be fooled by the numbering – this is a major (and breaking) release of our compiler toolchain, Gradle plugin, and IDE plugin.

Following are the most important changes in this release:

  • Migration to Kotlin 1.3-M2 (compiler and standard library)
  • Support for unsigned types in Kotlin stdlib
  • Support for unsigned types in C/Objective-C/Swift interop layer
  • Support for a stable version of kotlin.coroutines
  • Reworked concurrency primitives
  • The kotlin.native package

Continue reading

Posted in EAP, iOS, Libraries, Native, Releases, Uncategorized | Tagged | 4 Comments

A major release just around the corner — meet Kotlin 1.3-M2

Moving full steam towards Kotlin 1.3, we’re happy to announce the second milestone release, Kotlin 1.3-M2, which unveils new features and improves the stability of those already announced. Some highlights:

  • Contracts improve smart-casts and other compile-time analyses
  • New Standard Library functions for unsigned types and collections
  • Reflection for coroutines
  • A migration layer to aid migration onto new coroutines being graduated in 1.3
  • Numerous bugfixes related to inline classes

Continue reading

Posted in EAP, Releases | Tagged | 26 Comments

Kotlin/Native 0.8.2 Released

We are happy to announce the 0.8.2 release of Kotlin/Native. In addition to the bug fixes and improvements, we have introduced support for Kotlin/Native Gradle projects directly in CLion!

Continue reading

Posted in Native, Releases, Tools | 13 Comments

Kotlin 1.2.60 is out!

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

  • Adds optional expected annotations to multiplatform projects
  • Allows building multiplatform projects with IntelliJ IDEA
  • Introduces experimental kapt mode aimed to speed up Gradle builds
  • Adds new refactorings, inspections, and intentions to the IntelliJ IDEA plugin
  • 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, as well as with Android Studio 3.1, 3.2 Beta, and 3.3 Canary.

Continue reading

Posted in Releases | Tagged | 30 Comments

See what’s coming in Kotlin 1.3-M1

Today, after a long chain of incremental 1.2.X updates, it’s time to see what’s coming in Kotlin 1.3. We are happy to announce the first preview version of the new major release: Kotlin 1.3-M1.

Kotlin 1.3 brings many advancements including graduation of coroutines, new experimental unsigned arithmetic, and much more. Please read on for the details.

Continue reading

Posted in EAP, Releases | Tagged | 36 Comments

Kotlin/Native v0.8 released

We’re happy to announce the release of Kotlin/Native v0.8! The focus of this release is on:

  • safer concurrent programming
  • extending the stdlib functionality
  • better iOS development support.

Also, numerous bug-fixes and optimizations were implemented in this release.

AppCode and CLion Kotlin/Native plugins were updated to work with v0.8, along with minor performance and usability improvements.

Continue reading

Posted in iOS, Libraries, Native, Releases | 17 Comments

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.

Continue reading

Posted in Releases | Tagged | 27 Comments

Embedding Kotlin Playground

Oh yes, this is a runnable Kotlin snippet embedded right in the blog post.
Note that you can not only run it, but you can also change the code:

Cool, isn’t it? Note that completion works too.

Often you don’t want to show all the code in the snippet, but instead only the most interesting and substantial parts of it. This is possible as well.

You can also add tests:

You can use JavaScript as a target or even draw on a canvas:

Sometimes you don’t need or can’t make a runnable sample. In that case you can apply a highlight-only attribute and get the snippet exactly in the same style, but without the ability to run it.

Embedded Kotlin playground and how it’s done

Historically, thousands of newcomers used try.kotlinlang.org as an interactive way of learning the language. In particular, Kotlin Koans online have been extremely popular. More advanced users use this playground for trying small snippets without opening an IDE, for example before pasting code as an answer on StackOverflow.
Embedded Kotlin Playground works on the same technology, but lets you write and run samples on your webpages. It compiles code on our backend server and then runs either in your browser (if the target platform is JS) or on a server (if the target is set to JVM).

Frontend

Adding an embedded Kotlin playground is as easy as writing a single line in the page header:

Now all the code blocks on the page will be converted to runnable Kotlin snippets. Of course, data-selector is customizable and you can apply the script only to some particular class. There’s also an option to configure a Kotlin playground manually:

There’re also a lot of different installation and customization options. Read more in the documentation.

Backend

The backend part of the playground compiles the code and provides information for completion and highlighting. Generally, you shouldn’t need to bother about the backend and you may stick with our server unless you want to reference custom JVM libraries.

For writing examples that use some external library, for example when you’re creating interactive documentation for your library, you will have to configure and run your instance of the playground backend. It’s very easy to do: you’ll just need to add any dependencies, run two predefined Gradle tasks, then docker-compose up, and voila – the server is running. See these instructions for details.

Where it’s already used

  • We already extensively use this technology for writing Kotlin documentation on the official website. All new bits of documentation are written using runnable samples (see Basic syntax, What’s new in 1.1 and 1.2, Lambdas and Coroutines. For some functions from the standard library, there are live examples as well (see groupBy for example).
  • Kotlin By Example is written with Kotlin-Playground live samples.
  • We’ve also released a plugin for WordPress. It adds a [kotlin] shortcode which allows embedding an interactive Kotlin playground in any post. All the samples on this page are written with the help of this plugin.
    preview
  • On the Kotlin forum, you can use the run-kotlin language in markdown syntax to answer questions, with full correctness guaranteed.
    discuss3

Where this can be used

Kotlin Playground improves the reading experience and increases the expressiveness of code examples. It allows readers to not only see the code but also run it, change it, play with it, and run it again. We encourage all authors to use runnable Kotlin snippets, especially when creating:

  • Learning courses
  • Supplementary materials for slides and books
  • Documentation for libraries and frameworks
  • Examples in blog posts

Later we are going to support scripting in Kotlin Playground as well.

Posted in Playground, Releases, Tools | 17 Comments

Kotlin/Native v0.7 released: smoother interop, frozen objects, optimisations and more.

We’re happy to announce the release of Kotlin/Native v0.7, May Day edition! This release provides even smoother interoperability with Objective-C and Swift, memory management improvements, global program analysis and performance optimisations. Also numerous bugfixes and optimizations were implemented in this release.

AppCode and CLion Kotlin/Native plugins were updated to work with v0.7, along with minor performance and usability improvements.

Continue reading

Posted in Native, Releases | Tagged | 9 Comments