When an exception occurs during the execution of an event handler, it is
caught, wrapped inside an exception event and dispatched on the event
bus.
This applies to any throwable, but is not very useful for errors, as
these are not normally caught. Assertion errors in particular, which are
used in unit tests, should not be caught, as this would cause the test
runner to miss a failed test.
Therefore, errors are now transparently passed through to the caller of
the dispatch method.
An exception event wraps an event that caused an exception inside of an
event handler while being dispatched and is then dispatched to dedicated
handlers.
If an event handler has a non-void return type, a warning is issued as
the event bus cannot use the returned value.
In rare cases this might be justified as the event handler could be
invoked directly.
When encountering an event handler with an invalid signature, the
processor doesn't crash anymore. Also, event parameters that aren't
objects are now reported as errors.
The new @Priority annotation serves the exact same purpose as
@Event(priority = ...), but should be easier to read in complex handler
declarations. It has to be used in conjunction with the @Event
annotation, not instead of it.
The new @Polymorphic annotation serves the exact same purpose as
@Event(includeSubtypes = true), but should be easier to read in complex
handler declarations. It has to be used in conjunction with the @Event
annotation, not instead of it.
event-bus is now a parent project containing the two modules
event-bus-core (the previous event-bus) and event-bus-ap (annotation
processor).
The version of the parent project (and thus that of the modules) has
been bumped to 1.0.0, as this change breaks compatibility with previous
versions due to the different artifact, module and package names.
- Add eventType value to Event
- Move semantic event handler checks to EventHandler
- Use Objects#requireNonNull(T) on public API method parameters
- Update README with a parameter-less event handlers section