After further investigation, it appears that this is exactly the desired behavior. The reason the static method expects an "HasHandlers" instead of an "EventBus" is to make it possible to track the origin of the event. Your workaround works, but the real way to solve the problem is to make your origin (the object firing the event) an HasHandlers. This works out of the box if presenters (or presenter widgets) fire the event (as they already implement HasHandlers) otherwise just implement the HasHandlers interface together with its unique method "fireEvent". See CurrentUser in gwt-sample-tab for an example, copied here:
public class CurrentUser implements HasHandlers {
private boolean isAdmin = true;
private final EventBus eventBus;
@Inject
public CurrentUser(EventBus eventBus) {
this.eventBus = eventBus;
}
public void setAdmin(boolean isAdmin) {
this.isAdmin = isAdmin;
CurrentUserChangedEvent.fire(this);
}
public boolean isAdmin() {
return isAdmin;
}
@Override
public void fireEvent(GwtEvent<?> event) {
eventBus.fireEvent(event);
}
}
I'm looking into the @Optional issue.