Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

EventBus.fire does not check for listeners of superclass types #1349

Open
comp500 opened this issue Jan 12, 2022 · 1 comment
Open

EventBus.fire does not check for listeners of superclass types #1349

comp500 opened this issue Jan 12, 2022 · 1 comment

Comments

@comp500
Copy link

comp500 commented Jan 12, 2022

I'm not sure if this is intended behaviour, but EventBus.fire does not check for listeners of superclass types - so if you create an event class and then subclass it, subscribers of the superclass event won't be notified when firing the subclass event.

I think it would be beneficial for extensibility and reusability to support notifying superclass subscribers; it doesn't seem like an intentional design choice to not do so.

@comp500
Copy link
Author

comp500 commented Jan 12, 2022

An alternative to checking the superclasses could be specifying the event type as a reified generic/parameter in EventBus.fire, rather than retrieving the KClass through reflection; this would be easier to implement, though less intuitive than notifying superclass subscribers.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant