✅ Add listener to parameterized event

i’ve added a custom event which is parameterized:

public class CrudDialogSaveEvent<E extends AbstractEntity> extends ComponentEvent<FormCrudDialog<E, ?>> {

    private final E item;

    public CrudDialogSaveEvent(FormCrudDialog<E, ?> source, boolean fromClient, E item) {
        super(source, fromClient);
        this.item = item;


now the addListener(CrudDialogSaveEvent.class, listener) method fails because of “Incompatible equality constraint: CrudDialogSaveEvent and CrudDialogSaveEvent”. How do I get the method working for parameterized classes?

I think the only solution is to cast the parameter. For example here: network/network/src/main/java/com/vaadin/componentfactory/Network.java at master · vaadin-component-factory/network · GitHub

Alright, thanks!

:white_check_mark: Add listener to parameterized event