Bug 94648 - [1.5][compiler] Compiler don't see that my class implements Comparable (only M6)
Summary: [1.5][compiler] Compiler don't see that my class implements Comparable (only M6)
Status: RESOLVED DUPLICATE of bug 90137
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: 3.1 M7   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-11 06:24 EDT by Giannandrea Castaldi CLA
Modified: 2005-05-12 06:12 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giannandrea Castaldi CLA 2005-05-11 06:24:44 EDT
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
Comment 1 Philipe Mulet CLA 2005-05-12 06:12:16 EDT
This was resolved a while ago, try a more recent I-build.

*** This bug has been marked as a duplicate of 90137 ***