MeteorDevelopment / orbit

Extremely fast event system.
MIT License
48 stars 10 forks source link

Fix `ConsumerListener` generics #6

Closed RacoonDog closed 9 months ago

RacoonDog commented 9 months ago

Since the Class<?> target parameter of ConsumerListener's constructors use wildcard types, it cannot infer the lambda type and doesn't let you access its members without casting.

Before: image

After: image

Note: It was possible to manually specify the parameter type to get around this (new ConsumerListener<Event>(Event.class, Event::method)), however this involves specifying the target type twice so it's not ideal.