Uploaded image for project: 'Errai'
  1. Errai
  2. ERRAI-1089

ClassCastException from annotation processor checkers

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: 4.1.2.Final
    • Fix Version/s: None
    • Component/s: Build and Common
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      @Dependent
      public class ItemView extends AbstractModelView<Item, NoController> {
       
          interface ViewBinder extends UiBinder<MaterialPanel, ItemView> {}
       
          @Inject
          @UiField(provided = true) @Bound(property = "name")
          MaterialLabel nameLbl;
       
          @Inject
          @UiField(provided = true) @Bound
          MaterialLabel price;
       
          public ItemView() {
              super(GWT.<UiBinder<MaterialPanel, ViewComposite>>create(ViewBinder.class));
          }
      }
      

      @SuppressWarnings("CdiInjectionPointsInspection")
      public abstract class AbstractModelView<M, C extends Controller> extends AbstractView<C> implements
              ModelView<M, C> {
       
          @Inject @AutoBound
          protected DataBinder<M> dataBinder;
       
          public AbstractModelView() {
          }
       
          public AbstractModelView(C controls) {
              super(controls);
          }
       
          public AbstractModelView(Widget widget, C controls) {
              super(widget, controls);
          }
       
          public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder, C controls) {
              super(uiBinder, controls);
          }
       
          public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder, C controls, boolean autoBind) {
              super(uiBinder, controls, autoBind);
          }
       
          public AbstractModelView(Widget widget) {
              super(widget);
          }
       
          public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder) {
              super(uiBinder);
          }
       
          public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder, boolean autoBind) {
              super(uiBinder, autoBind);
          }
       
          @Override
          protected void onPostConstruct() {
              super.onPostConstruct();
       
              dataBinder.addPropertyChangeHandler(event -> ValueChangeEvent.fire(this, getModel()));
          }
       
          /**
           * Set the views managed model object, updating {@link Bound}
           * field properties accordingly.
           *
           * @param model
           *          The instance of a {@link Bindable} type, must not be null.
           * @param initialState
           *          Specifies the origin of the initial state of both model and UI
           *          widget.
           * @param fireChangeEvents
           *          Specifies whether or not {@link PropertyChangeEvent}s should be
           *          fired as a consequence of the model change.
           */
          @Override
          public void setModel(M model, StateSync initialState, boolean fireChangeEvents) {
              dataBinder.setModel(model, initialState, fireChangeEvents);
          }
       
          @Override
          public final M getModel() {
              return dataBinder.getModel();
          }
       
          /**
           * Get the views injected {@link DataBinder}.
           */
          public DataBinder<M> getDataBinder() {
              return dataBinder;
          }
       
          @Override
          public HandlerRegistration addValueChangeHandler(ValueChangeHandler<M> handler) {
              return addHandler(handler, ValueChangeEvent.getType());
          }
      }
      

      This is how I am

      Show
      @Dependent public class ItemView extends AbstractModelView<Item, NoController> {   interface ViewBinder extends UiBinder<MaterialPanel, ItemView> {}   @Inject @UiField (provided = true ) @Bound (property = "name" ) MaterialLabel nameLbl;   @Inject @UiField (provided = true ) @Bound MaterialLabel price;   public ItemView() { super (GWT.<UiBinder<MaterialPanel, ViewComposite>>create(ViewBinder. class )); } } @SuppressWarnings ( "CdiInjectionPointsInspection" ) public abstract class AbstractModelView<M, C extends Controller> extends AbstractView<C> implements ModelView<M, C> {   @Inject @AutoBound protected DataBinder<M> dataBinder;   public AbstractModelView() { }   public AbstractModelView(C controls) { super (controls); }   public AbstractModelView(Widget widget, C controls) { super (widget, controls); }   public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder, C controls) { super (uiBinder, controls); }   public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder, C controls, boolean autoBind) { super (uiBinder, controls, autoBind); }   public AbstractModelView(Widget widget) { super (widget); }   public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder) { super (uiBinder); }   public AbstractModelView(UiBinder<? extends Widget, ViewComposite> uiBinder, boolean autoBind) { super (uiBinder, autoBind); }   @Override protected void onPostConstruct() { super .onPostConstruct();   dataBinder.addPropertyChangeHandler(event -> ValueChangeEvent.fire( this , getModel())); }   /** * Set the views managed model object, updating {@link Bound} * field properties accordingly. * * @param model * The instance of a {@link Bindable} type, must not be null. * @param initialState * Specifies the origin of the initial state of both model and UI * widget. * @param fireChangeEvents * Specifies whether or not {@link PropertyChangeEvent}s should be * fired as a consequence of the model change. */ @Override public void setModel(M model, StateSync initialState, boolean fireChangeEvents) { dataBinder.setModel(model, initialState, fireChangeEvents); }   @Override public final M getModel() { return dataBinder.getModel(); }   /** * Get the views injected {@link DataBinder}. */ public DataBinder<M> getDataBinder() { return dataBinder; }   @Override public HandlerRegistration addValueChangeHandler(ValueChangeHandler<M> handler) { return addHandler(handler, ValueChangeEvent.getType()); } } This is how I am

      Description

      Receiving:
      Error:java: java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeVariableSymbol cannot be cast to javax.lang.model.element.TypeElement

      When I exclude the annotation processor library this error goes away.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mbarkley Max Barkley
                Reporter:
                ben.dol Ben Dol
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: