Bug 84035 - [1.5][compiler] Ambiguous method call
Summary: [1.5][compiler] Ambiguous method call
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-31 07:52 EST by Joseph Wu CLA
Modified: 2005-06-10 10:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Wu CLA 2005-01-31 07:52:53 EST
1/30 nightly build
these codes compiles with javac, but eclipse not

// IA
public interface IA<E> {
}

// IB
public interface IB<E> extends IA<E> {
}

// A
public class A<E> implements IA<E> {
}

// B
public class B<E> implements IB<E> {
}

// Test
public class Test {

	public static void main(String[] args) {
		A<Integer> x = new A<Integer>();
		B<Integer> y = new B<Integer>();
		print(x);
		print(y); // The method print(B<Integer>) is ambiguous for the 
type Test
	}

	public static <T extends IA<?>> void print(T a) {
		System.out.println("A");
	}

	public static <T extends IB<?>> void print(T a) {
		System.out.println("B");
	}
}
Comment 1 Kent Johnson CLA 2005-02-01 12:34:29 EST
Philippe can you take a look at this one?

I think the tiebreak methods should be able to decide that one is a better 
match than the other, but we end up comparing a Parameterized IA to the Source 
IA & fail.
Comment 2 Philipe Mulet CLA 2005-06-01 16:00:05 EDT
Kent - I cannot reproduce in latest. Your recent changes may have addressed it.
Can you double check, and add a regression test for it ?
Comment 3 Kent Johnson CLA 2005-06-03 11:01:17 EDT
Added MethodVerify test057
Comment 4 Olivier Thomann CLA 2005-06-06 16:50:59 EDT
Verified using N20050606-0010 + JDT/Core HEAD
Comment 5 Maxime Daniel CLA 2005-06-10 06:23:41 EDT
Verified for 3.1 RC2 using build I20050610-0010
Comment 6 Frederic Fusier CLA 2005-06-10 10:23:34 EDT
close