Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Widgets and Scala
I've come up against the issue where @ClientWidget does not seem to work for the server-side widget class in Scala. Following some previous but unsolved forum posts led me to checking out .class files and so on. Interestingly all the .class files get generated and on inspection the server-side .class file seems to reference the annotation. But...it still fails at runtime.
Of course as you'd expect reverting back to Java makes everything work. There is a work-around though.
For example, say you're creating a widget called 'MyComponent'. Create the following files:
MyComponent.scala
MyComponentStub.java
VMyComponent.java
The 'MyComponentStub.java' is a dummy class used to get the widget builder to notice the annotation for the client-side class.
@ClientWidget(VMyComponent.class)
public class MyComponentStub extends AbstractComponent {
}
'MyComponent.scala' then simply extends from it and implements the required overrides and custom widget code:
class MyComponent extends MyComponentStub {
// Custom widget overrides and code here
}
I'm mentioning this solution in case anyone has a better workaround that doesn't include generating a dummy class just the get the annotations recognised. The ideal would be ditching the dummy stub class and even having the client-side as Scala but I don't think that's going to happen any time soon. :-)