Marko Lukša commented on Bug WELD-1053

Hendy, the original bug described by this jira is not the same as the one you're facing.

The original bug AFAICT was about having an Event<T> inside MySuperClass<T> and a subclass MySubClass extends MySuperClass<Foo>. The expected behavior would be that firing the event inside MySubClass should be equivalent to firing an event through Event<Foo> (and not Event<T>). This was a bug in weld and was fixed in WELD-1111.

Hendy, what you are describing is something else. You expect that when firing an event through Event<SuperClass> event with event.fire(new SubClass()), observers like @Observes SubClass ssc are called. The proper way to do this is by calling select() on the event object. Like this:

public void observeSuper(@Observes SuperClass superClass) {
    ...
}

public void observeSub(@Observes SubClass subClass) {
    ...
}


private Event<SuperClass> event;

public void fireEvent() {
    event.fire(new SubClass());                           // notifies only observeSuper
    event.select(SubClass.class).fire(new SubClass());    // notifies both observeSuper and observeSub
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira