Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326108

Summary: Method has the same erasure as another method in type
Product: [Eclipse Project] JDT Reporter: Carlos Ferreira <carlos.ferreira>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, satyam.kandula
Version: 3.6   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Carlos Ferreira CLA 2010-09-23 21:40:06 EDT
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.
Comment 1 Olivier Thomann CLA 2010-09-23 21:49:26 EDT
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 ***
Comment 2 Srikanth Sankaran CLA 2010-09-24 00:17:20 EDT
Yes, this is a duplicate of bug 317719
Comment 3 Olivier Thomann CLA 2010-09-29 07:58:52 EDT
Verified.
Comment 4 Srikanth Sankaran CLA 2011-08-09 10:13:00 EDT
junit has been added as a part of the fix for bug 317719
Comment 5 Satyam Kandula CLA 2011-08-25 09:08:39 EDT
Verified for 3.7.1 RC2 using build M20110824-0800
Comment 6 Olivier Thomann CLA 2011-09-14 11:32:25 EDT
Verified for 3.8 M2