> On Jun 28, 2016, at 6:21 PM, Dan Debrunner <[email protected]> wrote:
>
> On 6/28/2016 11:32 AM, Dale LaBossiere wrote:
>> And it seems like the issue is larger than just union().
>
> Any examples?
>
> The only cases I could think of was union and publish.
>
> Would it help if union signature was changed to:
>
> TStream<T> union(TStream<? extends T> other);
It wouldn’t directly/completely. i.e., logically one wants:
TStream<Base> sB = sDerived1.union(sDerived2); // but Derived2 derives
from Base not Derived1
With only the union change, one still has to:
TStream<Base> sB = sDerived1 ??? some cast-ish thing is needed
sB = sB.union(sDerived2);
With some-cast there’s no need to change union, though that might still be
useful.
By “larger” I was thinking of something like someone already wrote
doBaseAnalytics(TStream<Base>).
Shame on them for not enabling future reuse by writing
doBaseAnalytics(TStream<? extends Base>)?
Imagine at the time it was written there weren’t any derived classes / it
wasn’t imagined there would be any.
Some cast-ish thing addresses that case too.
Related, a collection of Base oriented “functions" may have been written.
Those and the methods that use them would have to be adjusted too? Function<?
extends Base, String> baseKeyFn
(maybe that’s related to the publish() you mentioned. e.g.,
KafkaPublisher.publish())
— Dale