Details
Description
public static List<MyClass<String>> codeLensSuppliersById(List<Object> l) { return l.stream() .map(o -> (MyClass<String>) o) // FP: result in "java: incompatible types: cannot infer type-variable(s) R,A,capture#1 of ?,T" .collect(Collectors.toList()); } class MyClass<T> { }
While it is possible to legitimately use method reference for casting to a generic class, we should not suggest it as it is not strictly equivalent, and can result in an incompatible type.
Attachments
Issue Links
- relates to
-
RSPEC-1612 Lambdas should be replaced with method references
- Active
- links to