vaadin / serverside-elements

Vaadin add-on that makes it easy to use Web Components or any HTML elements from Vaadin Framework
https://vaadin.com/addon/elements-add-on
Apache License 2.0
14 stars 12 forks source link

ClassCastException #20

Closed chvndb closed 3 years ago

chvndb commented 6 years ago

Using Vaadin 8.1 and Spring boot, I get a ClassCastException whenever I try to extend the Element interface, e.g.:

@Tag("div")
public interface Div extends Element {
  public static Div empty() {
    return Elements.create(Div.class);
  }
}

This is the error I get:

java.lang.ClassCastException: Cannot cast org.vaadin.elements.impl.ElementImpl$$EnhancerByCGLIB$$80d7ece3 to *.*.*.Div
        at java.lang.Class.cast(Class.java:3369)
        at org.vaadin.elements.impl.ElementReflectHelper.wrapElement(ElementReflectHelper.java:115)
        at org.vaadin.elements.impl.ElementReflectHelper.wrap(ElementReflectHelper.java:39)
        at org.vaadin.elements.Elements.create(Elements.java:42)
        ...

Any ideas what might be the issue? I also tried with Vaadin 8.0.5, but the error is the same.

chvndb commented 3 years ago

A transitive dependency in Spring boot was the issue, after an update, the issue was gone.