Bug 123943

Summary: [1.5][compiler] Invalid ambiguous method error
Product: [Eclipse Project] JDT Reporter: sunrie <sunrie>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: blocker    
Priority: P3    
Version: 3.1.1   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description sunrie CLA 2006-01-16 05:31:57 EST
public class AmbiguousMethodTest {
	public static void main(String[] args){
		new ExtendDao().testAmbiguous();
	}
}

class SuperObject {

}

class DerivedObject extends SuperObject{
	
}

class BaseDao{
	protected <T extends SuperObject> void test(T t){
		System.out.println("BaseDao test()");
	}
}

class ExtendDao extends BaseDao{
	public void test(SuperObject t){
		System.out.println("ExtendDao test()");
	}
	
	public void testAmbiguous(){
		this.test(new DerivedObject());
	}
}

Eclipse compile has error:
The method test(SuperObject) is ambiguous for the type ExtendDao
but when I use javac to compile, it is correct!
Comment 1 Philipe Mulet CLA 2006-01-16 09:40:25 EST
3.2 still exhibits the same behavior.
Comment 2 David Akehurst CLA 2006-02-20 13:25:12 EST
I thought this was fixed for 3.2M5, but it seems not
Try testing with this code also,
without line marked /*1*/ both 2 and 3 show as errors, with line 1 only
3 shows as an error!

package test;

import java.util.List;
import java.util.Set;

public class Test {

	interface OrderedSet<E> extends List<E>, Set<E> {
/*1*/		boolean add(E o);
	}
	public static void main(String[] args) {
		OrderedSet<String> os = null;
/*2*/		os.add("hello");
		
		OrderedSet<Integer> os2 = null;
/*3*/		os2.add(1);

	}

}
Comment 3 Kent Johnson CLA 2006-03-20 14:56:59 EST
Added AmbiguousMethod test008 and test009
Comment 4 Frederic Fusier CLA 2006-03-27 10:30:27 EST
Verified for 3.2 M6 using warm-up build I20060327-0010.