Community
Participate
Working Groups
The code shown below raises an error: "The method sort(List<T>) in the type Collections is not applicable for the arguments (List<Test>)" It should raise an error like "The method sort(List<T extends Comparable<? super T>>)..." to give an hint why the code doesn't work. I know that that method's signature is damn difficult to understand and the important part is the generic type definition in front of the signature which is unfortunately omitted right now. import java.util.Collections; import java.util.List; public class Test { List<Test> t; void t1() { Collections.sort(t); } }
This is indeed planned. We have to introduce a specific message in case type inference issued a type which doesn't satisfy the bound check.
Support added. You would now get the (long) message: Bound mismatch: The generic method sort(List<T>) of type Collections is not applicable for the arguments (List<Test>) since the type Test is not a valid substitute for the bounded parameter <T extends Comparable<? super T>> Fixed