Bug 123943 - [1.5][compiler] Invalid ambiguous method error
Summary: [1.5][compiler] Invalid ambiguous method error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-16 05:31 EST by sunrie CLA
Modified: 2006-03-27 10:30 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.