Community
Participate
Working Groups
Eclipse 3.1M5 indicates the method call in the following program as abiguous where Suns compiler does not. The original Java compiler identifies the equals (int, int) method to be taken... public class Test{ public static void main(String[] args){ equals(new Integer(42), 17); // can not be resolved by eclipse } public static void equals(Object a, Object b) { System.out.println("Object: " + a.equals(b)); } public static void equals(int a, int b) { System.out.println("int: " + (a == b)); } }
*** This bug has been marked as a duplicate of 85491 ***
Actually its not a duplicate of bug 85491 since that one is varargs related.
I tried this case with javac & this is the error I get: 3: reference to equals is ambiguous, both method equals (java.lang.Object,java.lang.Object) in Test and method equals(int,int) in Test match equals(new Integer(42), 17); What version/build # of javac are you using? I'm using javac 1.5.0_01.
(In reply to comment #3) > What version/build # of javac are you using? I'm using javac 1.5.0_01. OK, i changed from version 1.5.0-rc-b63 to 1.5.0_02-b09 and now the compiler produces the same error message as eclipse.