Community
Participate
Working Groups
Build Identifier: I20100608-0911 Compiling below class in eclipse fails with error message "Method first(List<Number>) has the same erasure first(List<E>) as another method in type GenericsTest". It compiles and runs without issues using JDK 1.6.0_17 public class GenericsTest { public static Number first(List<Number> args) { return args.get(0); } public static String first(List<String> args) { return args.get(0); } public static void main(String[] args) { System.out.println(first(new ArrayList<Number>(Arrays .asList(new Integer[] { new Integer(1), new Integer(2) })))); System.out.println(first(new ArrayList<String>(Arrays .asList(new String[] { "one", "two" })))); } } Reproducible: Always Steps to Reproduce: 1. Define JDK compliance level as 1.6 in eclipse 2. Create new class using above code.
Srikanth, please review if this is indeed the same issue. The code doesn't compile with javac 1.7 so this is likely the same problem. *** This bug has been marked as a duplicate of bug 317719 ***
Yes, this is a duplicate of bug 317719
Verified.
junit has been added as a part of the fix for bug 317719
Verified for 3.7.1 RC2 using build M20110824-0800
Verified for 3.8 M2