-
Notifications
You must be signed in to change notification settings - Fork 846
Events with subclasses #122
Comments
Producers don't honor class hierarchy like posting does. What would happen
|
I would have expected in that case that both A1 and A2 get delivered to the subcribers of A. In fact I would expect the producers to simply have the same behaviour as when using posting. |
That seems illogical and doesn't scale to many subclasses. If you want a
|
For instance, public class A {
// This code will work
@Subscribe public onSomeEvent(SomeEvent event) { /* my code here */ }
}
// This code won't work because HandlerFinder doesn't find subscribe
public class A1 extends A {}
// This code won't work because HandlerFinder doesn't find subscribe
public class A2 extends A {} I think this is a bug. I don't want to create the same method at 10 different children of A. I think it's very strange. |
@alexustinovsm While the issue you describe doesn't relate to producers, I must agree that it is buggy behavior. The workaround would currently be to explicitly implement
Maybe open a separate ticket for this issue? |
I agree with @sferra, this is a behavior that is surprising. I think this should be at least mentioned in the documentation. |
Hi,
first, thanks for this library. It's great. I have a question, I don't know whether this is intentional or a bug.
My Event hierarchy:
My producer:
My receiver:
With the above code, the subscriber does not receive an initial A event which would be produced by the Activity. If I change the subscribe handler to receive A1 specifically, it works.
I would have expected that my Fragment gets notified of the activity's A1 as an A event.
The text was updated successfully, but these errors were encountered: