Fix: Direct (unallowed) cast from Consumer<T> to Consumer<Object>

This commit is contained in:
Lars Simon Winzer
2026-03-12 20:12:52 +01:00
parent c301039bfc
commit 74566f99cf
@@ -13,7 +13,7 @@ public class EventBus {
@SuppressWarnings("unchecked") // This cast is safe, because handlers only get passed the type they subscribed to
public <T extends Event> void subscribe(Class<T> eventType, Consumer<T> handler) {
handlers.computeIfAbsent(eventType, k -> new CopyOnWriteArrayList<>())
.add((Consumer<Object>) handler);
.add((Consumer<Object>) (Consumer<?>) handler);
}
public <T extends Event> void publish(T event) {