Community
Participate
Working Groups
Hi, using eclipse 3.1 M6 the compiler gives an error if I try to call the method java.util.Collections.sort(List<T>) with a list that contains objects of a type that implements Comparable. It seems that the compiler don't recognize that my type implements Comparable. The error message is the following: "Bound mismatch: The generic method sort(List<T>) of type Collections is not applicable for the arguments (List<MyClass>) since the type MyClass is not a valid substitute for the bounded parameter <T extends Comparable<? super T>>". The problem there is both on windows and linux. With eclipe M4 there is no problem. Here below there is an example with point out where there is the error. import java.util.ArrayList; import java.util.Collections; import java.util.List; public class MyClass implements Comparable { public int compareTo(Object o) { return 0; } public static void main(String[] args) { List<MyClass> myList = new ArrayList<MyClass>(); Collections.sort(myList); <-- Here is the error } } Thanks. Giannandrea
This was resolved a while ago, try a more recent I-build. *** This bug has been marked as a duplicate of 90137 ***