Reflective access has to be allowed from the Event Bus core package to a
package in the user's project, not the entire module. Thank you @delvh
for noticing this!
The EventHandler class has been converted to an interface, with the
reflection specific part being moved to the new ReflectiveEventHandler
class. Callback event handlers implement the same interface through the
CallbackEventHandler class.
The event handlers are defined in the new handler package, which is not
exported by the eventbus.core module.
The previous method that used double checked synchronization offers
little performance benefits over a plain static initialization.
Reported-by @harkle-the-cake
The test performs a nested event dispatch then cancels the dispatch. If
Both operations are successful, the test is successful.
Currently, the test fails, but should be successful once the nested
dispatch bug is fixed.
When an error is caused during the dispatch of a system event, a warning
has been logged instead instead of rethrowing the error. This has been
fixed.
This enables failing a JUnit test when an exception event handler is
invoked.
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.
When polymorphism or a priority is defined at listener-level and then
identically defined for a specific handler, a warning is issued.
This does not affect redefinitions of default values.
This is the first step for listener level handler properties.
To allow a handler inside a polymorphic listener to be non-polymorphic,
the @Polymorphic annotation now has a boolean value that defaults to
true. In that case, it can be explicitly set to false to override the
listener-level default.
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.