@Contract support in Kotlin


The new (finally public) @Contract annotation in the new IntelliJ EAP looks really good.

I realise that Kotlin has its own private version of this. Is there any chance of unifying the two or getting the regular Contract language implemented for Kotlin anytime soon? I know there’s some sort of UAST abstraction in IntelliJ that allows some inspections to work for both Java and Kotlin simultaneously, is this one of them?



We have no exact timeline for supporting @Contract in Kotlin, but we have it on our agenda. Reverse interop (converting Kotlin-contracts in @Contract-representation) has to be discussed.

It’s a bit unlikely that those two systems will be completely “unified” (at least at foreseeable future), as, ultimately, they have different capabilities and quite different implementations, even though currently they happen to be quite similar.