我在 parent class 中注册了 object 但在 child class 中订阅了事件,但它仍然有效,为什么?

I register object in parent class but subscribe events in child class, yet it still works why?

所以这正是我希望它工作的方式,但我只是对它工作的原因感到困惑。我在 parent class 中注册了 object,但在 child class 中订阅了事件。

通过在 parent class 中注册 object,EventBus 不会看到类型 parent class(仅 parent class 中的事件 subscribed)?

如果是这样,那么它如何能够看到childclass中订阅的事件呢?

如果有人能澄清这一点,那就太棒了,谢谢!

"No, the child classes inherit the parent's methods. But the type when register(class) is called at runtime will be the type of the child, not the parent (class instanceOf Child). Hence EventBus only discovers the @Subscribed methods in the child class."