[Java:S4276] Don't raise an issue, if receiving method return value of that type

If I call a method, that returns a genericly typed object, that could be specialized and I don’t have control over that method itself or the method is more general and cannot be specialized, I have no choice, but to define the variable the same way.

public interface I
{
    <T> Supplier<T> foo( T sample );
}

I iii = ...;
Supplier<Long> s = iii.foo( 1234L ); // FP

S4276 suggest to use the more specialized type LongSupplier, which is wrong here, because

  1. the method returns the type as that.
  2. the method is more general and correctly uses Supplier.