Community
Participate
Working Groups
Eclipse Java compiler gives an error where Javac does not. Example: public class Test extends SuperTest { public Test() { super(); } static void print(Object obj) { System.out.println("Object:" + obj.toString()); } public static void main(String[] args) { print("Hello world"); } } class SuperTest { SuperTest(){}; static void print(String s) { System.out.println("String: " + s); } } Eclipse compiler gives an error: The method print(Object) is ambigious for the type Test. Javac does not give any error and in the runtime the right method print(String) is invoked. I used j2sdk 1.4.2
Cannot reproduce in R3.0. Which build are you using ?
Would you have toggled Eclipse in 1.3 compliant mode ?
Looks like javac 1.3.1 is not complaining either in this scenario.
Created attachment 13056 [details] Eclipse configuration The attached file contains the Eclipse configuration that I use. Javac does not complain about anything but Eclipse compiler does.
You are indeed compiling in 1.3 mode. In previous version of JDK1.3, our behavior was the right one. Looks like this has changed in later 1.3 releases (without any JCK test revealing this). Note: if trying to match a 1.4 behavior, make sure to switch the Eclipse compiler to 1.4 compliant mode.
Our 1.3 diagnosis should not consider ambiguities amongst static methods. Fixed. Added regression test: LookupTest#test047
Verified for 3.0.1 RC1