Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant