Fix subclass inclusion in EventBus

This commit is contained in:
Kai S. K. Engelbart 2020-07-04 15:20:47 +02:00
parent 9bf364ef82
commit 6f1ecd21f2

View File

@ -66,7 +66,12 @@ public class EventBus {
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public void dispatch(Event<?> event) { public void dispatch(Event<?> event) {
handlers.keySet().stream().filter(event.getClass()::isAssignableFrom).map(handlers::get).flatMap(List::stream).forEach(h -> h.accept(event)); handlers.keySet()
.stream()
.filter(event.getClass()::equals)
.map(handlers::get)
.flatMap(List::stream)
.forEach(h -> h.accept(event));
} }
/** /**