I have an interface A and class B implementing A.
I have a method in A, called doX(Function<? super A, ? extends A> f)
. When I tried to implement it in B, by writing <T extends A> doX(Function<? super B, T> f)
, it doesn't compile. I tried a variant of other possible generics also doesn't work. Basically, my function wants to take in itself, and spits out some other item implementing A. By using PECS, it becomes <? super B>
, however it is wrong. Now I am totally clueless about what I should write.