Is it possible to use Kotlin with Vaadin for Java & Javascript

Hi,

I tried a little bit Vaadin and it looks like really interesting. But I didn’t try yet to create custom web components.
Before trying it I would have a little question.

If I well understood, any specific web components has to be written either in Javascript (by using Polymer) or with GWT (javascript from java).

If I am not wrong, that would mean we could use Kotlin instead of Java and GWT because Kotlin is able to replace Java everywhere Java can run and generate Javascript so well.

So my question : Is it possible to use Kotlin with Vaadin for back-end and front-end (web component) thanks to its compliance with Java + Javascript.

For backend development with Kotlin and Vaadin look at this: https://github.com/mvysny/vaadin-kotlin-pwa

It’s very easy to use Kotlin for server-side code, there’s even an integration library called [Karibu-DSL]
(https://github.com/mvysny/karibu-dsl) that is able to kotlinify Vaadin a bit ;).

Using Kotlin for client-side is a bit tricky though. For Vaadin 10+, the problem is that I have yet to see a good tutorial on how to write a (Polymer) Web Component which is compiled from Kotlin. For Vaadin 8, it however is possible to write a “component” as a JavaScript function which attaches to given Element and is compiled from Kotlin sources. Then you can use AbstractJavaScriptComponent and write a tiny JavaScript connector that connects those two pieces together. I have done it and it works nicely; unfortunately I can’t find any good articles on this topic.