generics events
Opened this issue · 2 comments
marioarrigonineri commented
Hi,
when registering method event listeners for different generics, event dispatcher calls both
eg:
@EventBusListenerMethod
public void a(EditEntity<Bean1> e){
System.out.println("a");
}
@EventBusListenerMethod
public void b(EditEntity<Bean2> e){
System.out.println("b");
}
if i send a new EditEntity < Bean1> () message both methods are called
johannesh2 commented
I was going to report a bug about not able to use payload types with generics e.g. Event<Optional<MyBean>>, but I think this bug is just about the same issue I had. If not, I can report a separate issue
marioarrigonineri commented
I checked the code and I think this is caused by the fact that generics in java are compiletime only, so when dispatcher checks the list of listeners is not able to distinguish between different typed generics. I'm afraid there is no simple solution without knowing how to retrieve the inner bean in general.