Feedback Request: Limitations on Data Classes

While M13 is approaching, we are planning a little ahead. This is a request for feedback on some future changes in Kotlin.

We want to deliver Kotlin 1.0 rather sooner than later, and this makes us postpone some design choices we don’t have enough confidence about. Today let’s discuss data classes. Continue reading

Posted in Language design | 47 Comments

Modifiers vs Annotations

This is another heads-up and a call for feedback. We have been discussing options regarding Kotlin’s annotation syntax for quite some time already, rolling out experiments, gathering feedback. As we are finalizing the language now, many pain points that we used to postpone are surfacing. We have to make decisions, and sometimes in a defensive way. In this post I will give an overview of the options we have and the decisions we are provisioning.

Setting the stage: Some introductory definitions

Kotlin (as well as many other languages) has two kinds of metadata:

  • modifiers (such as public, open or abstract), which are built into the language, and
  • annotations (such as @Test or @Inject), which are defined in libraries, also they can have parameters.

Unlike many languages, in Kotlin most modifiers are not proper keywords. They have special meaning only where they are applicable, i.e. in front of a declaration. The compiler won’t mind if you call your variable or class public:

This technique is known as “soft keywords” or “contextual keywords”. Continue reading

Posted in Language design | 44 Comments

Gradle Daemon Support for Faster Compilation

We are currently working on improving compilation times. Today we are happy to invite you to try Kotlin 0.12.1230 making use of the Gradle Daemon. It eliminates startup costs, and your builds run faster. Continue reading

Posted in Tools | 35 Comments

Improving Java Interop: Top-Level Functions and Properties

Kotlin has had top-level functions and properties from day one. They are very convenient in many cases: from basic utilities to extensions for standard APIs.

But Kotlin code is not the only client, and today I’m going to explain how we are planning to improve on the Java interop when it comes to calling top-level functions and properties. Continue reading

Posted in Language design | 18 Comments

Better Annotation Processing: Supporting Stubs in kapt

We announced kapt, an Annotation Processing Tool for Kotlin, some time ago, and discussed its limitations. Now most of the limitations are going away with the updated version of kapt that is available as a 0.1-SNAPSHOT preview. Continue reading

Posted in Android, Libraries, Tools | 18 Comments

Kotlin Evolves: How to Keep Your Code Up

Kotlin is undergoing finalization, and as part of the process we are cleaning up: revising the language and its libraries. The biggest changes have been made in M12, but some more are coming. The point is to perform all the necessary breaking changes before we release 1.0, so that we can keep the language and libraries backwards-compatible after the release.

The trick is both we, ourselves, and you, our users, have quite a bit of code written in Kotlin already, and we don’t want all that code broken hopelessly on each update (some breakages are inevitable, unfortunately, but we are doing our best). The general scheme of making changes in a user-friendly way is “deprecate-release-remove”, for example:

  • in M12 we deprecated quite a few language constructs and library classes/functions,
  • then we released M12, so that whenever you use those to-be-removed language and library features, the compiler issues warnings,
  • in the next milestone we will remove those deprecated things completely, so that the compiler will issue errors instead of warnings.

So, if you have any deprecation warnings in your code, now is just the right time to get rid of them: the next major update will make all that code red, and your build will break.

Getting rid of deprecation warnings

As mentioned above, there are two kinds of deprecation warnings: language deprecations and library deprecations. To get rid of them we provide several options.
Continue reading

Posted in Libraries | 20 Comments

Kotlin Eclipse Plugin 0.2.0

Kotlin Eclipse Plugin 0.2.0

Today we are happy to present a new version of Kotlin plugin for Eclipse. This release includes the following features:

  • Update to Kotlin M12
  • Java to Kotlin converter
  • Navigation to Kotlin sources from Java
  • Kotlin syntax highlighting in Compare View

Continue reading

Posted in Tools | 3 Comments

Fibers and Actors in Kotlin with Quasar

In the previous post we mentioned that the Quasar library now supports Kotlin, providing awesome support for fibers (lightweight threads), Go-like channels, Erlang-like actors, and other asynchronous tools.

Our friends from Parallel Universe have published a blog post that dives into details of using Quasar with Kotlin. Even in the unlikely case that multithreading doesn’t concern you much, Quasar/Kotlin integration is a great example of a “DSL” library written in Kotlin, it uses

  • data classes
  • top-level functions
  • lambdas
  • annotated expressions
  • when-expressions
  • inline functions

to build a natural-looking and efficient API, and the blog post explains it very well.


Posted in Libraries | 2 Comments

Kotlin M12 is out!

We are happy to present Kotlin M12, bringing some rather important changes and new features:

  • New syntax for annotations and enums
  • More convenient semantics of function types
  • Better smart casts
  • kapt for Java Annotation Processing support
  • Multiple IDE features
  • and more…
    Continue reading
Posted in Releases | 47 Comments

kapt: Annotation Processing for Kotlin

This post is largely outdated.
Please check out Better Annotation Processing: Supporting Stubs in kapt

As there have been many requests to support Java Annotation Processing, we are working on it, and first results are ready for preview. This is the call for early feedback. Continue reading

Posted in Android, Tools | 21 Comments