Qube: Community 9.9
The Java rule S4276 reminds me of using more specialized functional interfaces. Though it runs into a FP, if the generic type is dynamic.
public <T> Supplier<T> getSupp(T fallback) {
return null;
}
public void foo() {
Supplier<String> s1 = getSupp("");
Supplier<Long> s2 = getSupp(1L); // FP
System.out.println(s1.get() + ", " + s2.get());
}
The Supplier’s generic type is dynamic and used with two different types. Hence I cannot use LongSupplier here.