Using Kotlin in bindings

I’ve been playing around w/ Kotlin a lot and have been loving it. I’ve got a little server running a Kotlin web-app that I’m using to control a Russound device over a serial port. I’d like to integrate it into OpenHab by extracting a library. But that library is (or will be) written in Kotlin.

Kotlin runs on the JVM - it just needs a runtime library to be bundled with it. Is this something that could live in the OpenHab2 addon repo - or is this too crazy of an idea and I’ll have to host it myself?

2 Likes

Actually thought about it myself, however question is (and I just haven’t tested yet) if kotlin is fully OSGi compliant (I mean the provides JARs / bundles).

There are plenty of bindings that have jars dropped in - is there something that a plain jar can’t do to keep it from being OSGI compliant?

Yep, it is fully OSGI compliant.
https://kotlinlang.org/docs/reference/kotlin-osgi.html

1 Like

As Kotlin has matured a lot through the years, has anyone started to try out using Kotlin for a binding. I would love to do so but don’t know how the community feels about it nor would I know how to achieve this as I guess we probably have to change quite something in the build process.

Any thoughts on that?