Community
Participate
Working Groups
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; } }; } }
Note that if removing all occurrences of <U> type parameters, the problem go away.
This is NOT a regression over 3.3.2
Released for 3.5M1 Released for 3.4.1 Added MethodVerifyTest 167
Created attachment 108383 [details] Proposed patch with testcases Includes patch/testcases for bug 236096 and bug 238014
Verified for 3.5M1 using I20080805-1307
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
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
*** Bug 250681 has been marked as a duplicate of this bug. ***