Community
Participate
Working Groups
In Eclipse 3.3.2, the Eclipse Compiler reports valid methods as ambiguous when the JDK Compliance Level is set to 1.3. In the code below, the compiler will report the error "The method myMethod(Object) is ambiguous for the type ClassA.ClassB". This false abiguity is not reported if the JDK Compliance Level is set to 1.4 or above. Fixing this issue seems important, because compiling for CLDC requires a 1.3 target. This issue will occur for any JavaME development, and will impact the MTJ project as well. public class ClassA { public ClassA() { ClassB b = new ClassB(); b.myMethod((String)null); // This gives a compilation error when target is set to java 1.3 } public void myMethod(Object a) { } public void myMethod(String a) { } public class ClassB extends ClassA { public void myMethod(Object a) { } } } Please note that the problem disappears when ClassB also overrides the method with a String parameter. Thank you. Daniel
I tried compiling the file with '-source 1.2' and '-source 1.3' with JDK 6's javac and it seems to work.
Which JRE are you compiling against ? Is it also 1.3 ?
(In reply to comment #2) > Which JRE are you compiling against ? Is it also 1.3 ? If you were talking to me, then I presume no since I'd assume the JDK 6 javac would just use the JDK 6 libraries. For the record, I'm pretty sure I've seen something like this when writing eRCP code which targets a CDC-1.0/Foundation-1.0 JRE.
Actually I was asking Daniel what version his JRE is. If the JRE version is above 1.3 then that is likely the problem.
(In reply to comment #4) > Actually I was asking Daniel what version his JRE is. > If the JRE version is above 1.3 then that is likely the problem. Hi Kent. The JRE version I'm using is 1.5.0_06. Regards, Daniel
I still think it's worth fixing it, many JavaME developers are using a JRE above 1.3 and targetting a JDK compliance of 1.3, as CLDC requires. Daniel
Actually its the SourceLevel = 1.3 that CLDC needs, NOT the ComplianceLevel. You want to prevent users from using 1.5 Java constructs in their code. The ComplianceLevel should match the JRE version. To duplicate what you've done with javac, you need to run javac 1.3 & point it at the class libraries from 1.5/6.0. Then you'll see the same ambiguous errors.
Verified for 3.5M1 using I20080805-1307