Bug 59743 - [Compiler] Incorrect diagnosis of ambiguous method when inheriting
Summary: [Compiler] Incorrect diagnosis of ambiguous method when inheriting
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-23 00:06 EDT by Jason Feng CLA
Modified: 2004-05-19 07:31 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Feng CLA 2004-04-23 00:06:47 EDT
Class T1 and T2 is in seperate file. T2 can not compile in Eclipse. 
But this can be done in JBuilder or javac..
public class T1 {
	public void foo(int p1) {
		System.out.println("p1");
	}
	public void foo(short p1) {
		System.out.println("p2");
	}

}

public class T2 extends T1 {
	public void foo(long p1) {
		System.out.println("p3");
	}
	public void testEc() {
		foo((short)1);
	}
}
Comment 1 Philipe Mulet CLA 2004-04-23 08:07:29 EDT
Reproduced in 3.0.

We indeed incorrectly diagnose an ambiguity:
The method foo(long) is ambiguous for the type T2

but it is a fair error to detect in 1.3 compliant mode. Only in 1.4 compliant 
and subsequent mode must we tolerate it.

Kent - the compliance check must here use: options.complianceLevel.
Comment 2 Kent Johnson CLA 2004-04-23 16:52:48 EDT
Fixed.

Added test075 to Compliance_13 & Compliance_14.
Comment 3 Frederic Fusier CLA 2004-05-19 07:31:11 EDT
Verified for 3.0 M9 with build I200405190010.