Bug 238817 - [1.5][compiler] Unexpected nameclash reported
Summary: [1.5][compiler] Unexpected nameclash reported
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 250681 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-27 11:58 EDT by Philipe Mulet CLA
Modified: 2008-10-28 15:43 EDT (History)
3 users (show)

See Also:
philippe_mulet: pmc_approved+


Attachments
Proposed patch with testcases (20.52 KB, patch)
2008-07-24 14:44 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2008-06-27 11:58:17 EDT
3.4.0

The following code reports a nameclash, which is not expected.

----------
1. ERROR in X.java (at line 21)
	return new Foo() {
	           ^^^^^
Name clash: The method foo(T, U) of type JFoo<U> has the same erasure as foo(T, U) of type IFoo<U> but does not override it
----------


import java.io.IOException;

interface IFoo<U> {
	<T> T foo(T t, U u) throws IOException;
}
interface JFoo<U> {
	<T> T foo(T t, U u) throws Exception;
}
abstract class Foo implements IFoo<String>, JFoo<String> {}

public class X {
	public static void main(String[] args) {
		Foo f = createFoo();
		try {
			f.foo(null, "");
		} catch(IOException e) {
		}
		System.out.println("done");
	}
	static Foo createFoo() {
		return new Foo() {
			public <T> T foo(T t, String s) {
				return t;
			}
		};
	}
}
Comment 1 Philipe Mulet CLA 2008-06-27 12:03:03 EDT
Note that if removing all occurrences of <U> type parameters, the problem go away.
Comment 2 Philipe Mulet CLA 2008-06-27 12:03:57 EDT
This is NOT a regression over 3.3.2
Comment 3 Kent Johnson CLA 2008-07-24 14:43:46 EDT
Released for 3.5M1

Released for 3.4.1

Added MethodVerifyTest 167
Comment 4 Kent Johnson CLA 2008-07-24 14:44:56 EDT
Created attachment 108383 [details]
Proposed patch with testcases

Includes patch/testcases for bug 236096 and bug 238014
Comment 5 Olivier Thomann CLA 2008-08-06 15:14:48 EDT
Verified for 3.5M1 using I20080805-1307
Comment 6 Jerome Lanneluc CLA 2008-08-29 04:34:04 EDT
Since it was not a regression, it should not have been backported to 3.4.1, especially without a +1.

Anyway, verified for 3.4.1 using M20080827-2000
Comment 7 Philipe Mulet CLA 2008-08-29 04:59:43 EDT
I own the blame here, since I targeted the bug originally for 3.4.1, and did not record the +1 explicitly.

+1 for 3.4.1
Comment 8 Kent Johnson CLA 2008-10-28 15:43:18 EDT
*** Bug 250681 has been marked as a duplicate of this bug. ***