Closed akarnokd closed 4 years ago
When taking Subscriber as input, they are in a contravariant position, i.e., subscribe(Subscriber<? super T>) in Reactive Steams. However, one of Microprofile's method would require covariant subscriber:
Subscriber
subscribe(Subscriber<? super T>)
ReactiveStreamsFactory.java#L139
This doesn't work because given a Publisher<Object>, subscribing with a Subscriber<String> will most likely lead to ClassCastExceptions.
Publisher<Object>
Subscriber<String>
ClassCastException
Agreed!
When taking
Subscriber
as input, they are in a contravariant position, i.e.,subscribe(Subscriber<? super T>)
in Reactive Steams. However, one of Microprofile's method would require covariant subscriber:ReactiveStreamsFactory.java#L139
This doesn't work because given a
Publisher<Object>
, subscribing with aSubscriber<String>
will most likely lead toClassCastException
s.