Search code examples
guavaevent-bus

Why is Guava issuing the error "missing event handler for an > annotated method"?


I'm getting the following error in one of my classes on the when attempting to unregister it.

java.lang.IllegalArgumentException: missing event handler for an annotated method. Is [DerivedClass] registered?" at com.google.common.eventbus.EventBus.unregister(EventBus.java:227)

The class calling unregister(this) has the public @Subscribe annotated method.


Solution

  • The problem was that the error message misled me to think there was something wrong with the annotations. It was in fact that the class was unregistering itself twice due to some unexpected flow of control.