In my situation, I have a consumer that takes a supplier of ? extends String
and executes some action on it, so the declaration goes like this :
final Consumer<? super Supplier<? extends String>> action = ...
The problem is when I try to execute the action, the compiler doesn't seem to be happy and and blows the following error :
The target type of this expression must be a functional interface
In my case, I have a customer with a name so the following line triggers this error :
action.accept(customer::getName)
My assumption is that ? super Supplier<? extends String>
is not considered anymore a functional interface as it is a capture type.
So, can someone give me a clear explanation on this situation ?