Summary: | Problem with compareTo() under JDK 1.5 | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Daniel R Somerfield <dsomerfi> |
Component: | Core | Assignee: | Kent Johnson <kent_johnson> |
Status: | RESOLVED WORKSFORME | QA Contact: | |
Severity: | major | ||
Priority: | P3 | ||
Version: | 3.1 | ||
Target Milestone: | 3.1 M5 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Daniel R Somerfield
2005-01-04 19:56:47 EST
Can you please specify the Eclipse build number ? Also do you have a 1.5 rt.jar library on your classpath, or a 1.4.x one ? This is the M4 build: 200412162000. I am running under 1.4.2, but I am using the 1.5 jre that I setup under "Installed Java Runtime Environments". The 1.5 configuration, my default, is pointing to the 1.5 rt.jar. The Eclipse compiler is right. In 1.5, the java.lang.Character.compareTo(java.lang.Object) method doesn't exist anymore. It is a bridge method. As a bridge method, it cannot be accessed directly. Try to compile this test case: public class X { public static void main(String[] args) { Object o = new Object(); Character c = new Character('c'); System.out.println(c.compareTo(o)); } } using javac 1.5.0_01. It doesn't compile. X.java:5: compareTo(java.lang.Character) in java.lang.Character cannot be applied to (java.lang.Object) System.out.println(c.compareTo(o)); ^ 1 error Only java.lang.Character.compareTo(java.lang.Character) exists in 1.5. In 1.4, both methods existed. This seems to be a case where there is no backward compatibility. Need further investigation. The jdi code will need to be changed to compile under 1.5. |