-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Can we subscribe an abstract method #342
Comments
As far as I know Java does not support annotation inheritance. So this does not work out of the box. I suppose you could implement the method in your abstract class and then override it in child classes. If you register EventBus within the parent class, it should call the proper child method. Like abstract class Parent {
@Subscribe
public void sayHi(EventMessage em) {
}
} class ChildA{
@Override
public void sayHi(EventMessage em){
System.out.println("Hi I am ChildA");
}
} -ut |
Java does not support annotation inheritance if you need abstract method
|
See two workarounds above. Keeping this open for future reference if we ever want to support this. -ut |
Can we put the annotation
@Subscribe
to an abstract method in the parent class only and don't put it to the implementation methods in the child classes?For example:
Will the EventBus class the function and print the message ?
The text was updated successfully, but these errors were encountered: