tornadofx icon indicating copy to clipboard operation
tornadofx copied to clipboard

EventBus.fire does not check for listeners of superclass types

Open comp500 opened this issue 3 years ago • 1 comments

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 avatar Jan 12 '22 03:01 comp500

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.

comp500 avatar Jan 12 '22 03:01 comp500