Fix: Direct (unallowed) cast from Consumer<T> to Consumer<Object>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user