java:S1612 not equivalent class::cast method reference on generic class

Not sure to understand, if I change the code as suggested, I have an error: Inconvertible types;.

In any way, the exact code sample is not that important, as long as we get the idea.