From 6f1ecd21f263df2d046e5e8ce21ac62bb24f5c34 Mon Sep 17 00:00:00 2001 From: kske Date: Sat, 4 Jul 2020 15:20:47 +0200 Subject: [PATCH] Fix subclass inclusion in EventBus --- src/main/java/envoy/event/EventBus.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/envoy/event/EventBus.java b/src/main/java/envoy/event/EventBus.java index 146fb58..36a98c4 100644 --- a/src/main/java/envoy/event/EventBus.java +++ b/src/main/java/envoy/event/EventBus.java @@ -66,7 +66,12 @@ public class EventBus { * @since Envoy v0.2-alpha */ 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)); } /**