Potential for something like Checker Framework in Kotlin?

I often find myself wishing for pluggable types similar to what the Checker Framework provides for Java. Specifically:

  • Tracking quantities
  • Taint tracking
  • Thread-safety related checkers

Obviously, some of the things Checker provides are integrated into IntelliJ Inspector and others are already in the type system, like the nullability checking. But the nice thing about Checker is that it’s an optional layer on top of the language and it provides a place for people to experiment with small, focused type system extensions that can one day inform new versions of the language.

Can I ask what JetBrains’ thoughts on the topic is? I suspect that once a few more obvious features are polished off post 1.0, like typedefs, the list of feature requests people make will drive Kotlin further and further into experimental territory, simply because Kotlin 1.0 already has most of the proven-good ideas integrated. So it seems to me that finding ways to keep a clean core and experimental layers on top would help guide the evolution of the language. If a particular checker were to become popular, then it could be integrated into the compiler by default and the annotations replaced with new modifiers or syntax, for instance.

1 Like

We’ll consider something along these lines at some point, but it’s too early for any real plans here

There are some resolved issues related to Kotlin recognizing Checker Framework annotations, which is IMO the crucial part. Recognize Checker Framework *declaration* annotations by cpovirk · Pull Request #1421 · JetBrains/kotlin · GitHub and https://youtrack.jetbrains.com/issue/KT-21982