View | Details | Raw Unified | Return to bug 317719 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (-2 / +10 lines)
Lines 191-197 Link Here
191
			final MethodBinding thisMethod = current[i];
191
			final MethodBinding thisMethod = current[i];
192
			if (thisMethod.areParameterErasuresEqual(bridge) && thisMethod.returnType.erasure() == bridge.returnType.erasure()) {
192
			if (thisMethod.areParameterErasuresEqual(bridge) && thisMethod.returnType.erasure() == bridge.returnType.erasure()) {
193
				// use inherited method for problem reporting.
193
				// use inherited method for problem reporting.
194
				problemReporter(thisMethod).methodNameClash(thisMethod, inheritedMethod.declaringClass.isRawType() ? inheritedMethod : inheritedMethod.original());
194
				problemReporter(thisMethod).methodNameClash(thisMethod, inheritedMethod.declaringClass.isRawType() ? inheritedMethod : inheritedMethod.original(), ProblemSeverities.Error);
195
				return;	
195
				return;	
196
			}
196
			}
197
		}
197
		}
Lines 720-725 Link Here
720
	MethodBinding original = methodToCheck.original(); // can be the same as inherited
720
	MethodBinding original = methodToCheck.original(); // can be the same as inherited
721
	if (!current.areParameterErasuresEqual(original))
721
	if (!current.areParameterErasuresEqual(original))
722
		return false;
722
		return false;
723
	int severity = ProblemSeverities.Error;
724
	if (this.environment.globalOptions.complianceLevel == ClassFileConstants.JDK1_6) {
725
		// for 1.6 return types also need to be checked
726
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
727
		if (current.returnType.erasure() != original.returnType.erasure())
728
			severity = ProblemSeverities.Warning;
729
	}
723
	if (!treatAsSynthetic) {
730
	if (!treatAsSynthetic) {
724
		// For a user method, see if current class overrides the inherited method. If it does,
731
		// For a user method, see if current class overrides the inherited method. If it does,
725
		// then any grievance we may have ought to be against the current class's method and
732
		// then any grievance we may have ought to be against the current class's method and
Lines 743-749 Link Here
743
	if (!current.areParameterErasuresEqual(original))
750
	if (!current.areParameterErasuresEqual(original))
744
		return false;
751
		return false;
745
	original = inherited.original();  // For error reporting use, inherited.original()
752
	original = inherited.original();  // For error reporting use, inherited.original()
746
	problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original);
753
	problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original, severity);
754
	if (severity == ProblemSeverities.Warning) return false;
747
	return true;
755
	return true;
748
}
756
}
749
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
757
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-6 / +28 lines)
Lines 26-31 Link Here
26
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
26
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
27
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
27
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
28
import org.eclipse.jdt.internal.compiler.impl.Constant;
28
import org.eclipse.jdt.internal.compiler.impl.Constant;
29
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
29
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
30
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
30
import org.eclipse.jdt.internal.compiler.util.Util;
31
import org.eclipse.jdt.internal.compiler.util.Util;
31
32
Lines 1182-1189 Link Here
1182
		}
1183
		}
1183
1184
1184
		// find & report collision cases
1185
		// find & report collision cases
1185
		boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
1186
		boolean complyTo15OrAbove = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
1187
		boolean compliance16 = this.scope.compilerOptions().complianceLevel == ClassFileConstants.JDK1_6;
1188
		
1186
		for (int i = 0, length = this.methods.length; i < length; i++) {
1189
		for (int i = 0, length = this.methods.length; i < length; i++) {
1190
			int severity = ProblemSeverities.Error;
1187
			MethodBinding method = resolvedMethods[i];
1191
			MethodBinding method = resolvedMethods[i];
1188
			if (method == null)
1192
			if (method == null)
1189
				continue;
1193
				continue;
Lines 1196-1206 Link Here
1196
				if (!CharOperation.equals(selector, method2.selector))
1200
				if (!CharOperation.equals(selector, method2.selector))
1197
					break nextSibling; // methods with same selector are contiguous
1201
					break nextSibling; // methods with same selector are contiguous
1198
1202
1199
				if (complyTo15 ? !method.areParameterErasuresEqual(method2) : !method.areParametersEqual(method2))
1203
				if (complyTo15OrAbove) {
1200
					continue nextSibling; // otherwise duplicates / name clash
1204
					if (method.areParameterErasuresEqual(method2)) {
1205
						// we now ignore return types in 1.7 when detecting duplicates, just as we did before 1.5 
1206
						// Only in 1.6, we have to make sure even return types are different
1207
						// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
1208
						if (compliance16 && method.returnType != null && method2.returnType != null) {
1209
							if (method.returnType.erasure() != method2.returnType.erasure()) {
1210
								severity = ProblemSeverities.Warning;
1211
							}
1212
							// else return types also equal. All conditions satisfied
1213
							// to give error in 1.6 compliance as well.
1214
						}
1215
					} else {
1216
						continue nextSibling;
1217
					}
1218
				} else if (!method.areParametersEqual(method2)) {
1219
					// prior to 1.5, parameters identical meant a collision case
1220
					continue nextSibling;
1221
				}
1222
				// otherwise duplicates / name clash
1201
				boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
1223
				boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
1202
				// report duplicate
1224
				// report duplicate
1203
				boolean removeMethod2 = true;
1225
				boolean removeMethod2 = (severity == ProblemSeverities.Error) ? true : false; // do not remove if in 1.6 and just a warning given
1204
				if (methodDecl == null) {
1226
				if (methodDecl == null) {
1205
					methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
1227
					methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
1206
					if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
1228
					if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
Lines 1210-1216 Link Here
1210
							// remove user defined methods & keep the synthetic
1232
							// remove user defined methods & keep the synthetic
1211
							removeMethod = true;
1233
							removeMethod = true;
1212
						} else {
1234
						} else {
1213
							this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
1235
							this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2), severity);
1214
						}
1236
						}
1215
						if (removeMethod) {
1237
						if (removeMethod) {
1216
							removeMethod2 = false;
1238
							removeMethod2 = false;
Lines 1229-1235 Link Here
1229
						this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
1251
						this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
1230
						removeMethod2 = true;
1252
						removeMethod2 = true;
1231
					} else {
1253
					} else {
1232
						this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
1254
						this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2), severity);
1233
					}
1255
					}
1234
					if (removeMethod2) {
1256
					if (removeMethod2) {
1235
						method2Decl.binding = null;
1257
						method2Decl.binding = null;
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-2 / +5 lines)
Lines 1593-1599 Link Here
1593
		nodeSourceStart(local, location),
1593
		nodeSourceStart(local, location),
1594
		nodeSourceEnd(local, location));
1594
		nodeSourceEnd(local, location));
1595
}
1595
}
1596
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, boolean equalParameters) {
1596
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, boolean equalParameters, int severity) {
1597
    MethodBinding method = methodDecl.binding;
1597
    MethodBinding method = methodDecl.binding;
1598
    if (equalParameters) {
1598
    if (equalParameters) {
1599
		this.handle(
1599
		this.handle(
Lines 1606-1611 Link Here
1606
				new String(methodDecl.selector),
1606
				new String(methodDecl.selector),
1607
				new String(method.declaringClass.shortReadableName()),
1607
				new String(method.declaringClass.shortReadableName()),
1608
				typesAsString(method, true)},
1608
				typesAsString(method, true)},
1609
			severity,
1609
			methodDecl.sourceStart,
1610
			methodDecl.sourceStart,
1610
			methodDecl.sourceEnd);
1611
			methodDecl.sourceEnd);
1611
    } else {
1612
    } else {
Lines 1626-1631 Link Here
1626
				new String(method.declaringClass.shortReadableName()),
1627
				new String(method.declaringClass.shortReadableName()),
1627
				typesAsString(method, true),
1628
				typesAsString(method, true),
1628
				typesAsString(method, erasures, true) },
1629
				typesAsString(method, erasures, true) },
1630
			severity,
1629
			methodDecl.sourceStart,
1631
			methodDecl.sourceStart,
1630
			methodDecl.sourceEnd);
1632
			methodDecl.sourceEnd);
1631
    }
1633
    }
Lines 5091-5097 Link Here
5091
		method.sourceEnd);
5093
		method.sourceEnd);
5092
}
5094
}
5093
5095
5094
public void methodNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod) {
5096
public void methodNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod, int severity) {
5095
	this.handle(
5097
	this.handle(
5096
		IProblem.MethodNameClash,
5098
		IProblem.MethodNameClash,
5097
		new String[] {
5099
		new String[] {
Lines 5108-5113 Link Here
5108
			typesAsString(inheritedMethod, true),
5110
			typesAsString(inheritedMethod, true),
5109
			new String(inheritedMethod.declaringClass.shortReadableName()),
5111
			new String(inheritedMethod.declaringClass.shortReadableName()),
5110
		 },
5112
		 },
5113
		severity,
5111
		currentMethod.sourceStart(),
5114
		currentMethod.sourceStart(),
5112
		currentMethod.sourceEnd());
5115
		currentMethod.sourceEnd());
5113
}
5116
}
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-12 / +35 lines)
Lines 22-28 Link Here
22
22
23
public class NegativeTest extends AbstractRegressionTest {
23
public class NegativeTest extends AbstractRegressionTest {
24
static {
24
static {
25
//	TESTS_NUMBERS = new int[] { 275 };
25
//	TESTS_NUMBERS = new int[] { 92 };
26
}
26
}
27
public NegativeTest(String name) {
27
public NegativeTest(String name) {
28
	super(name);
28
	super(name);
Lines 3664-3669 Link Here
3664
	);
3664
	);
3665
}
3665
}
3666
public void test092() {
3666
public void test092() {
3667
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3668
			"----------\n" + 
3669
			"1. WARNING in p\\Toplevel12.java (at line 4)\n" + 
3670
			"	Object local(){\n" + 
3671
			"	       ^^^^^^^\n" + 
3672
			"Duplicate method local() in type Toplevel12\n" + 
3673
			"----------\n" + 
3674
			"2. ERROR in p\\Toplevel12.java (at line 15)\n" + 
3675
			"	return new Package2.Sub();\n" + 
3676
			"	       ^^^^^^^^^^^^^^^^^^\n" + 
3677
			"No enclosing instance of type Package2 is accessible. Must qualify the allocation with an enclosing instance of type Package2 (e.g. x.new A() where x is an instance of Package2).\n" + 
3678
			"----------\n" + 
3679
			"3. WARNING in p\\Toplevel12.java (at line 17)\n" + 
3680
			"	void local(){\n" + 
3681
			"	     ^^^^^^^\n" + 
3682
			"Duplicate method local() in type Toplevel12\n" + 
3683
			"----------\n":
3684
				"----------\n" + 
3685
				"1. ERROR in p\\Toplevel12.java (at line 4)\n" + 
3686
				"	Object local(){\n" + 
3687
				"	       ^^^^^^^\n" + 
3688
				"Duplicate method local() in type Toplevel12\n" + 
3689
				"----------\n" + 
3690
				"2. ERROR in p\\Toplevel12.java (at line 15)\n" + 
3691
				"	return new Package2.Sub();\n" + 
3692
				"	       ^^^^^^^^^^^^^^^^^^\n" + 
3693
				"No enclosing instance of type Package2 is accessible. Must qualify the allocation with an enclosing instance of type Package2 (e.g. x.new A() where x is an instance of Package2).\n" + 
3694
				"----------\n" + 
3695
				"3. ERROR in p\\Toplevel12.java (at line 17)\n" + 
3696
				"	void local(){\n" + 
3697
				"	     ^^^^^^^\n" + 
3698
				"Duplicate method local() in type Toplevel12\n" + 
3699
				"----------\n";
3667
	this.runNegativeTest(
3700
	this.runNegativeTest(
3668
		new String[] {
3701
		new String[] {
3669
			"p/Toplevel12.java",
3702
			"p/Toplevel12.java",
Lines 3697-3713 Link Here
3697
			"  }\n" +
3730
			"  }\n" +
3698
			"}",
3731
			"}",
3699
		},
3732
		},
3700
		"----------\n" +
3733
		expectedCompilerLog
3701
		"1. ERROR in p\\Toplevel12.java (at line 4)\n" +
3702
		"	Object local(){\n" +
3703
		"	       ^^^^^^^\n" +
3704
		"Duplicate method local() in type Toplevel12\n" +
3705
		"----------\n" +
3706
		"2. ERROR in p\\Toplevel12.java (at line 17)\n" +
3707
		"	void local(){\n" +
3708
		"	     ^^^^^^^\n" +
3709
		"Duplicate method local() in type Toplevel12\n" +
3710
		"----------\n"
3711
	);
3734
	);
3712
}
3735
}
3713
public void test093() {
3736
public void test093() {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-213 / +497 lines)
Lines 12-17 Link Here
12
12
13
import java.util.Map;
13
import java.util.Map;
14
14
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
16
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
16
17
17
import junit.framework.*;
18
import junit.framework.*;
Lines 19-25 Link Here
19
public class AmbiguousMethodTest extends AbstractComparableTest {
20
public class AmbiguousMethodTest extends AbstractComparableTest {
20
21
21
	static {
22
	static {
22
//		TESTS_NAMES = new String [] { "test087" };
23
//		TESTS_NAMES = new String [] { "test010a" };
23
	}
24
	}
24
	public AmbiguousMethodTest(String name) {
25
	public AmbiguousMethodTest(String name) {
25
		super(name);
26
		super(name);
Lines 241-246 Link Here
241
	}
242
	}
242
	public void test005() {
243
	public void test005() {
243
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
244
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
245
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
246
				"----------\n" + 
247
				"1. WARNING in X.java (at line 2)\n" + 
248
				"	<S extends A> void foo() { }\n" + 
249
				"	                   ^^^^^\n" + 
250
				"Duplicate method foo() in type X\n" + 
251
				"----------\n" + 
252
				"2. WARNING in X.java (at line 3)\n" + 
253
				"	<N extends B> N foo() { return null; }\n" + 
254
				"	                ^^^^^\n" + 
255
				"Duplicate method foo() in type X\n" + 
256
				"----------\n" + 
257
				"3. ERROR in X.java (at line 5)\n" + 
258
				"	new X().foo();\n" + 
259
				"	        ^^^\n" + 
260
				"The method foo() is ambiguous for the type X\n" + 
261
				"----------\n":
262
					"----------\n" + 
263
					"1. ERROR in X.java (at line 2)\n" + 
264
					"	<S extends A> void foo() { }\n" + 
265
					"	                   ^^^^^\n" + 
266
					"Duplicate method foo() in type X\n" + 
267
					"----------\n" + 
268
					"2. ERROR in X.java (at line 3)\n" + 
269
					"	<N extends B> N foo() { return null; }\n" + 
270
					"	                ^^^^^\n" + 
271
					"Duplicate method foo() in type X\n" + 
272
					"----------\n";
244
		this.runNegativeTest(
273
		this.runNegativeTest(
245
			new String[] {
274
			new String[] {
246
				"X.java",
275
				"X.java",
Lines 254-271 Link Here
254
				"class A {}\n" +
283
				"class A {}\n" +
255
				"class B {}\n"
284
				"class B {}\n"
256
			},
285
			},
257
			"----------\n" + 
286
			expectedCompilerLog);
258
			"1. ERROR in X.java (at line 2)\n" + 
259
			"	<S extends A> void foo() { }\n" + 
260
			"	                   ^^^^^\n" + 
261
			"Duplicate method foo() in type X\n" + 
262
			"----------\n" + 
263
			"2. ERROR in X.java (at line 3)\n" + 
264
			"	<N extends B> N foo() { return null; }\n" + 
265
			"	                ^^^^^\n" + 
266
			"Duplicate method foo() in type X\n" + 
267
			"----------\n"
268
		);
269
/* javac 7
287
/* javac 7
270
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure
288
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure
271
                 <N extends B> N foo() { return null; }
289
                 <N extends B> N foo() { return null; }
Lines 278-300 Link Here
278
	}
296
	}
279
	public void test006() {
297
	public void test006() {
280
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
298
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
281
		this.runNegativeTest(
299
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
282
			new String[] {
300
		"----------\n" + 
283
				"X.java",
301
		"1. ERROR in X.java (at line 3)\n" + 
284
				"public class X<T> {\n" +
302
		"	new Y<Object>().foo(\"X\");\n" + 
285
				"   void test() {\n" +
303
		"	                ^^^\n" + 
286
				"   	new Y<Object>().foo(\"X\");\n" +
304
		"The method foo(Object) is ambiguous for the type Y<Object>\n" + 
287
				"   	new Y<Object>().foo2(\"X\");\n" +
305
		"----------\n" + 
288
				"   }\n" +
306
		"2. ERROR in X.java (at line 4)\n" + 
289
				"	<U1> U1 foo(U1 t) {return null;}\n" +
307
		"	new Y<Object>().foo2(\"X\");\n" + 
290
				"	<U2> U2 foo2(U2 t) {return null;}\n" +
308
		"	                ^^^^\n" + 
291
				"}\n" +
309
		"The method foo2(Object) is ambiguous for the type Y<Object>\n" + 
292
				"class Y<T2> extends X<T2> {\n" +
310
		"----------\n" + 
293
				"	void foo(T2 t) {}\n" +
311
		"3. WARNING in X.java (at line 10)\n" + 
294
				"	<U3> void foo2(T2 t) {}\n" +
312
		"	void foo(T2 t) {}\n" + 
295
				"}\n"
313
		"	     ^^^^^^^^^\n" + 
296
			},
314
		"Name clash: The method foo(T2) of type Y<T2> has the same erasure as foo(U1) of type X<T> but does not override it\n" + 
297
			"----------\n" +
315
		"----------\n" + 
316
		"4. WARNING in X.java (at line 11)\n" + 
317
		"	<U3> void foo2(T2 t) {}\n" + 
318
		"	          ^^^^^^^^^^\n" + 
319
		"Name clash: The method foo2(T2) of type Y<T2> has the same erasure as foo2(U2) of type X<T> but does not override it\n" + 
320
		"----------\n":
321
			"----------\n" + 
298
			"1. ERROR in X.java (at line 3)\n" + 
322
			"1. ERROR in X.java (at line 3)\n" + 
299
			"	new Y<Object>().foo(\"X\");\n" + 
323
			"	new Y<Object>().foo(\"X\");\n" + 
300
			"	                ^^^\n" + 
324
			"	                ^^^\n" + 
Lines 314-320 Link Here
314
			"	<U3> void foo2(T2 t) {}\n" + 
338
			"	<U3> void foo2(T2 t) {}\n" + 
315
			"	          ^^^^^^^^^^\n" + 
339
			"	          ^^^^^^^^^^\n" + 
316
			"Name clash: The method foo2(T2) of type Y<T2> has the same erasure as foo2(U2) of type X<T> but does not override it\n" + 
340
			"Name clash: The method foo2(T2) of type Y<T2> has the same erasure as foo2(U2) of type X<T> but does not override it\n" + 
317
			"----------\n"
341
			"----------\n";
342
		this.runNegativeTest(
343
			new String[] {
344
				"X.java",
345
				"public class X<T> {\n" +
346
				"   void test() {\n" +
347
				"   	new Y<Object>().foo(\"X\");\n" +
348
				"   	new Y<Object>().foo2(\"X\");\n" +
349
				"   }\n" +
350
				"	<U1> U1 foo(U1 t) {return null;}\n" +
351
				"	<U2> U2 foo2(U2 t) {return null;}\n" +
352
				"}\n" +
353
				"class Y<T2> extends X<T2> {\n" +
354
				"	void foo(T2 t) {}\n" +
355
				"	<U3> void foo2(T2 t) {}\n" +
356
				"}\n"
357
			},
358
			expectedCompilerLog
318
		);
359
		);
319
/* javac 7
360
/* javac 7
320
X.java:3: reference to foo is ambiguous, both method <U1>foo(U1) in X and method
361
X.java:3: reference to foo is ambiguous, both method <U1>foo(U1) in X and method
Lines 541-546 Link Here
541
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090
582
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090
542
	public void test011a() {
583
	public void test011a() {
543
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
584
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
585
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
586
		"----------\n" + 
587
		"1. WARNING in Combined.java (at line 2)\n" + 
588
		"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
589
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
590
		"Method pickOne(T) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
591
		"----------\n" + 
592
		"2. WARNING in Combined.java (at line 3)\n" + 
593
		"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
594
		"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
595
		"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
596
		"----------\n":
597
			"----------\n" + 
598
			"1. ERROR in Combined.java (at line 2)\n" + 
599
			"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
600
			"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
601
			"Method pickOne(T) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
602
			"----------\n" + 
603
			"2. ERROR in Combined.java (at line 3)\n" + 
604
			"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
605
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
606
			"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
607
			"----------\n";
544
		this.runNegativeTest(
608
		this.runNegativeTest(
545
			new String[] {
609
			new String[] {
546
				"Combined.java",
610
				"Combined.java",
Lines 555-571 Link Here
555
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
619
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
556
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
620
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
557
			},
621
			},
558
			"----------\n" + 
622
			expectedCompilerLog
559
			"1. ERROR in Combined.java (at line 2)\n" + 
560
			"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
561
			"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
562
			"Method pickOne(T) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
563
			"----------\n" + 
564
			"2. ERROR in Combined.java (at line 3)\n" + 
565
			"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
566
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
567
			"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
568
			"----------\n"
569
		);
623
		);
570
/* javac 7
624
/* javac 7
571
X.java:3: name clash: <T#1>pickOne(Comparable<T#1>) and <T#2>pickOne(T#2) have the same erasure
625
X.java:3: name clash: <T#1>pickOne(Comparable<T#1>) and <T#2>pickOne(T#2) have the same erasure
Lines 580-596 Link Here
580
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090
634
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090
581
	public void test011b() {
635
	public void test011b() {
582
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
636
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
583
		this.runNegativeTest(
637
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
584
			new String[] {
638
		"----------\n" + 
585
				"Test1.java",
639
		"1. WARNING in Test1.java (at line 2)\n" + 
586
				"public class Test1<AA, BB> {\n" +
640
		"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
587
				"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" +
641
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
588
				"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" +
642
		"Method pickOne(T) has the same erasure pickOne(Comparable<T>) as another method in type Test1<AA,BB>\n" + 
589
				"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" +
643
		"----------\n" + 
590
				"}\n" +
644
		"2. WARNING in Test1.java (at line 3)\n" + 
591
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
645
		"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
592
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
646
		"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
593
			},
647
		"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Test1<AA,BB>\n" + 
648
		"----------\n" + 
649
		"3. WARNING in Test1.java (at line 4)\n" + 
650
		"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
651
		"	                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
652
		"Type safety: Unchecked invocation pickOne(Comparable) of the generic method pickOne(T) of type Test1<Integer,Integer>\n" + 
653
		"----------\n" + 
654
		"4. WARNING in Test1.java (at line 4)\n" + 
655
		"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
656
		"	                                                                  ^^^^^^^^^^\n" + 
657
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
658
		"----------\n":
594
			"----------\n" + 
659
			"----------\n" + 
595
			"1. ERROR in Test1.java (at line 2)\n" + 
660
			"1. ERROR in Test1.java (at line 2)\n" + 
596
			"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
661
			"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
Lines 611-617 Link Here
611
			"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
676
			"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
612
			"	                                                                  ^^^^^^^^^^\n" + 
677
			"	                                                                  ^^^^^^^^^^\n" + 
613
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
678
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
614
			"----------\n"
679
			"----------\n";
680
		this.runNegativeTest(
681
			new String[] {
682
				"Test1.java",
683
				"public class Test1<AA, BB> {\n" +
684
				"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" +
685
				"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" +
686
				"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" +
687
				"}\n" +
688
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
689
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
690
			},
691
			expectedCompilerLog
615
		);
692
		);
616
/* javac 7
693
/* javac 7
617
X.java:3: name clash: <T#1>pickOne(Comparable<T#1>) and <T#2>pickOne(T#2) have the same erasure
694
X.java:3: name clash: <T#1>pickOne(Comparable<T#1>) and <T#2>pickOne(T#2) have the same erasure
Lines 1570-1597 Link Here
1570
	// variant: having both methods in the same class should not change anything
1647
	// variant: having both methods in the same class should not change anything
1571
	public void test021() {
1648
	public void test021() {
1572
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1649
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1573
		this.runNegativeTest(
1650
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
1574
			new String[] {
1651
		"----------\n" + 
1575
				"Y.java",
1652
		"1. WARNING in Y.java (at line 3)\n" + 
1576
				"class X<T extends Object> {\n" +
1653
		"	public class Y<V extends String> extends X<V> {\n" + 
1577
				"}\n" +
1654
		"	                         ^^^^^^\n" + 
1578
				"public class Y<V extends String> extends X<V> {\n" +
1655
		"The type parameter V should not be bounded by the final type String. Final types cannot be further extended\n" + 
1579
				"  public static <W extends String> Y<W> make(Class<W> clazz) {\n" +
1656
		"----------\n" + 
1580
				"    System.out.print(true);\n" +
1657
		"2. WARNING in Y.java (at line 4)\n" + 
1581
				"    return new Y<W>();\n" +
1658
		"	public static <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1582
				"  }\n" +
1659
		"	                         ^^^^^^\n" + 
1583
				"  public static <U extends Object> X<U> make(Class<U> clazz) {\n" +
1660
		"The type parameter W should not be bounded by the final type String. Final types cannot be further extended\n" + 
1584
				"    System.out.print(false);\n" +
1661
		"----------\n" + 
1585
				"    return new X<U>();\n" +
1662
		"3. WARNING in Y.java (at line 4)\n" + 
1586
				"  }\n" +
1663
		"	public static <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1587
				"  public static void main(String[] args) throws Exception {\n" +
1664
		"	                                      ^^^^^^^^^^^^^^^^^^^^\n" + 
1588
				"    Y.make(getClazz());\n" +
1665
		"Method make(Class<W>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1589
				"  }\n" +
1666
		"----------\n" + 
1590
				"  public static Class getClazz() {\n" +
1667
		"4. WARNING in Y.java (at line 8)\n" + 
1591
				"    return String.class;\n" +
1668
		"	public static <U extends Object> X<U> make(Class<U> clazz) {\n" + 
1592
				"  }\n" +
1669
		"	                                      ^^^^^^^^^^^^^^^^^^^^\n" + 
1593
				"}"
1670
		"Method make(Class<U>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1594
			},
1671
		"----------\n" + 
1672
		"5. WARNING in Y.java (at line 13)\n" + 
1673
		"	Y.make(getClazz());\n" + 
1674
		"	^^^^^^^^^^^^^^^^^^\n" + 
1675
		"Type safety: Unchecked invocation make(Class) of the generic method make(Class<W>) of type Y\n" + 
1676
		"----------\n" + 
1677
		"6. WARNING in Y.java (at line 13)\n" + 
1678
		"	Y.make(getClazz());\n" + 
1679
		"	       ^^^^^^^^^^\n" + 
1680
		"Type safety: The expression of type Class needs unchecked conversion to conform to Class<String>\n" + 
1681
		"----------\n" + 
1682
		"7. WARNING in Y.java (at line 15)\n" + 
1683
		"	public static Class getClazz() {\n" + 
1684
		"	              ^^^^^\n" + 
1685
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1686
		"----------\n":
1595
			"----------\n" + 
1687
			"----------\n" + 
1596
			"1. WARNING in Y.java (at line 3)\n" + 
1688
			"1. WARNING in Y.java (at line 3)\n" + 
1597
			"	public class Y<V extends String> extends X<V> {\n" + 
1689
			"	public class Y<V extends String> extends X<V> {\n" + 
Lines 1627-1633 Link Here
1627
			"	public static Class getClazz() {\n" + 
1719
			"	public static Class getClazz() {\n" + 
1628
			"	              ^^^^^\n" + 
1720
			"	              ^^^^^\n" + 
1629
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1721
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1630
			"----------\n"
1722
			"----------\n";
1723
		this.runNegativeTest(
1724
			new String[] {
1725
				"Y.java",
1726
				"class X<T extends Object> {\n" +
1727
				"}\n" +
1728
				"public class Y<V extends String> extends X<V> {\n" +
1729
				"  public static <W extends String> Y<W> make(Class<W> clazz) {\n" +
1730
				"    System.out.print(true);\n" +
1731
				"    return new Y<W>();\n" +
1732
				"  }\n" +
1733
				"  public static <U extends Object> X<U> make(Class<U> clazz) {\n" +
1734
				"    System.out.print(false);\n" +
1735
				"    return new X<U>();\n" +
1736
				"  }\n" +
1737
				"  public static void main(String[] args) throws Exception {\n" +
1738
				"    Y.make(getClazz());\n" +
1739
				"  }\n" +
1740
				"  public static Class getClazz() {\n" +
1741
				"    return String.class;\n" +
1742
				"  }\n" +
1743
				"}"
1744
			},
1745
			expectedCompilerLog
1631
		);
1746
		);
1632
/* javac 7
1747
/* javac 7
1633
X.java:8: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
1748
X.java:8: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
Lines 1659-1687 Link Here
1659
	// variant: using instances triggers raw methods, which are ambiguous
1774
	// variant: using instances triggers raw methods, which are ambiguous
1660
	public void test022() {
1775
	public void test022() {
1661
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1776
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1662
		this.runNegativeTest(
1777
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
1663
			new String[] {
1778
		"----------\n" + 
1664
				"X.java",
1779
		"1. WARNING in X.java (at line 3)\n" + 
1665
				"public class X<T extends Object> {\n" +
1780
		"	class Y<V extends String> extends X<V> {\n" + 
1666
				"}\n" +
1781
		"	                  ^^^^^^\n" + 
1667
				"class Y<V extends String> extends X<V> {\n" +
1782
		"The type parameter V should not be bounded by the final type String. Final types cannot be further extended\n" + 
1668
				"  public <W extends String> Y<W> make(Class<W> clazz) {\n" +
1783
		"----------\n" + 
1669
				"    return new Y<W>();\n" +
1784
		"2. WARNING in X.java (at line 4)\n" + 
1670
				"  }\n" +
1785
		"	public <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1671
				"  public <U extends Object> X<U> make(Class<U> clazz) {\n" +
1786
		"	                  ^^^^^^\n" + 
1672
				"    return new X<U>();\n" +
1787
		"The type parameter W should not be bounded by the final type String. Final types cannot be further extended\n" + 
1673
				"  }\n" +
1788
		"----------\n" + 
1674
				"  public static void main(String[] args) throws Exception {\n" +
1789
		"3. WARNING in X.java (at line 4)\n" + 
1675
				"    Y y = new Y();\n" +
1790
		"	public <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1676
				"    y.make(String.class);\n" +
1791
		"	                               ^^^^^^^^^^^^^^^^^^^^\n" + 
1677
				"    y.make(getClazz());\n" +
1792
		"Method make(Class<W>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1678
				"    y.make(getClazz().newInstance().getClass());\n" +
1793
		"----------\n" + 
1679
				"  }\n" +
1794
		"4. WARNING in X.java (at line 7)\n" + 
1680
				"  public static Class getClazz() {\n" +
1795
		"	public <U extends Object> X<U> make(Class<U> clazz) {\n" + 
1681
				"    return String.class;\n" +
1796
		"	                               ^^^^^^^^^^^^^^^^^^^^\n" + 
1682
				"  }\n" +
1797
		"Method make(Class<U>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1683
				"}"
1798
		"----------\n" + 
1684
			},
1799
		"5. WARNING in X.java (at line 11)\n" + 
1800
		"	Y y = new Y();\n" + 
1801
		"	^\n" + 
1802
		"Y is a raw type. References to generic type Y<V> should be parameterized\n" + 
1803
		"----------\n" + 
1804
		"6. WARNING in X.java (at line 11)\n" + 
1805
		"	Y y = new Y();\n" + 
1806
		"	          ^\n" + 
1807
		"Y is a raw type. References to generic type Y<V> should be parameterized\n" + 
1808
		"----------\n" + 
1809
		"7. ERROR in X.java (at line 12)\n" + 
1810
		"	y.make(String.class);\n" + 
1811
		"	  ^^^^\n" + 
1812
		"The method make(Class) is ambiguous for the type Y\n" + 
1813
		"----------\n" + 
1814
		"8. ERROR in X.java (at line 13)\n" + 
1815
		"	y.make(getClazz());\n" + 
1816
		"	  ^^^^\n" + 
1817
		"The method make(Class) is ambiguous for the type Y\n" + 
1818
		"----------\n" + 
1819
		"9. ERROR in X.java (at line 14)\n" + 
1820
		"	y.make(getClazz().newInstance().getClass());\n" + 
1821
		"	  ^^^^\n" + 
1822
		"The method make(Class) is ambiguous for the type Y\n" + 
1823
		"----------\n" + 
1824
		"10. WARNING in X.java (at line 16)\n" + 
1825
		"	public static Class getClazz() {\n" + 
1826
		"	              ^^^^^\n" + 
1827
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1828
		"----------\n":
1685
			"----------\n" + 
1829
			"----------\n" + 
1686
			"1. WARNING in X.java (at line 3)\n" + 
1830
			"1. WARNING in X.java (at line 3)\n" + 
1687
			"	class Y<V extends String> extends X<V> {\n" + 
1831
			"	class Y<V extends String> extends X<V> {\n" + 
Lines 1732-1738 Link Here
1732
			"	public static Class getClazz() {\n" + 
1876
			"	public static Class getClazz() {\n" + 
1733
			"	              ^^^^^\n" + 
1877
			"	              ^^^^^\n" + 
1734
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1878
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1735
			"----------\n"
1879
			"----------\n";
1880
		this.runNegativeTest(
1881
			new String[] {
1882
				"X.java",
1883
				"public class X<T extends Object> {\n" +
1884
				"}\n" +
1885
				"class Y<V extends String> extends X<V> {\n" +
1886
				"  public <W extends String> Y<W> make(Class<W> clazz) {\n" +
1887
				"    return new Y<W>();\n" +
1888
				"  }\n" +
1889
				"  public <U extends Object> X<U> make(Class<U> clazz) {\n" +
1890
				"    return new X<U>();\n" +
1891
				"  }\n" +
1892
				"  public static void main(String[] args) throws Exception {\n" +
1893
				"    Y y = new Y();\n" +
1894
				"    y.make(String.class);\n" +
1895
				"    y.make(getClazz());\n" +
1896
				"    y.make(getClazz().newInstance().getClass());\n" +
1897
				"  }\n" +
1898
				"  public static Class getClazz() {\n" +
1899
				"    return String.class;\n" +
1900
				"  }\n" +
1901
				"}"
1902
			},
1903
			expectedCompilerLog
1736
		);
1904
		);
1737
/* javac 7
1905
/* javac 7
1738
X.java:7: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
1906
X.java:7: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
Lines 1884-1889 Link Here
1884
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162026
2052
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162026
1885
// variant
2053
// variant
1886
public void test027() {
2054
public void test027() {
2055
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
2056
			"----------\n" + 
2057
			"1. WARNING in J.java (at line 2)\n" + 
2058
			"	<T extends Number> T foo(final Number p);\n" + 
2059
			"	                     ^^^^^^^^^^^^^^^^^^^\n" + 
2060
			"Duplicate method foo(Number) in type J\n" + 
2061
			"----------\n" + 
2062
			"2. WARNING in J.java (at line 3)\n" + 
2063
			"	Float foo(final Number p);\n" + 
2064
			"	      ^^^^^^^^^^^^^^^^^^^\n" + 
2065
			"Duplicate method foo(Number) in type J\n" + 
2066
			"----------\n":
2067
				"----------\n" +
2068
				"1. ERROR in J.java (at line 2)\n" +
2069
				"	<T extends Number> T foo(final Number p);\n" +
2070
				"	                     ^^^^^^^^^^^^^^^^^^^\n" +
2071
				"Duplicate method foo(Number) in type J\n" +
2072
				"----------\n" +
2073
				"2. ERROR in J.java (at line 3)\n" +
2074
				"	Float foo(final Number p);\n" +
2075
				"	      ^^^^^^^^^^^^^^^^^^^\n" +
2076
				"Duplicate method foo(Number) in type J\n" +
2077
				"----------\n";
1887
	this.runNegativeTest(
2078
	this.runNegativeTest(
1888
		new String[] {
2079
		new String[] {
1889
			"J.java",
2080
			"J.java",
Lines 1892-1908 Link Here
1892
			"  Float foo(final Number p);\n" +
2083
			"  Float foo(final Number p);\n" +
1893
			"}",
2084
			"}",
1894
		},
2085
		},
1895
		"----------\n" +
2086
		expectedCompilerLog);
1896
		"1. ERROR in J.java (at line 2)\n" +
1897
		"	<T extends Number> T foo(final Number p);\n" +
1898
		"	                     ^^^^^^^^^^^^^^^^^^^\n" +
1899
		"Duplicate method foo(Number) in type J\n" +
1900
		"----------\n" +
1901
		"2. ERROR in J.java (at line 3)\n" +
1902
		"	Float foo(final Number p);\n" +
1903
		"	      ^^^^^^^^^^^^^^^^^^^\n" +
1904
		"Duplicate method foo(Number) in type J\n" +
1905
		"----------\n");
1906
}
2087
}
1907
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162065
2088
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162065
1908
public void test028() {
2089
public void test028() {
Lines 3274-3279 Link Here
3274
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=268837
3455
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=268837
3275
// See that this test case exhibits the bug 345947
3456
// See that this test case exhibits the bug 345947
3276
public void test076() {
3457
public void test076() {
3458
	String output = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3459
			"----------\n" + 
3460
			"1. WARNING in X.java (at line 8)\n" + 
3461
			"	<U> J<String> b();\n" + 
3462
			"	              ^^^\n" + 
3463
			"Name clash: The method b() of type J<E> has the same erasure as b() of type I<E> but does not override it\n" + 
3464
			"----------\n" + 
3465
			"2. ERROR in X.java (at line 15)\n" + 
3466
			"	J<Integer> b = ints.a();\n" + 
3467
			"	               ^^^^^^^^\n" + 
3468
			"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3469
			"----------\n" + 
3470
			"3. ERROR in X.java (at line 16)\n" + 
3471
			"	J<Object> c = ints.a();\n" + 
3472
			"	              ^^^^^^^^\n" + 
3473
			"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3474
			"----------\n" + 
3475
			"4. WARNING in X.java (at line 17)\n" + 
3476
			"	J d = ints.a();\n" + 
3477
			"	^\n" + 
3478
			"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3479
			"----------\n" + 
3480
			"5. ERROR in X.java (at line 19)\n" + 
3481
			"	I<Integer> f = ints.a();\n" + 
3482
			"	               ^^^^^^^^\n" + 
3483
			"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3484
			"----------\n" + 
3485
			"6. ERROR in X.java (at line 20)\n" + 
3486
			"	I<Object> g = ints.a();\n" + 
3487
			"	              ^^^^^^^^\n" + 
3488
			"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3489
			"----------\n" + 
3490
			"7. WARNING in X.java (at line 21)\n" + 
3491
			"	I h = ints.a();\n" + 
3492
			"	^\n" + 
3493
			"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3494
			"----------\n" + 
3495
			"8. ERROR in X.java (at line 24)\n" + 
3496
			"	ints.b();\n" + 
3497
			"	     ^\n" + 
3498
			"The method b() is ambiguous for the type J<Integer>\n" + 
3499
			"----------\n" + 
3500
			"9. ERROR in X.java (at line 25)\n" + 
3501
			"	J<String> a = ints.b();\n" + 
3502
			"	                   ^\n" + 
3503
			"The method b() is ambiguous for the type J<Integer>\n" + 
3504
			"----------\n" + 
3505
			"10. ERROR in X.java (at line 26)\n" + 
3506
			"	J<Integer> b = ints.b();\n" + 
3507
			"	                    ^\n" + 
3508
			"The method b() is ambiguous for the type J<Integer>\n" + 
3509
			"----------\n" + 
3510
			"11. ERROR in X.java (at line 27)\n" + 
3511
			"	J<Object> c = ints.b();\n" + 
3512
			"	                   ^\n" + 
3513
			"The method b() is ambiguous for the type J<Integer>\n" + 
3514
			"----------\n" + 
3515
			"12. WARNING in X.java (at line 28)\n" + 
3516
			"	J d = ints.b();\n" + 
3517
			"	^\n" + 
3518
			"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3519
			"----------\n" + 
3520
			"13. ERROR in X.java (at line 28)\n" + 
3521
			"	J d = ints.b();\n" + 
3522
			"	           ^\n" + 
3523
			"The method b() is ambiguous for the type J<Integer>\n" + 
3524
			"----------\n" + 
3525
			"14. ERROR in X.java (at line 29)\n" + 
3526
			"	I<String> e = ints.b();\n" + 
3527
			"	                   ^\n" + 
3528
			"The method b() is ambiguous for the type J<Integer>\n" + 
3529
			"----------\n" + 
3530
			"15. ERROR in X.java (at line 30)\n" + 
3531
			"	I<Integer> f = ints.b();\n" + 
3532
			"	                    ^\n" + 
3533
			"The method b() is ambiguous for the type J<Integer>\n" + 
3534
			"----------\n" + 
3535
			"16. ERROR in X.java (at line 31)\n" + 
3536
			"	I<Object> g = ints.b();\n" + 
3537
			"	                   ^\n" + 
3538
			"The method b() is ambiguous for the type J<Integer>\n" + 
3539
			"----------\n" + 
3540
			"17. WARNING in X.java (at line 32)\n" + 
3541
			"	I h = ints.b();\n" + 
3542
			"	^\n" + 
3543
			"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3544
			"----------\n" + 
3545
			"18. ERROR in X.java (at line 32)\n" + 
3546
			"	I h = ints.b();\n" + 
3547
			"	           ^\n" + 
3548
			"The method b() is ambiguous for the type J<Integer>\n" + 
3549
			"----------\n" + 
3550
			"19. WARNING in X.java (at line 39)\n" + 
3551
			"	J d = ints.c();\n" + 
3552
			"	^\n" + 
3553
			"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3554
			"----------\n" + 
3555
			"20. WARNING in X.java (at line 43)\n" + 
3556
			"	I h = ints.c();\n" + 
3557
			"	^\n" + 
3558
			"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3559
			"----------\n":
3560
				"----------\n" + 
3561
				"1. ERROR in X.java (at line 8)\n" + 
3562
				"	<U> J<String> b();\n" + 
3563
				"	              ^^^\n" + 
3564
				"Name clash: The method b() of type J<E> has the same erasure as b() of type I<E> but does not override it\n" + 
3565
				"----------\n" + 
3566
				"2. ERROR in X.java (at line 15)\n" + 
3567
				"	J<Integer> b = ints.a();\n" + 
3568
				"	               ^^^^^^^^\n" + 
3569
				"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3570
				"----------\n" + 
3571
				"3. ERROR in X.java (at line 16)\n" + 
3572
				"	J<Object> c = ints.a();\n" + 
3573
				"	              ^^^^^^^^\n" + 
3574
				"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3575
				"----------\n" + 
3576
				"4. WARNING in X.java (at line 17)\n" + 
3577
				"	J d = ints.a();\n" + 
3578
				"	^\n" + 
3579
				"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3580
				"----------\n" + 
3581
				"5. ERROR in X.java (at line 19)\n" + 
3582
				"	I<Integer> f = ints.a();\n" + 
3583
				"	               ^^^^^^^^\n" + 
3584
				"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3585
				"----------\n" + 
3586
				"6. ERROR in X.java (at line 20)\n" + 
3587
				"	I<Object> g = ints.a();\n" + 
3588
				"	              ^^^^^^^^\n" + 
3589
				"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3590
				"----------\n" + 
3591
				"7. WARNING in X.java (at line 21)\n" + 
3592
				"	I h = ints.a();\n" + 
3593
				"	^\n" + 
3594
				"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3595
				"----------\n" + 
3596
				"8. ERROR in X.java (at line 24)\n" + 
3597
				"	ints.b();\n" + 
3598
				"	     ^\n" + 
3599
				"The method b() is ambiguous for the type J<Integer>\n" + 
3600
				"----------\n" + 
3601
				"9. ERROR in X.java (at line 25)\n" + 
3602
				"	J<String> a = ints.b();\n" + 
3603
				"	                   ^\n" + 
3604
				"The method b() is ambiguous for the type J<Integer>\n" + 
3605
				"----------\n" + 
3606
				"10. ERROR in X.java (at line 26)\n" + 
3607
				"	J<Integer> b = ints.b();\n" + 
3608
				"	                    ^\n" + 
3609
				"The method b() is ambiguous for the type J<Integer>\n" + 
3610
				"----------\n" + 
3611
				"11. ERROR in X.java (at line 27)\n" + 
3612
				"	J<Object> c = ints.b();\n" + 
3613
				"	                   ^\n" + 
3614
				"The method b() is ambiguous for the type J<Integer>\n" + 
3615
				"----------\n" + 
3616
				"12. WARNING in X.java (at line 28)\n" + 
3617
				"	J d = ints.b();\n" + 
3618
				"	^\n" + 
3619
				"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3620
				"----------\n" + 
3621
				"13. ERROR in X.java (at line 28)\n" + 
3622
				"	J d = ints.b();\n" + 
3623
				"	           ^\n" + 
3624
				"The method b() is ambiguous for the type J<Integer>\n" + 
3625
				"----------\n" + 
3626
				"14. ERROR in X.java (at line 29)\n" + 
3627
				"	I<String> e = ints.b();\n" + 
3628
				"	                   ^\n" + 
3629
				"The method b() is ambiguous for the type J<Integer>\n" + 
3630
				"----------\n" + 
3631
				"15. ERROR in X.java (at line 30)\n" + 
3632
				"	I<Integer> f = ints.b();\n" + 
3633
				"	                    ^\n" + 
3634
				"The method b() is ambiguous for the type J<Integer>\n" + 
3635
				"----------\n" + 
3636
				"16. ERROR in X.java (at line 31)\n" + 
3637
				"	I<Object> g = ints.b();\n" + 
3638
				"	                   ^\n" + 
3639
				"The method b() is ambiguous for the type J<Integer>\n" + 
3640
				"----------\n" + 
3641
				"17. WARNING in X.java (at line 32)\n" + 
3642
				"	I h = ints.b();\n" + 
3643
				"	^\n" + 
3644
				"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3645
				"----------\n" + 
3646
				"18. ERROR in X.java (at line 32)\n" + 
3647
				"	I h = ints.b();\n" + 
3648
				"	           ^\n" + 
3649
				"The method b() is ambiguous for the type J<Integer>\n" + 
3650
				"----------\n" + 
3651
				"19. WARNING in X.java (at line 39)\n" + 
3652
				"	J d = ints.c();\n" + 
3653
				"	^\n" + 
3654
				"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3655
				"----------\n" + 
3656
				"20. WARNING in X.java (at line 43)\n" + 
3657
				"	I h = ints.c();\n" + 
3658
				"	^\n" + 
3659
				"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3660
				"----------\n";
3277
	this.runNegativeTest(
3661
	this.runNegativeTest(
3278
		new String[] {
3662
		new String[] {
3279
			"X.java",
3663
			"X.java",
Lines 3323-3429 Link Here
3323
			"	}\n" +
3707
			"	}\n" +
3324
			"}"
3708
			"}"
3325
		},
3709
		},
3326
		"----------\n" + 
3710
		output
3327
		"1. ERROR in X.java (at line 8)\n" + 
3328
		"	<U> J<String> b();\n" + 
3329
		"	              ^^^\n" + 
3330
		"Name clash: The method b() of type J<E> has the same erasure as b() of type I<E> but does not override it\n" + 
3331
		"----------\n" + 
3332
		"2. ERROR in X.java (at line 15)\n" + 
3333
		"	J<Integer> b = ints.a();\n" + 
3334
		"	               ^^^^^^^^\n" + 
3335
		"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3336
		"----------\n" + 
3337
		"3. ERROR in X.java (at line 16)\n" + 
3338
		"	J<Object> c = ints.a();\n" + 
3339
		"	              ^^^^^^^^\n" + 
3340
		"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3341
		"----------\n" + 
3342
		"4. WARNING in X.java (at line 17)\n" + 
3343
		"	J d = ints.a();\n" + 
3344
		"	^\n" + 
3345
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3346
		"----------\n" + 
3347
		"5. ERROR in X.java (at line 19)\n" + 
3348
		"	I<Integer> f = ints.a();\n" + 
3349
		"	               ^^^^^^^^\n" + 
3350
		"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3351
		"----------\n" + 
3352
		"6. ERROR in X.java (at line 20)\n" + 
3353
		"	I<Object> g = ints.a();\n" + 
3354
		"	              ^^^^^^^^\n" + 
3355
		"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3356
		"----------\n" + 
3357
		"7. WARNING in X.java (at line 21)\n" + 
3358
		"	I h = ints.a();\n" + 
3359
		"	^\n" + 
3360
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3361
		"----------\n" + 
3362
		"8. ERROR in X.java (at line 24)\n" + 
3363
		"	ints.b();\n" + 
3364
		"	     ^\n" + 
3365
		"The method b() is ambiguous for the type J<Integer>\n" + 
3366
		"----------\n" + 
3367
		"9. ERROR in X.java (at line 25)\n" + 
3368
		"	J<String> a = ints.b();\n" + 
3369
		"	                   ^\n" + 
3370
		"The method b() is ambiguous for the type J<Integer>\n" + 
3371
		"----------\n" + 
3372
		"10. ERROR in X.java (at line 26)\n" + 
3373
		"	J<Integer> b = ints.b();\n" + 
3374
		"	                    ^\n" + 
3375
		"The method b() is ambiguous for the type J<Integer>\n" + 
3376
		"----------\n" + 
3377
		"11. ERROR in X.java (at line 27)\n" + 
3378
		"	J<Object> c = ints.b();\n" + 
3379
		"	                   ^\n" + 
3380
		"The method b() is ambiguous for the type J<Integer>\n" + 
3381
		"----------\n" + 
3382
		"12. WARNING in X.java (at line 28)\n" + 
3383
		"	J d = ints.b();\n" + 
3384
		"	^\n" + 
3385
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3386
		"----------\n" + 
3387
		"13. ERROR in X.java (at line 28)\n" + 
3388
		"	J d = ints.b();\n" + 
3389
		"	           ^\n" + 
3390
		"The method b() is ambiguous for the type J<Integer>\n" + 
3391
		"----------\n" + 
3392
		"14. ERROR in X.java (at line 29)\n" + 
3393
		"	I<String> e = ints.b();\n" + 
3394
		"	                   ^\n" + 
3395
		"The method b() is ambiguous for the type J<Integer>\n" + 
3396
		"----------\n" + 
3397
		"15. ERROR in X.java (at line 30)\n" + 
3398
		"	I<Integer> f = ints.b();\n" + 
3399
		"	                    ^\n" + 
3400
		"The method b() is ambiguous for the type J<Integer>\n" + 
3401
		"----------\n" + 
3402
		"16. ERROR in X.java (at line 31)\n" + 
3403
		"	I<Object> g = ints.b();\n" + 
3404
		"	                   ^\n" + 
3405
		"The method b() is ambiguous for the type J<Integer>\n" + 
3406
		"----------\n" + 
3407
		"17. WARNING in X.java (at line 32)\n" + 
3408
		"	I h = ints.b();\n" + 
3409
		"	^\n" + 
3410
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3411
		"----------\n" + 
3412
		"18. ERROR in X.java (at line 32)\n" + 
3413
		"	I h = ints.b();\n" + 
3414
		"	           ^\n" + 
3415
		"The method b() is ambiguous for the type J<Integer>\n" + 
3416
		"----------\n" + 
3417
		"19. WARNING in X.java (at line 39)\n" + 
3418
		"	J d = ints.c();\n" + 
3419
		"	^\n" + 
3420
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3421
		"----------\n" + 
3422
		"20. WARNING in X.java (at line 43)\n" + 
3423
		"	I h = ints.c();\n" + 
3424
		"	^\n" + 
3425
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3426
		"----------\n"
3427
	);
3711
	);
3428
}
3712
}
3429
3713
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-31 / +64 lines)
Lines 310-315 Link Here
310
}
310
}
311
// reject user definition for #values()
311
// reject user definition for #values()
312
public void test008() {
312
public void test008() {
313
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
314
			"----------\n" + 
315
			"1. ERROR in X.java (at line 7)\n" + 
316
			"	void dup() {} \n" + 
317
			"	     ^^^^^\n" + 
318
			"Duplicate method dup() in type X\n" + 
319
			"----------\n" + 
320
			"2. ERROR in X.java (at line 8)\n" + 
321
			"	void values() {} \n" + 
322
			"	     ^^^^^^^^\n" + 
323
			"The enum X already defines the method values() implicitly\n" + 
324
			"----------\n" + 
325
			"3. ERROR in X.java (at line 9)\n" + 
326
			"	void dup() {} \n" + 
327
			"	     ^^^^^\n" + 
328
			"Duplicate method dup() in type X\n" + 
329
			"----------\n" + 
330
			"4. ERROR in X.java (at line 10)\n" + 
331
			"	void values() {} \n" + 
332
			"	     ^^^^^^^^\n" + 
333
			"The enum X already defines the method values() implicitly\n" + 
334
			"----------\n" + 
335
			"5. ERROR in X.java (at line 11)\n" + 
336
			"	Missing dup() {} \n" + 
337
			"	^^^^^^^\n" + 
338
			"Missing cannot be resolved to a type\n" + 
339
			"----------\n" + 
340
			"6. WARNING in X.java (at line 11)\n" + 
341
			"	Missing dup() {} \n" + 
342
			"	        ^^^^^\n" + 
343
			"Duplicate method dup() in type X\n" + 
344
			"----------\n":
345
				"----------\n" +
346
				"1. ERROR in X.java (at line 7)\n" +
347
				"	void dup() {} \n" +
348
				"	     ^^^^^\n" +
349
				"Duplicate method dup() in type X\n" +
350
				"----------\n" +
351
				"2. ERROR in X.java (at line 8)\n" +
352
				"	void values() {} \n" +
353
				"	     ^^^^^^^^\n" +
354
				"The enum X already defines the method values() implicitly\n" +
355
				"----------\n" +
356
				"3. ERROR in X.java (at line 9)\n" +
357
				"	void dup() {} \n" +
358
				"	     ^^^^^\n" +
359
				"Duplicate method dup() in type X\n" +
360
				"----------\n" +
361
				"4. ERROR in X.java (at line 10)\n" +
362
				"	void values() {} \n" +
363
				"	     ^^^^^^^^\n" +
364
				"The enum X already defines the method values() implicitly\n" +
365
				"----------\n" +
366
				"5. ERROR in X.java (at line 11)\n" +
367
				"	Missing dup() {} \n" +
368
				"	^^^^^^^\n" +
369
				"Missing cannot be resolved to a type\n" +
370
				"----------\n" +
371
				"6. ERROR in X.java (at line 11)\n" +
372
				"	Missing dup() {} \n" +
373
				"	        ^^^^^\n" +
374
				"Duplicate method dup() in type X\n" +
375
				"----------\n";
313
	this.runNegativeTest(
376
	this.runNegativeTest(
314
		new String[] {
377
		new String[] {
315
			"X.java",
378
			"X.java",
Lines 332-368 Link Here
332
			"	\n" +
395
			"	\n" +
333
			"}\n"
396
			"}\n"
334
		},
397
		},
335
		"----------\n" +
398
		expectedCompilerLog);
336
		"1. ERROR in X.java (at line 7)\n" +
337
		"	void dup() {} \n" +
338
		"	     ^^^^^\n" +
339
		"Duplicate method dup() in type X\n" +
340
		"----------\n" +
341
		"2. ERROR in X.java (at line 8)\n" +
342
		"	void values() {} \n" +
343
		"	     ^^^^^^^^\n" +
344
		"The enum X already defines the method values() implicitly\n" +
345
		"----------\n" +
346
		"3. ERROR in X.java (at line 9)\n" +
347
		"	void dup() {} \n" +
348
		"	     ^^^^^\n" +
349
		"Duplicate method dup() in type X\n" +
350
		"----------\n" +
351
		"4. ERROR in X.java (at line 10)\n" +
352
		"	void values() {} \n" +
353
		"	     ^^^^^^^^\n" +
354
		"The enum X already defines the method values() implicitly\n" +
355
		"----------\n" +
356
		"5. ERROR in X.java (at line 11)\n" +
357
		"	Missing dup() {} \n" +
358
		"	^^^^^^^\n" +
359
		"Missing cannot be resolved to a type\n" +
360
		"----------\n" +
361
		"6. ERROR in X.java (at line 11)\n" +
362
		"	Missing dup() {} \n" +
363
		"	        ^^^^^\n" +
364
		"Duplicate method dup() in type X\n" +
365
		"----------\n");
366
}
399
}
367
// switch on enum
400
// switch on enum
368
public void test009() {
401
public void test009() {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-159 / +346 lines)
Lines 7301-7306 Link Here
7301
				"}\n"
7301
				"}\n"
7302
			},
7302
			},
7303
			"Added bridge method + Added bridge method");
7303
			"Added bridge method + Added bridge method");
7304
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
7305
				"----------\n" + 
7306
				"1. WARNING in SubTypes.java (at line 5)\n" + 
7307
				"	@Override public X foo() { return new X(); }\n" + 
7308
				"	                   ^^^^^\n" + 
7309
				"Duplicate method foo() in type B\n" + 
7310
				"----------\n" + 
7311
				"2. ERROR in SubTypes.java (at line 5)\n" + 
7312
				"	@Override public X foo() { return new X(); }\n" + 
7313
				"	                   ^^^^^\n" + 
7314
				"Name clash: The method foo() of type B has the same erasure as foo() of type X but does not override it\n" + 
7315
				"----------\n" + 
7316
				"3. ERROR in SubTypes.java (at line 5)\n" + 
7317
				"	@Override public X foo() { return new X(); }\n" + 
7318
				"	                   ^^^^^\n" + 
7319
				"Name clash: The method foo() of type B has the same erasure as foo() of type X but does not override it\n" + 
7320
				"----------\n" + 
7321
				"4. ERROR in SubTypes.java (at line 5)\n" + 
7322
				"	@Override public X foo() { return new X(); }\n" + 
7323
				"	                   ^^^^^\n" + 
7324
				"The method foo() of type B must override or implement a supertype method\n" + 
7325
				"----------\n" + 
7326
				"5. WARNING in SubTypes.java (at line 6)\n" + 
7327
				"	@Override public B foo() { return this; }\n" + 
7328
				"	                   ^^^^^\n" + 
7329
				"Duplicate method foo() in type B\n" + 
7330
				"----------\n" + 
7331
				"6. ERROR in SubTypes.java (at line 9)\n" + 
7332
				"	@Override public X foo() { return new X(); }\n" + 
7333
				"	                 ^\n" + 
7334
				"The return type is incompatible with A.foo()\n" + 
7335
				"----------\n":
7336
					"----------\n" +
7337
					"1. ERROR in SubTypes.java (at line 5)\n" +
7338
					"	@Override public X foo() { return new X(); }\n" +
7339
					"	                   ^^^^^\n" +
7340
					"Duplicate method foo() in type B\n" +
7341
					"----------\n" +
7342
					"2. ERROR in SubTypes.java (at line 6)\n" +
7343
					"	@Override public B foo() { return this; }\n" +
7344
					"	                   ^^^^^\n" +
7345
					"Duplicate method foo() in type B\n" +
7346
					"----------\n" +
7347
					"3. ERROR in SubTypes.java (at line 9)\n" +
7348
					"	@Override public X foo() { return new X(); }\n" +
7349
					"	                 ^\n" +
7350
					"The return type is incompatible with A.foo()\n" +
7351
					"----------\n";
7304
		this.runNegativeTest(
7352
		this.runNegativeTest(
7305
			new String[] {
7353
			new String[] {
7306
				"X.java",
7354
				"X.java",
Lines 7322-7343 Link Here
7322
				"    @Override public X foo() { return new X(); }\n" +
7370
				"    @Override public X foo() { return new X(); }\n" +
7323
				"}\n"
7371
				"}\n"
7324
			},
7372
			},
7325
			"----------\n" +
7373
			expectedCompilerLog);
7326
			"1. ERROR in SubTypes.java (at line 5)\n" +
7327
			"	@Override public X foo() { return new X(); }\n" +
7328
			"	                   ^^^^^\n" +
7329
			"Duplicate method foo() in type B\n" +
7330
			"----------\n" +
7331
			"2. ERROR in SubTypes.java (at line 6)\n" +
7332
			"	@Override public B foo() { return this; }\n" +
7333
			"	                   ^^^^^\n" +
7334
			"Duplicate method foo() in type B\n" +
7335
			"----------\n" +
7336
			"3. ERROR in SubTypes.java (at line 9)\n" +
7337
			"	@Override public X foo() { return new X(); }\n" +
7338
			"	                 ^\n" +
7339
			"The return type is incompatible with A.foo()\n" +
7340
			"----------\n");
7341
	}
7374
	}
7342
	// generic method of raw type
7375
	// generic method of raw type
7343
	public void test0244() {
7376
	public void test0244() {
Lines 17666-17671 Link Here
17666
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87956
17699
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87956
17667
	public void test0561() {
17700
	public void test0561() {
17668
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
17701
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
17702
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
17703
				"----------\n" + 
17704
				"1. WARNING in X.java (at line 2)\n" + 
17705
				"	void foo(A<String> a) {}\n" + 
17706
				"	     ^^^^^^^^^^^^^^^^\n" + 
17707
				"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
17708
				"----------\n" + 
17709
				"2. WARNING in X.java (at line 3)\n" + 
17710
				"	Object foo(A<Integer> a) { return null; }\n" + 
17711
				"	       ^^^^^^^^^^^^^^^^^\n" + 
17712
				"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
17713
				"----------\n":
17714
					"----------\n" + 
17715
					"1. ERROR in X.java (at line 2)\n" + 
17716
					"	void foo(A<String> a) {}\n" + 
17717
					"	     ^^^^^^^^^^^^^^^^\n" + 
17718
					"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
17719
					"----------\n" + 
17720
					"2. ERROR in X.java (at line 3)\n" + 
17721
					"	Object foo(A<Integer> a) { return null; }\n" + 
17722
					"	       ^^^^^^^^^^^^^^^^^\n" + 
17723
					"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
17724
					"----------\n" + 
17725
					"3. ERROR in X.java (at line 4)\n" + 
17726
					"	void test(A<Integer> a) { foo(a); }\n" + 
17727
					"	                          ^^^\n" + 
17728
					"The method foo(A<String>) in the type X is not applicable for the arguments (A<Integer>)\n" + 
17729
					"----------\n";
17669
		this.runNegativeTest(
17730
		this.runNegativeTest(
17670
			new String[] {
17731
			new String[] {
17671
				"X.java",
17732
				"X.java",
Lines 17676-17697 Link Here
17676
				"}\n" +
17737
				"}\n" +
17677
				"class A<T> {}\n",
17738
				"class A<T> {}\n",
17678
			},
17739
			},
17679
			"----------\n" + 
17740
			expectedCompilerLog
17680
			"1. ERROR in X.java (at line 2)\n" + 
17681
			"	void foo(A<String> a) {}\n" + 
17682
			"	     ^^^^^^^^^^^^^^^^\n" + 
17683
			"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
17684
			"----------\n" + 
17685
			"2. ERROR in X.java (at line 3)\n" + 
17686
			"	Object foo(A<Integer> a) { return null; }\n" + 
17687
			"	       ^^^^^^^^^^^^^^^^^\n" + 
17688
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
17689
			"----------\n" + 
17690
			"3. ERROR in X.java (at line 4)\n" + 
17691
			"	void test(A<Integer> a) { foo(a); }\n" + 
17692
			"	                          ^^^\n" + 
17693
			"The method foo(A<String>) in the type X is not applicable for the arguments (A<Integer>)\n" + 
17694
			"----------\n"
17695
		);
17741
		);
17696
/* javac 7
17742
/* javac 7
17697
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure
17743
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure
Lines 17704-17709 Link Here
17704
  found: A<Integer>
17750
  found: A<Integer>
17705
2 errors
17751
2 errors
17706
 */
17752
 */
17753
		String expectedCompilerLog2 = (this.complianceLevel == ClassFileConstants.JDK1_6)?
17754
				"----------\n" + 
17755
				"1. WARNING in X.java (at line 2)\n" + 
17756
				"	Number foo(A<String> a) { return null; }\n" + 
17757
				"	       ^^^^^^^^^^^^^^^^\n" + 
17758
				"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
17759
				"----------\n" + 
17760
				"2. WARNING in X.java (at line 3)\n" + 
17761
				"	Integer foo(A<Integer> a) { return null; }\n" + 
17762
				"	        ^^^^^^^^^^^^^^^^^\n" + 
17763
				"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
17764
				"----------\n":
17765
					"----------\n" + 
17766
					"1. ERROR in X.java (at line 2)\n" + 
17767
					"	Number foo(A<String> a) { return null; }\n" + 
17768
					"	       ^^^^^^^^^^^^^^^^\n" + 
17769
					"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
17770
					"----------\n" + 
17771
					"2. ERROR in X.java (at line 3)\n" + 
17772
					"	Integer foo(A<Integer> a) { return null; }\n" + 
17773
					"	        ^^^^^^^^^^^^^^^^^\n" + 
17774
					"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
17775
					"----------\n" + 
17776
					"3. ERROR in X.java (at line 4)\n" + 
17777
					"	void test(A<Integer> a) { foo(a); }\n" + 
17778
					"	                          ^^^\n" + 
17779
					"The method foo(A<String>) in the type X is not applicable for the arguments (A<Integer>)\n" + 
17780
					"----------\n";
17707
		this.runNegativeTest(
17781
		this.runNegativeTest(
17708
			new String[] {
17782
			new String[] {
17709
				"X.java",
17783
				"X.java",
Lines 17714-17735 Link Here
17714
				"}\n" +
17788
				"}\n" +
17715
				"class A<T> {}\n",
17789
				"class A<T> {}\n",
17716
			},
17790
			},
17717
			"----------\n" + 
17791
			expectedCompilerLog2
17718
			"1. ERROR in X.java (at line 2)\n" + 
17719
			"	Number foo(A<String> a) { return null; }\n" + 
17720
			"	       ^^^^^^^^^^^^^^^^\n" + 
17721
			"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
17722
			"----------\n" + 
17723
			"2. ERROR in X.java (at line 3)\n" + 
17724
			"	Integer foo(A<Integer> a) { return null; }\n" + 
17725
			"	        ^^^^^^^^^^^^^^^^^\n" + 
17726
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
17727
			"----------\n" + 
17728
			"3. ERROR in X.java (at line 4)\n" + 
17729
			"	void test(A<Integer> a) { foo(a); }\n" + 
17730
			"	                          ^^^\n" + 
17731
			"The method foo(A<String>) in the type X is not applicable for the arguments (A<Integer>)\n" + 
17732
			"----------\n"
17733
/* javac 7
17792
/* javac 7
17734
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure
17793
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure
17735
        Integer foo(A<Integer> a) { return null; }
17794
        Integer foo(A<Integer> a) { return null; }
Lines 18051-18056 Link Here
18051
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
18110
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
18052
	public void test0574() {
18111
	public void test0574() {
18053
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
18112
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
18113
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
18114
				"----------\n" + 
18115
				"1. WARNING in X.java (at line 6)\n" + 
18116
				"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
18117
				"	           ^^^^^^^\n" + 
18118
				"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" + 
18119
				"----------\n" + 
18120
				"2. WARNING in X.java (at line 6)\n" + 
18121
				"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
18122
				"	                      ^^^^^^^^^^^^^\n" + 
18123
				"Duplicate method foo(Object) in type X.C2\n" + 
18124
				"----------\n" + 
18125
				"3. WARNING in X.java (at line 7)\n" + 
18126
				"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
18127
				"	           ^^^^^^\n" + 
18128
				"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
18129
				"----------\n" + 
18130
				"4. WARNING in X.java (at line 7)\n" + 
18131
				"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
18132
				"	                     ^^^^^^^^^^^^^\n" + 
18133
				"Duplicate method foo(Object) in type X.C2\n" + 
18134
				"----------\n" + 
18135
				"5. ERROR in X.java (at line 10)\n" + 
18136
				"	new X().new C2().foo((List<String>) null);\n" + 
18137
				"	                 ^^^\n" + 
18138
				"The method foo(Object) is ambiguous for the type X.C2\n" + 
18139
				"----------\n":
18140
					"----------\n" + 
18141
					"1. WARNING in X.java (at line 6)\n" + 
18142
					"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
18143
					"	           ^^^^^^^\n" + 
18144
					"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" + 
18145
					"----------\n" + 
18146
					"2. ERROR in X.java (at line 6)\n" + 
18147
					"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
18148
					"	                      ^^^^^^^^^^^^^\n" + 
18149
					"Duplicate method foo(Object) in type X.C2\n" + 
18150
					"----------\n" + 
18151
					"3. WARNING in X.java (at line 7)\n" + 
18152
					"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
18153
					"	           ^^^^^^\n" + 
18154
					"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
18155
					"----------\n" + 
18156
					"4. ERROR in X.java (at line 7)\n" + 
18157
					"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
18158
					"	                     ^^^^^^^^^^^^^\n" + 
18159
					"Duplicate method foo(Object) in type X.C2\n" + 
18160
					"----------\n";
18054
		this.runNegativeTest(
18161
		this.runNegativeTest(
18055
			new String[] {
18162
			new String[] {
18056
				"X.java",
18163
				"X.java",
Lines 18067-18093 Link Here
18067
				"	}\n" +
18174
				"	}\n" +
18068
				"}\n"
18175
				"}\n"
18069
			},
18176
			},
18070
			"----------\n" + 
18177
			expectedCompilerLog
18071
			"1. WARNING in X.java (at line 6)\n" + 
18072
			"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
18073
			"	           ^^^^^^^\n" + 
18074
			"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" + 
18075
			"----------\n" + 
18076
			"2. ERROR in X.java (at line 6)\n" + 
18077
			"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
18078
			"	                      ^^^^^^^^^^^^^\n" + 
18079
			"Duplicate method foo(Object) in type X.C2\n" + 
18080
			"----------\n" + 
18081
			"3. WARNING in X.java (at line 7)\n" + 
18082
			"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
18083
			"	           ^^^^^^\n" + 
18084
			"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
18085
			"----------\n" + 
18086
			"4. ERROR in X.java (at line 7)\n" + 
18087
			"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
18088
			"	                     ^^^^^^^^^^^^^\n" + 
18089
			"Duplicate method foo(Object) in type X.C2\n" + 
18090
			"----------\n"
18091
		);
18178
		);
18092
/*
18179
/*
18093
X.java:6: name clash: <T#1>foo(Object) and <T#2>foo(Object) have the same erasure
18180
X.java:6: name clash: <T#1>foo(Object) and <T#2>foo(Object) have the same erasure
Lines 22443-22448 Link Here
22443
}
22530
}
22444
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22531
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22445
public void test0706() {
22532
public void test0706() {
22533
	String outputExpectedBelow17 = (this.complianceLevel == ClassFileConstants.JDK1_6)?
22534
			"----------\n" + 
22535
			"1. WARNING in X.java (at line 9)\n" + 
22536
			"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22537
			"	                                 ^^^^^^\n" + 
22538
			"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22539
			"----------\n":
22540
				"----------\n" + 
22541
				"1. ERROR in X.java (at line 9)\n" + 
22542
				"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22543
				"	                                 ^^^^^^\n" + 
22544
				"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22545
				"----------\n";
22446
	this.runNegativeTest(
22546
	this.runNegativeTest(
22447
		new String[] {
22547
		new String[] {
22448
			"X.java",
22548
			"X.java",
Lines 22458-22469 Link Here
22458
			"class CC {}\n",
22558
			"class CC {}\n",
22459
		},
22559
		},
22460
		(this.complianceLevel < ClassFileConstants.JDK1_7)
22560
		(this.complianceLevel < ClassFileConstants.JDK1_7)
22461
		? "----------\n" + 
22561
		? outputExpectedBelow17
22462
		"1. ERROR in X.java (at line 9)\n" + 
22463
		"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22464
		"	                                 ^^^^^^\n" + 
22465
		"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22466
		"----------\n"
22467
		: "----------\n" + 
22562
		: "----------\n" + 
22468
		"1. ERROR in X.java (at line 4)\n" + 
22563
		"1. ERROR in X.java (at line 4)\n" + 
22469
		"	bb.<Object>test();\n" + 
22564
		"	bb.<Object>test();\n" + 
Lines 22493-22498 Link Here
22493
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22588
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22494
public void test0706a() {
22589
public void test0706a() {
22495
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
22590
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
22591
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
22592
			"----------\n" + 
22593
			"1. ERROR in X.java (at line 4)\n" + 
22594
			"	AA<Object> res1 = bb.test();\n" + 
22595
			"	                     ^^^^\n" + 
22596
			"The method test() is ambiguous for the type BB\n" + 
22597
			"----------\n" + 
22598
			"2. WARNING in X.java (at line 5)\n" + 
22599
			"	AA res3 = bb.test();\n" + 
22600
			"	^^\n" + 
22601
			"AA is a raw type. References to generic type AA<T> should be parameterized\n" + 
22602
			"----------\n" + 
22603
			"3. ERROR in X.java (at line 5)\n" + 
22604
			"	AA res3 = bb.test();\n" + 
22605
			"	             ^^^^\n" + 
22606
			"The method test() is ambiguous for the type BB\n" + 
22607
			"----------\n" + 
22608
			"4. WARNING in X.java (at line 9)\n" + 
22609
			"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22610
			"	                                 ^^^^^^\n" + 
22611
			"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22612
			"----------\n":
22613
				"----------\n" + 
22614
				"1. ERROR in X.java (at line 4)\n" + 
22615
				"	AA<Object> res1 = bb.test();\n" + 
22616
				"	                     ^^^^\n" + 
22617
				"The method test() is ambiguous for the type BB\n" + 
22618
				"----------\n" + 
22619
				"2. WARNING in X.java (at line 5)\n" + 
22620
				"	AA res3 = bb.test();\n" + 
22621
				"	^^\n" + 
22622
				"AA is a raw type. References to generic type AA<T> should be parameterized\n" + 
22623
				"----------\n" + 
22624
				"3. ERROR in X.java (at line 5)\n" + 
22625
				"	AA res3 = bb.test();\n" + 
22626
				"	             ^^^^\n" + 
22627
				"The method test() is ambiguous for the type BB\n" + 
22628
				"----------\n" + 
22629
				"4. ERROR in X.java (at line 9)\n" + 
22630
				"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22631
				"	                                 ^^^^^^\n" + 
22632
				"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22633
				"----------\n";
22496
	this.runNegativeTest(
22634
	this.runNegativeTest(
22497
		new String[] {
22635
		new String[] {
22498
			"X.java",
22636
			"X.java",
Lines 22507-22533 Link Here
22507
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" +
22645
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" +
22508
			"class CC {}\n",
22646
			"class CC {}\n",
22509
		},
22647
		},
22510
		"----------\n" + 
22648
		expectedCompilerLog
22511
		"1. ERROR in X.java (at line 4)\n" + 
22512
		"	AA<Object> res1 = bb.test();\n" + 
22513
		"	                     ^^^^\n" + 
22514
		"The method test() is ambiguous for the type BB\n" + 
22515
		"----------\n" + 
22516
		"2. WARNING in X.java (at line 5)\n" + 
22517
		"	AA res3 = bb.test();\n" + 
22518
		"	^^\n" + 
22519
		"AA is a raw type. References to generic type AA<T> should be parameterized\n" + 
22520
		"----------\n" + 
22521
		"3. ERROR in X.java (at line 5)\n" + 
22522
		"	AA res3 = bb.test();\n" + 
22523
		"	             ^^^^\n" + 
22524
		"The method test() is ambiguous for the type BB\n" + 
22525
		"----------\n" + 
22526
		"4. ERROR in X.java (at line 9)\n" + 
22527
		"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22528
		"	                                 ^^^^^^\n" + 
22529
		"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22530
		"----------\n"
22531
	);
22649
	);
22532
/*
22650
/*
22533
X.java:4: reference to test is ambiguous, both method test() in AA and method <U>test() in BB match
22651
X.java:4: reference to test is ambiguous, both method test() in AA and method <U>test() in BB match
Lines 22551-22556 Link Here
22551
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22669
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22552
public void test0706b() {
22670
public void test0706b() {
22553
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
22671
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
22672
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
22673
			"----------\n" + 
22674
			"1. ERROR in X.java (at line 4)\n" + 
22675
			"	AA<CC> res = bb.test();\n" + 
22676
			"	                ^^^^\n" + 
22677
			"The method test() is ambiguous for the type BB\n" + 
22678
			"----------\n" + 
22679
			"2. ERROR in X.java (at line 5)\n" + 
22680
			"	BB res2 = bb.test();\n" + 
22681
			"	             ^^^^\n" + 
22682
			"The method test() is ambiguous for the type BB\n" + 
22683
			"----------\n" + 
22684
			"3. WARNING in X.java (at line 9)\n" + 
22685
			"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22686
			"	                                 ^^^^^^\n" + 
22687
			"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22688
			"----------\n":
22689
				"----------\n" + 
22690
				"1. ERROR in X.java (at line 4)\n" + 
22691
				"	AA<CC> res = bb.test();\n" + 
22692
				"	                ^^^^\n" + 
22693
				"The method test() is ambiguous for the type BB\n" + 
22694
				"----------\n" + 
22695
				"2. ERROR in X.java (at line 5)\n" + 
22696
				"	BB res2 = bb.test();\n" + 
22697
				"	             ^^^^\n" + 
22698
				"The method test() is ambiguous for the type BB\n" + 
22699
				"----------\n" + 
22700
				"3. ERROR in X.java (at line 9)\n" + 
22701
				"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22702
				"	                                 ^^^^^^\n" + 
22703
				"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22704
				"----------\n";
22554
	this.runNegativeTest(
22705
	this.runNegativeTest(
22555
		new String[] {
22706
		new String[] {
22556
			"X.java",
22707
			"X.java",
Lines 22565-22586 Link Here
22565
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" +
22716
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" +
22566
			"class CC {}\n",
22717
			"class CC {}\n",
22567
		},
22718
		},
22568
		"----------\n" + 
22719
		expectedCompilerLog
22569
		"1. ERROR in X.java (at line 4)\n" + 
22570
		"	AA<CC> res = bb.test();\n" + 
22571
		"	                ^^^^\n" + 
22572
		"The method test() is ambiguous for the type BB\n" + 
22573
		"----------\n" + 
22574
		"2. ERROR in X.java (at line 5)\n" + 
22575
		"	BB res2 = bb.test();\n" + 
22576
		"	             ^^^^\n" + 
22577
		"The method test() is ambiguous for the type BB\n" + 
22578
		"----------\n" + 
22579
		"3. ERROR in X.java (at line 9)\n" + 
22580
		"	class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22581
		"	                                 ^^^^^^\n" + 
22582
		"Name clash: The method test() of type BB has the same erasure as test() of type AA<T> but does not override it\n" + 
22583
		"----------\n"
22584
	);
22720
	);
22585
/*
22721
/*
22586
X.java:4: reference to test is ambiguous, both method test() in AA and method <U>test() in BB match
22722
X.java:4: reference to test is ambiguous, both method test() in AA and method <U>test() in BB match
Lines 23778-23783 Link Here
23778
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100007
23914
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100007
23779
public void test0748() {
23915
public void test0748() {
23780
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
23916
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
23917
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
23918
			"----------\n" + 
23919
			"1. WARNING in X.java (at line 5)\n" + 
23920
			"	public byte[] create(Class<byte[]> cl) { return null; }\n" + 
23921
			"	              ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23922
			"Name clash: The method create(Class<byte[]>) of type X has the same erasure as create(Class<U>) of type Factory<T> but does not override it\n" + 
23923
			"----------\n":
23924
				"----------\n" + 
23925
				"1. ERROR in X.java (at line 5)\n" + 
23926
				"	public byte[] create(Class<byte[]> cl) { return null; }\n" + 
23927
				"	              ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23928
				"Name clash: The method create(Class<byte[]>) of type X has the same erasure as create(Class<U>) of type Factory<T> but does not override it\n" + 
23929
				"----------\n";
23781
	this.runNegativeTest(
23930
	this.runNegativeTest(
23782
		new String[] {
23931
		new String[] {
23783
			"X.java",
23932
			"X.java",
Lines 23788-23799 Link Here
23788
			"	public byte[] create(Class<byte[]> cl) { return null; }\n" +
23937
			"	public byte[] create(Class<byte[]> cl) { return null; }\n" +
23789
			"}\n",
23938
			"}\n",
23790
		},
23939
		},
23791
		"----------\n" + 
23940
		expectedCompilerLog
23792
		"1. ERROR in X.java (at line 5)\n" + 
23793
		"	public byte[] create(Class<byte[]> cl) { return null; }\n" + 
23794
		"	              ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23795
		"Name clash: The method create(Class<byte[]>) of type X has the same erasure as create(Class<U>) of type Factory<T> but does not override it\n" + 
23796
		"----------\n"
23797
	);
23941
	);
23798
// javac 7 reports the name clash when X subclasses another class or is a concrete type
23942
// javac 7 reports the name clash when X subclasses another class or is a concrete type
23799
}
23943
}
Lines 40374-40379 Link Here
40374
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=204534
40518
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=204534
40375
public void test1181() {
40519
public void test1181() {
40376
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
40520
	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
40521
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
40522
			"----------\n" + 
40523
			"1. ERROR in X.java (at line 2)\n" + 
40524
			"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + 
40525
			"	                                                         ^\n" + 
40526
			"Cannot specify any additional bound T when first bound is a type parameter\n" + 
40527
			"----------\n" + 
40528
			"2. ERROR in X.java (at line 2)\n" + 
40529
			"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + 
40530
			"	                                                              ^^^^^^^^^^^^^^^^^^^\n" + 
40531
			"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40532
			"----------\n" + 
40533
			"3. WARNING in X.java (at line 3)\n" + 
40534
			"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40535
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40536
			"Type safety: Unchecked cast from Object to R\n" + 
40537
			"----------\n" + 
40538
			"4. ERROR in X.java (at line 5)\n" + 
40539
			"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + 
40540
			"	                                                         ^^^^^^^^^^\n" + 
40541
			"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" + 
40542
			"----------\n" + 
40543
			"5. ERROR in X.java (at line 5)\n" + 
40544
			"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + 
40545
			"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" + 
40546
			"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40547
			"----------\n" + 
40548
			"6. WARNING in X.java (at line 6)\n" + 
40549
			"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40550
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40551
			"Type safety: Unchecked cast from Object to R\n" + 
40552
			"----------\n" + 
40553
			"7. WARNING in X.java (at line 8)\n" + 
40554
			"	public static <T extends Comparable<S>, S, R extends Comparable<S>> R max(T arg1, S arg2) {\n" + 
40555
			"	                                                                      ^^^^^^^^^^^^^^^^^^^\n" + 
40556
			"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40557
			"----------\n" + 
40558
			"8. WARNING in X.java (at line 9)\n" + 
40559
			"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40560
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40561
			"Type safety: Unchecked cast from Object to R\n" + 
40562
			"----------\n":
40563
				"----------\n" + 
40564
				"1. ERROR in X.java (at line 2)\n" + 
40565
				"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + 
40566
				"	                                                         ^\n" + 
40567
				"Cannot specify any additional bound T when first bound is a type parameter\n" + 
40568
				"----------\n" + 
40569
				"2. ERROR in X.java (at line 2)\n" + 
40570
				"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + 
40571
				"	                                                              ^^^^^^^^^^^^^^^^^^^\n" + 
40572
				"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40573
				"----------\n" + 
40574
				"3. WARNING in X.java (at line 3)\n" + 
40575
				"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40576
				"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40577
				"Type safety: Unchecked cast from Object to R\n" + 
40578
				"----------\n" + 
40579
				"4. ERROR in X.java (at line 5)\n" + 
40580
				"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + 
40581
				"	                                                         ^^^^^^^^^^\n" + 
40582
				"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" + 
40583
				"----------\n" + 
40584
				"5. ERROR in X.java (at line 5)\n" + 
40585
				"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + 
40586
				"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" + 
40587
				"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40588
				"----------\n" + 
40589
				"6. WARNING in X.java (at line 6)\n" + 
40590
				"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40591
				"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40592
				"Type safety: Unchecked cast from Object to R\n" + 
40593
				"----------\n" + 
40594
				"7. ERROR in X.java (at line 8)\n" + 
40595
				"	public static <T extends Comparable<S>, S, R extends Comparable<S>> R max(T arg1, S arg2) {\n" + 
40596
				"	                                                                      ^^^^^^^^^^^^^^^^^^^\n" + 
40597
				"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40598
				"----------\n" + 
40599
				"8. WARNING in X.java (at line 9)\n" + 
40600
				"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40601
				"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40602
				"Type safety: Unchecked cast from Object to R\n" + 
40603
				"----------\n";
40377
	this.runNegativeTest(
40604
	this.runNegativeTest(
40378
		new String[] {
40605
		new String[] {
40379
			"X.java",
40606
			"X.java",
Lines 40390-40436 Link Here
40390
			"	public static void main(String[] args) {}\n" +
40617
			"	public static void main(String[] args) {}\n" +
40391
			"}\n", // =================
40618
			"}\n", // =================
40392
		},
40619
		},
40393
		"----------\n" + 
40620
		expectedCompilerLog
40394
		"1. ERROR in X.java (at line 2)\n" + 
40395
		"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + 
40396
		"	                                                         ^\n" + 
40397
		"Cannot specify any additional bound T when first bound is a type parameter\n" + 
40398
		"----------\n" + 
40399
		"2. ERROR in X.java (at line 2)\n" + 
40400
		"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + 
40401
		"	                                                              ^^^^^^^^^^^^^^^^^^^\n" + 
40402
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40403
		"----------\n" + 
40404
		"3. WARNING in X.java (at line 3)\n" + 
40405
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40406
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40407
		"Type safety: Unchecked cast from Object to R\n" + 
40408
		"----------\n" + 
40409
		"4. ERROR in X.java (at line 5)\n" + 
40410
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + 
40411
		"	                                                         ^^^^^^^^^^\n" + 
40412
		"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" + 
40413
		"----------\n" + 
40414
		"5. ERROR in X.java (at line 5)\n" + 
40415
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + 
40416
		"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" + 
40417
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40418
		"----------\n" + 
40419
		"6. WARNING in X.java (at line 6)\n" + 
40420
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40421
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40422
		"Type safety: Unchecked cast from Object to R\n" + 
40423
		"----------\n" + 
40424
		"7. ERROR in X.java (at line 8)\n" + 
40425
		"	public static <T extends Comparable<S>, S, R extends Comparable<S>> R max(T arg1, S arg2) {\n" + 
40426
		"	                                                                      ^^^^^^^^^^^^^^^^^^^\n" + 
40427
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + 
40428
		"----------\n" + 
40429
		"8. WARNING in X.java (at line 9)\n" + 
40430
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + 
40431
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
40432
		"Type safety: Unchecked cast from Object to R\n" + 
40433
		"----------\n"
40434
	);
40621
	);
40435
/*
40622
/*
40436
X.java:2: a type variable may not be followed by other bounds
40623
X.java:2: a type variable may not be followed by other bounds
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-485 / +1546 lines)
Lines 27-33 Link Here
27
27
28
public class MethodVerifyTest extends AbstractComparableTest {
28
public class MethodVerifyTest extends AbstractComparableTest {
29
	static {
29
	static {
30
//		TESTS_NAMES = new String[] { "test339447" };
30
//		TESTS_NAMES = new String[] { "testBug317719" };
31
//		TESTS_NUMBERS = new int[] { 213 };
31
//		TESTS_NUMBERS = new int[] { 213 };
32
//		TESTS_RANGE = new int[] { 190, -1};
32
//		TESTS_RANGE = new int[] { 190, -1};
33
	}
33
	}
Lines 3333-3338 Link Here
3333
3333
3334
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3334
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3335
	public void test048() {
3335
	public void test048() {
3336
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3337
				"----------\n" + 
3338
				"1. WARNING in X1.java (at line 2)\n" + 
3339
				"	public class X1 extends LinkedHashMap<String, String> {\n" + 
3340
				"	             ^^\n" + 
3341
				"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + 
3342
				"----------\n" + 
3343
				"2. WARNING in X1.java (at line 3)\n" + 
3344
				"	public Object putAll(Map<String,String> a) { return null; }\n" + 
3345
				"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
3346
				"Name clash: The method putAll(Map<String,String>) of type X1 has the same erasure as putAll(Map<? extends K,? extends V>) of type HashMap<K,V> but does not override it\n" + 
3347
				"----------\n":
3348
					"----------\n" + 
3349
					"1. WARNING in X1.java (at line 2)\n" + 
3350
					"	public class X1 extends LinkedHashMap<String, String> {\n" + 
3351
					"	             ^^\n" + 
3352
					"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + 
3353
					"----------\n" + 
3354
					"2. ERROR in X1.java (at line 3)\n" + 
3355
					"	public Object putAll(Map<String,String> a) { return null; }\n" + 
3356
					"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
3357
					"Name clash: The method putAll(Map<String,String>) of type X1 has the same erasure as putAll(Map<? extends K,? extends V>) of type HashMap<K,V> but does not override it\n" + 
3358
					"----------\n";
3336
		this.runNegativeTest(
3359
		this.runNegativeTest(
3337
			new String[] {
3360
			new String[] {
3338
				"X1.java",
3361
				"X1.java",
Lines 3341-3357 Link Here
3341
				"    public Object putAll(Map<String,String> a) { return null; }\n" +
3364
				"    public Object putAll(Map<String,String> a) { return null; }\n" +
3342
				"}\n"
3365
				"}\n"
3343
			},
3366
			},
3344
			"----------\n" + 
3367
			expectedCompilerLog
3345
			"1. WARNING in X1.java (at line 2)\n" + 
3346
			"	public class X1 extends LinkedHashMap<String, String> {\n" + 
3347
			"	             ^^\n" + 
3348
			"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + 
3349
			"----------\n" + 
3350
			"2. ERROR in X1.java (at line 3)\n" + 
3351
			"	public Object putAll(Map<String,String> a) { return null; }\n" + 
3352
			"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
3353
			"Name clash: The method putAll(Map<String,String>) of type X1 has the same erasure as putAll(Map<? extends K,? extends V>) of type HashMap<K,V> but does not override it\n" + 
3354
			"----------\n"
3355
		);
3368
		);
3356
/* javac 7
3369
/* javac 7
3357
X.java:4: name clash: putAll(Map<String,String>) in X1 and putAll(Map<? extends K,? extends V>) in HashMap have the same erasure, yet neither overrides the other
3370
X.java:4: name clash: putAll(Map<String,String>) in X1 and putAll(Map<? extends K,? extends V>) in HashMap have the same erasure, yet neither overrides the other
Lines 3365-3370 Link Here
3365
	}
3378
	}
3366
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3379
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3367
	public void test048a() {
3380
	public void test048a() {
3381
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3382
				"----------\n" + 
3383
				"1. WARNING in X2.java (at line 2)\n" + 
3384
				"	public Object foo(I<String> z) { return null; }\n" + 
3385
				"	              ^^^^^^^^^^^^^^^^\n" + 
3386
				"Name clash: The method foo(I<String>) of type X2 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3387
				"----------\n":		
3388
					"----------\n" + 
3389
					"1. ERROR in X2.java (at line 2)\n" + 
3390
					"	public Object foo(I<String> z) { return null; }\n" + 
3391
					"	              ^^^^^^^^^^^^^^^^\n" + 
3392
					"Name clash: The method foo(I<String>) of type X2 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3393
					"----------\n";
3368
		this.runNegativeTest(
3394
		this.runNegativeTest(
3369
			new String[] {
3395
			new String[] {
3370
				"X2.java",
3396
				"X2.java",
Lines 3378-3389 Link Here
3378
				"    public void foo(I<? extends T> a);\n" +
3404
				"    public void foo(I<? extends T> a);\n" +
3379
				"}\n"
3405
				"}\n"
3380
			},
3406
			},
3381
			"----------\n" + 
3407
			expectedCompilerLog
3382
			"1. ERROR in X2.java (at line 2)\n" + 
3383
			"	public Object foo(I<String> z) { return null; }\n" + 
3384
			"	              ^^^^^^^^^^^^^^^^\n" + 
3385
			"Name clash: The method foo(I<String>) of type X2 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3386
			"----------\n"
3387
		);
3408
		);
3388
/* javac 7
3409
/* javac 7
3389
X.java:2: name clash: foo(I<String>) in X2 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
3410
X.java:2: name clash: foo(I<String>) in X2 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
Lines 3427-3432 Link Here
3427
	}
3448
	}
3428
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3449
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3429
	public void test048c() {
3450
	public void test048c() {
3451
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3452
				"----------\n" + 
3453
				"1. WARNING in X4.java (at line 2)\n" + 
3454
				"	public String foo(I<String> z) { return null; }\n" + 
3455
				"	              ^^^^^^^^^^^^^^^^\n" + 
3456
				"Name clash: The method foo(I<String>) of type X4 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3457
				"----------\n":
3458
					"----------\n" + 
3459
					"1. ERROR in X4.java (at line 2)\n" + 
3460
					"	public String foo(I<String> z) { return null; }\n" + 
3461
					"	              ^^^^^^^^^^^^^^^^\n" + 
3462
					"Name clash: The method foo(I<String>) of type X4 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3463
					"----------\n";
3430
		this.runNegativeTest(
3464
		this.runNegativeTest(
3431
			new String[] {
3465
			new String[] {
3432
				"X4.java",
3466
				"X4.java",
Lines 3440-3451 Link Here
3440
				"    public Object foo(I<? extends T> a);\n" +
3474
				"    public Object foo(I<? extends T> a);\n" +
3441
				"}\n"
3475
				"}\n"
3442
			},
3476
			},
3443
			"----------\n" + 
3477
			expectedCompilerLog
3444
			"1. ERROR in X4.java (at line 2)\n" + 
3445
			"	public String foo(I<String> z) { return null; }\n" + 
3446
			"	              ^^^^^^^^^^^^^^^^\n" + 
3447
			"Name clash: The method foo(I<String>) of type X4 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3448
			"----------\n"
3449
		);
3478
		);
3450
/* javac 7
3479
/* javac 7
3451
X.java:2: name clash: foo(I<String>) in X4 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
3480
X.java:2: name clash: foo(I<String>) in X4 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
Lines 3458-3463 Link Here
3458
	}
3487
	}
3459
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3488
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3460
	public void test048d() {
3489
	public void test048d() {
3490
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3491
				"----------\n" + 
3492
				"1. WARNING in X5.java (at line 2)\n" + 
3493
				"	public Object foo(I<String> z) { return null; }\n" + 
3494
				"	              ^^^^^^^^^^^^^^^^\n" + 
3495
				"Name clash: The method foo(I<String>) of type X5 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3496
				"----------\n":
3497
					"----------\n" + 
3498
					"1. ERROR in X5.java (at line 2)\n" + 
3499
					"	public Object foo(I<String> z) { return null; }\n" + 
3500
					"	              ^^^^^^^^^^^^^^^^\n" + 
3501
					"Name clash: The method foo(I<String>) of type X5 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3502
					"----------\n";
3461
		this.runNegativeTest(
3503
		this.runNegativeTest(
3462
			new String[] {
3504
			new String[] {
3463
				"X5.java",
3505
				"X5.java",
Lines 3471-3482 Link Here
3471
				"    public String foo(I<? extends T> a);\n" +
3513
				"    public String foo(I<? extends T> a);\n" +
3472
				"}\n"
3514
				"}\n"
3473
			},
3515
			},
3474
			"----------\n" + 
3516
			expectedCompilerLog
3475
			"1. ERROR in X5.java (at line 2)\n" + 
3476
			"	public Object foo(I<String> z) { return null; }\n" + 
3477
			"	              ^^^^^^^^^^^^^^^^\n" + 
3478
			"Name clash: The method foo(I<String>) of type X5 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3479
			"----------\n"
3480
		);
3517
		);
3481
/* javac 7
3518
/* javac 7
3482
X.java:2: name clash: foo(I<String>) in X5 and foo(I<? extends T>) in Y have the
3519
X.java:2: name clash: foo(I<String>) in X5 and foo(I<? extends T>) in Y have the
Lines 3490-3495 Link Here
3490
	}
3527
	}
3491
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3528
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3492
	public void test048e() {
3529
	public void test048e() {
3530
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3531
				"----------\n" + 
3532
				"1. WARNING in X6.java (at line 2)\n" + 
3533
				"	public void foo(I<String> z) {}\n" + 
3534
				"	            ^^^^^^^^^^^^^^^^\n" + 
3535
				"Name clash: The method foo(I<String>) of type X6 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3536
				"----------\n":
3537
					"----------\n" + 
3538
					"1. ERROR in X6.java (at line 2)\n" + 
3539
					"	public void foo(I<String> z) {}\n" + 
3540
					"	            ^^^^^^^^^^^^^^^^\n" + 
3541
					"Name clash: The method foo(I<String>) of type X6 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3542
					"----------\n";
3493
		this.runNegativeTest(
3543
		this.runNegativeTest(
3494
			new String[] {
3544
			new String[] {
3495
				"X6.java",
3545
				"X6.java",
Lines 3503-3514 Link Here
3503
				"    public Object foo(I<? extends T> a);\n" +
3553
				"    public Object foo(I<? extends T> a);\n" +
3504
				"}\n"
3554
				"}\n"
3505
			},
3555
			},
3506
			"----------\n" + 
3556
			expectedCompilerLog
3507
			"1. ERROR in X6.java (at line 2)\n" + 
3508
			"	public void foo(I<String> z) {}\n" + 
3509
			"	            ^^^^^^^^^^^^^^^^\n" + 
3510
			"Name clash: The method foo(I<String>) of type X6 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3511
			"----------\n"
3512
		);
3557
		);
3513
/* javac 7
3558
/* javac 7
3514
X.java:2: name clash: foo(I<String>) in X6 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
3559
X.java:2: name clash: foo(I<String>) in X6 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
Lines 3521-3526 Link Here
3521
	}
3566
	}
3522
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3567
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900
3523
	public void test048f() {
3568
	public void test048f() {
3569
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3570
				"----------\n" + 
3571
				"1. WARNING in X7.java (at line 2)\n" + 
3572
				"	public String foo(I<String> z) { return null; }\n" + 
3573
				"	              ^^^^^^^^^^^^^^^^\n" + 
3574
				"Name clash: The method foo(I<String>) of type X7 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3575
				"----------\n":
3576
					"----------\n" + 
3577
					"1. ERROR in X7.java (at line 2)\n" + 
3578
					"	public String foo(I<String> z) { return null; }\n" + 
3579
					"	              ^^^^^^^^^^^^^^^^\n" + 
3580
					"Name clash: The method foo(I<String>) of type X7 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3581
					"----------\n";
3524
		this.runNegativeTest(
3582
		this.runNegativeTest(
3525
			new String[] {
3583
			new String[] {
3526
				"X7.java",
3584
				"X7.java",
Lines 3534-3545 Link Here
3534
				"    public T foo(I<? extends T> a);\n" +
3592
				"    public T foo(I<? extends T> a);\n" +
3535
				"}\n"
3593
				"}\n"
3536
			},
3594
			},
3537
			"----------\n" + 
3595
			expectedCompilerLog
3538
			"1. ERROR in X7.java (at line 2)\n" + 
3539
			"	public String foo(I<String> z) { return null; }\n" + 
3540
			"	              ^^^^^^^^^^^^^^^^\n" + 
3541
			"Name clash: The method foo(I<String>) of type X7 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + 
3542
			"----------\n"
3543
		);
3596
		);
3544
/* javac 7
3597
/* javac 7
3545
X.java:2: name clash: foo(I<String>) in X7 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
3598
X.java:2: name clash: foo(I<String>) in X7 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other
Lines 3642-3647 Link Here
3642
3695
3643
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754
3696
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754
3644
	public void test050() {
3697
	public void test050() {
3698
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3699
				"----------\n" + 
3700
				"1. WARNING in X.java (at line 2)\n" + 
3701
				"	public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + 
3702
				"	                              ^^^^^\n" + 
3703
				"Duplicate method foo() in type X\n" + 
3704
				"----------\n" + 
3705
				"2. WARNING in X.java (at line 3)\n" + 
3706
				"	public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + 
3707
				"	                              ^^^^^\n" + 
3708
				"Duplicate method foo() in type X\n" + 
3709
				"----------\n" + 
3710
				"3. WARNING in X.java (at line 7)\n" + 
3711
				"	new X().<B>foo();\n" + 
3712
				"	^^^^^^^^^^^^^^^^\n" + 
3713
				"The static method foo() from the type X should be accessed in a static way\n" + 
3714
				"----------\n":
3715
					"----------\n" + 
3716
					"1. ERROR in X.java (at line 2)\n" + 
3717
					"	public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + 
3718
					"	                              ^^^^^\n" + 
3719
					"Duplicate method foo() in type X\n" + 
3720
					"----------\n" + 
3721
					"2. ERROR in X.java (at line 3)\n" + 
3722
					"	public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + 
3723
					"	                              ^^^^^\n" + 
3724
					"Duplicate method foo() in type X\n" + 
3725
					"----------\n" + 
3726
					"3. ERROR in X.java (at line 6)\n" + 
3727
					"	X.<B>foo();\n" + 
3728
					"	     ^^^\n" + 
3729
					"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + 
3730
					"----------\n" + 
3731
					"4. ERROR in X.java (at line 7)\n" + 
3732
					"	new X().<B>foo();\n" + 
3733
					"	           ^^^\n" + 
3734
					"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + 
3735
					"----------\n";
3645
		this.runNegativeTest(
3736
		this.runNegativeTest(
3646
			new String[] {
3737
			new String[] {
3647
				"X.java",
3738
				"X.java",
Lines 3657-3683 Link Here
3657
				"class A {}\n" +
3748
				"class A {}\n" +
3658
				"class B {}"
3749
				"class B {}"
3659
			},
3750
			},
3660
			"----------\n" + 
3751
			expectedCompilerLog
3661
			"1. ERROR in X.java (at line 2)\n" + 
3662
			"	public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + 
3663
			"	                              ^^^^^\n" + 
3664
			"Duplicate method foo() in type X\n" + 
3665
			"----------\n" + 
3666
			"2. ERROR in X.java (at line 3)\n" + 
3667
			"	public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + 
3668
			"	                              ^^^^^\n" + 
3669
			"Duplicate method foo() in type X\n" + 
3670
			"----------\n" + 
3671
			"3. ERROR in X.java (at line 6)\n" + 
3672
			"	X.<B>foo();\n" + 
3673
			"	     ^^^\n" + 
3674
			"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + 
3675
			"----------\n" + 
3676
			"4. ERROR in X.java (at line 7)\n" + 
3677
			"	new X().<B>foo();\n" + 
3678
			"	           ^^^\n" + 
3679
			"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + 
3680
			"----------\n"
3681
		);
3752
		);
3682
/* javac 7
3753
/* javac 7
3683
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure
3754
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure
Lines 3701-3706 Link Here
3701
	}
3772
	}
3702
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754
3773
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754
3703
	public void test050a() {
3774
	public void test050a() {
3775
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3776
				"----------\n" + 
3777
				"1. WARNING in X.java (at line 2)\n" + 
3778
				"	public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + 
3779
				"	                                 ^^^^^\n" + 
3780
				"Duplicate method foo() in type X\n" + 
3781
				"----------\n" + 
3782
				"2. WARNING in X.java (at line 3)\n" + 
3783
				"	public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + 
3784
				"	                              ^^^^^\n" + 
3785
				"Duplicate method foo() in type X\n" + 
3786
				"----------\n" + 
3787
				"3. ERROR in X.java (at line 5)\n" + 
3788
				"	X.foo();\n" + 
3789
				"	  ^^^\n" + 
3790
				"The method foo() is ambiguous for the type X\n" + 
3791
				"----------\n" + 
3792
				"4. ERROR in X.java (at line 6)\n" + 
3793
				"	foo();\n" + 
3794
				"	^^^\n" + 
3795
				"The method foo() is ambiguous for the type X\n" + 
3796
				"----------\n":
3797
					"----------\n" + 
3798
					"1. ERROR in X.java (at line 2)\n" + 
3799
					"	public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + 
3800
					"	                                 ^^^^^\n" + 
3801
					"Duplicate method foo() in type X\n" + 
3802
					"----------\n" + 
3803
					"2. ERROR in X.java (at line 3)\n" + 
3804
					"	public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + 
3805
					"	                              ^^^^^\n" + 
3806
					"Duplicate method foo() in type X\n" + 
3807
					"----------\n";
3704
		this.runNegativeTest(
3808
		this.runNegativeTest(
3705
			new String[] {
3809
			new String[] {
3706
				"X.java",
3810
				"X.java",
Lines 3715-3731 Link Here
3715
				"class A {}\n" +
3819
				"class A {}\n" +
3716
				"class B {}"
3820
				"class B {}"
3717
			},
3821
			},
3718
			"----------\n" + 
3822
			expectedCompilerLog
3719
			"1. ERROR in X.java (at line 2)\n" + 
3720
			"	public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + 
3721
			"	                                 ^^^^^\n" + 
3722
			"Duplicate method foo() in type X\n" + 
3723
			"----------\n" + 
3724
			"2. ERROR in X.java (at line 3)\n" + 
3725
			"	public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + 
3726
			"	                              ^^^^^\n" + 
3727
			"Duplicate method foo() in type X\n" + 
3728
			"----------\n"
3729
		);
3823
		);
3730
/* javac 7
3824
/* javac 7
3731
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure
3825
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure
Lines 3740-3745 Link Here
3740
3834
3741
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3835
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3742
	public void test050b() {
3836
	public void test050b() {
3837
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3838
				"----------\n" + 
3839
				"1. WARNING in X.java (at line 3)\n" + 
3840
				"	Y foo(Object o) {  return null; } // duplicate\n" + 
3841
				"	  ^^^^^^^^^^^^^\n" + 
3842
				"Duplicate method foo(Object) in type X.C1\n" + 
3843
				"----------\n" + 
3844
				"2. WARNING in X.java (at line 4)\n" + 
3845
				"	Z foo(Object o) {  return null; } // duplicate\n" + 
3846
				"	  ^^^^^^^^^^^^^\n" + 
3847
				"Duplicate method foo(Object) in type X.C1\n" + 
3848
				"----------\n" + 
3849
				"3. WARNING in X.java (at line 7)\n" + 
3850
				"	<T extends Y> T foo(Object o) {  return null; } // duplicate\n" + 
3851
				"	                ^^^^^^^^^^^^^\n" + 
3852
				"Duplicate method foo(Object) in type X.C2\n" + 
3853
				"----------\n" + 
3854
				"4. WARNING in X.java (at line 8)\n" + 
3855
				"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" + 
3856
				"	                ^^^^^^^^^^^^^\n" + 
3857
				"Duplicate method foo(Object) in type X.C2\n" + 
3858
				"----------\n" + 
3859
				"5. ERROR in X.java (at line 11)\n" + 
3860
				"	A<Y> foo(Object o) {  return null; } // duplicate\n" + 
3861
				"	     ^^^^^^^^^^^^^\n" + 
3862
				"Duplicate method foo(Object) in type X.C3\n" + 
3863
				"----------\n" + 
3864
				"6. ERROR in X.java (at line 12)\n" + 
3865
				"	A<Z> foo(Object o) {  return null; } // duplicate\n" + 
3866
				"	     ^^^^^^^^^^^^^\n" + 
3867
				"Duplicate method foo(Object) in type X.C3\n" + 
3868
				"----------\n" + 
3869
				"7. WARNING in X.java (at line 15)\n" + 
3870
				"	Y foo(Object o) {  return null; } // duplicate\n" + 
3871
				"	  ^^^^^^^^^^^^^\n" + 
3872
				"Duplicate method foo(Object) in type X.C4\n" + 
3873
				"----------\n" + 
3874
				"8. WARNING in X.java (at line 16)\n" + 
3875
				"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" + 
3876
				"	                ^^^^^^^^^^^^^\n" + 
3877
				"Duplicate method foo(Object) in type X.C4\n" + 
3878
				"----------\n":
3879
					"----------\n" + 
3880
					"1. ERROR in X.java (at line 3)\n" + 
3881
					"	Y foo(Object o) {  return null; } // duplicate\n" + 
3882
					"	  ^^^^^^^^^^^^^\n" + 
3883
					"Duplicate method foo(Object) in type X.C1\n" + 
3884
					"----------\n" + 
3885
					"2. ERROR in X.java (at line 4)\n" + 
3886
					"	Z foo(Object o) {  return null; } // duplicate\n" + 
3887
					"	  ^^^^^^^^^^^^^\n" + 
3888
					"Duplicate method foo(Object) in type X.C1\n" + 
3889
					"----------\n" + 
3890
					"3. ERROR in X.java (at line 7)\n" + 
3891
					"	<T extends Y> T foo(Object o) {  return null; } // duplicate\n" + 
3892
					"	                ^^^^^^^^^^^^^\n" + 
3893
					"Duplicate method foo(Object) in type X.C2\n" + 
3894
					"----------\n" + 
3895
					"4. ERROR in X.java (at line 8)\n" + 
3896
					"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" + 
3897
					"	                ^^^^^^^^^^^^^\n" + 
3898
					"Duplicate method foo(Object) in type X.C2\n" + 
3899
					"----------\n" + 
3900
					"5. ERROR in X.java (at line 11)\n" + 
3901
					"	A<Y> foo(Object o) {  return null; } // duplicate\n" + 
3902
					"	     ^^^^^^^^^^^^^\n" + 
3903
					"Duplicate method foo(Object) in type X.C3\n" + 
3904
					"----------\n" + 
3905
					"6. ERROR in X.java (at line 12)\n" + 
3906
					"	A<Z> foo(Object o) {  return null; } // duplicate\n" + 
3907
					"	     ^^^^^^^^^^^^^\n" + 
3908
					"Duplicate method foo(Object) in type X.C3\n" + 
3909
					"----------\n" + 
3910
					"7. ERROR in X.java (at line 15)\n" + 
3911
					"	Y foo(Object o) {  return null; } // duplicate\n" + 
3912
					"	  ^^^^^^^^^^^^^\n" + 
3913
					"Duplicate method foo(Object) in type X.C4\n" + 
3914
					"----------\n" + 
3915
					"8. ERROR in X.java (at line 16)\n" + 
3916
					"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" + 
3917
					"	                ^^^^^^^^^^^^^\n" + 
3918
					"Duplicate method foo(Object) in type X.C4\n" + 
3919
					"----------\n";
3743
		this.runNegativeTest(
3920
		this.runNegativeTest(
3744
			new String[] {
3921
			new String[] {
3745
				"X.java",
3922
				"X.java",
Lines 3765-3811 Link Here
3765
				"class Y {}\n" +
3942
				"class Y {}\n" +
3766
				"class Z {}"
3943
				"class Z {}"
3767
			},
3944
			},
3768
			"----------\n" + 
3945
			expectedCompilerLog
3769
			"1. ERROR in X.java (at line 3)\n" + 
3770
			"	Y foo(Object o) {  return null; } // duplicate\n" + 
3771
			"	  ^^^^^^^^^^^^^\n" + 
3772
			"Duplicate method foo(Object) in type X.C1\n" + 
3773
			"----------\n" + 
3774
			"2. ERROR in X.java (at line 4)\n" + 
3775
			"	Z foo(Object o) {  return null; } // duplicate\n" + 
3776
			"	  ^^^^^^^^^^^^^\n" + 
3777
			"Duplicate method foo(Object) in type X.C1\n" + 
3778
			"----------\n" + 
3779
			"3. ERROR in X.java (at line 7)\n" + 
3780
			"	<T extends Y> T foo(Object o) {  return null; } // duplicate\n" + 
3781
			"	                ^^^^^^^^^^^^^\n" + 
3782
			"Duplicate method foo(Object) in type X.C2\n" + 
3783
			"----------\n" + 
3784
			"4. ERROR in X.java (at line 8)\n" + 
3785
			"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" + 
3786
			"	                ^^^^^^^^^^^^^\n" + 
3787
			"Duplicate method foo(Object) in type X.C2\n" + 
3788
			"----------\n" + 
3789
			"5. ERROR in X.java (at line 11)\n" + 
3790
			"	A<Y> foo(Object o) {  return null; } // duplicate\n" + 
3791
			"	     ^^^^^^^^^^^^^\n" + 
3792
			"Duplicate method foo(Object) in type X.C3\n" + 
3793
			"----------\n" + 
3794
			"6. ERROR in X.java (at line 12)\n" + 
3795
			"	A<Z> foo(Object o) {  return null; } // duplicate\n" + 
3796
			"	     ^^^^^^^^^^^^^\n" + 
3797
			"Duplicate method foo(Object) in type X.C3\n" + 
3798
			"----------\n" + 
3799
			"7. ERROR in X.java (at line 15)\n" + 
3800
			"	Y foo(Object o) {  return null; } // duplicate\n" + 
3801
			"	  ^^^^^^^^^^^^^\n" + 
3802
			"Duplicate method foo(Object) in type X.C4\n" + 
3803
			"----------\n" + 
3804
			"8. ERROR in X.java (at line 16)\n" + 
3805
			"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" + 
3806
			"	                ^^^^^^^^^^^^^\n" + 
3807
			"Duplicate method foo(Object) in type X.C4\n" + 
3808
			"----------\n"
3809
		);
3946
		);
3810
/* javac 7
3947
/* javac 7
3811
X.java:4: foo(Object) is already defined in X.C1
3948
X.java:4: foo(Object) is already defined in X.C1
Lines 3828-3833 Link Here
3828
	}
3965
	}
3829
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3966
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3830
	public void test050c() {
3967
	public void test050c() {
3968
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3969
				"----------\n" + 
3970
				"1. ERROR in X.java (at line 3)\n" + 
3971
				"	A<Y> foo(A<Y> o) {  return null; } // duplicate\n" + 
3972
				"	     ^^^^^^^^^^^\n" + 
3973
				"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3974
				"----------\n" + 
3975
				"2. ERROR in X.java (at line 4)\n" + 
3976
				"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" + 
3977
				"	     ^^^^^^^^^^^\n" + 
3978
				"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3979
				"----------\n" + 
3980
				"3. WARNING in X.java (at line 7)\n" + 
3981
				"	<T extends Y> T foo(A<Y> o) {  return null; } // ok\n" + 
3982
				"	                ^^^^^^^^^^^\n" + 
3983
				"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3984
				"----------\n" + 
3985
				"4. WARNING in X.java (at line 8)\n" + 
3986
				"	<T extends Z> T foo(A<Z> o) {  return null; } // ok\n" + 
3987
				"	                ^^^^^^^^^^^\n" + 
3988
				"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3989
				"----------\n":
3990
					"----------\n" + 
3991
					"1. ERROR in X.java (at line 3)\n" + 
3992
					"	A<Y> foo(A<Y> o) {  return null; } // duplicate\n" + 
3993
					"	     ^^^^^^^^^^^\n" + 
3994
					"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3995
					"----------\n" + 
3996
					"2. ERROR in X.java (at line 4)\n" + 
3997
					"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" + 
3998
					"	     ^^^^^^^^^^^\n" + 
3999
					"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
4000
					"----------\n" + 
4001
					"3. ERROR in X.java (at line 7)\n" + 
4002
					"	<T extends Y> T foo(A<Y> o) {  return null; } // ok\n" + 
4003
					"	                ^^^^^^^^^^^\n" + 
4004
					"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
4005
					"----------\n" + 
4006
					"4. ERROR in X.java (at line 8)\n" + 
4007
					"	<T extends Z> T foo(A<Z> o) {  return null; } // ok\n" + 
4008
					"	                ^^^^^^^^^^^\n" + 
4009
					"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
4010
					"----------\n";
3831
		this.runNegativeTest(
4011
		this.runNegativeTest(
3832
			new String[] {
4012
			new String[] {
3833
				"X.java",
4013
				"X.java",
Lines 3845-3871 Link Here
3845
				"class Y {}\n" +
4025
				"class Y {}\n" +
3846
				"class Z {}"
4026
				"class Z {}"
3847
			},
4027
			},
3848
			"----------\n" + 
4028
			expectedCompilerLog
3849
			"1. ERROR in X.java (at line 3)\n" + 
3850
			"	A<Y> foo(A<Y> o) {  return null; } // duplicate\n" + 
3851
			"	     ^^^^^^^^^^^\n" + 
3852
			"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3853
			"----------\n" + 
3854
			"2. ERROR in X.java (at line 4)\n" + 
3855
			"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" + 
3856
			"	     ^^^^^^^^^^^\n" + 
3857
			"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3858
			"----------\n" + 
3859
			"3. ERROR in X.java (at line 7)\n" + 
3860
			"	<T extends Y> T foo(A<Y> o) {  return null; } // ok\n" + 
3861
			"	                ^^^^^^^^^^^\n" + 
3862
			"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3863
			"----------\n" + 
3864
			"4. ERROR in X.java (at line 8)\n" + 
3865
			"	<T extends Z> T foo(A<Z> o) {  return null; } // ok\n" + 
3866
			"	                ^^^^^^^^^^^\n" + 
3867
			"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3868
			"----------\n"
3869
		);
4029
		);
3870
/* javac 7
4030
/* javac 7
3871
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure
4031
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure
Lines 3882-3887 Link Here
3882
	}
4042
	}
3883
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
4043
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3884
	public void test050d() {
4044
	public void test050d() {
4045
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4046
				"----------\n" + 
4047
				"1. WARNING in X.java (at line 3)\n" + 
4048
				"	<T extends Y, U> T foo(Object o) {  return null; } // ok\n" + 
4049
				"	                   ^^^^^^^^^^^^^\n" + 
4050
				"Duplicate method foo(Object) in type X.C7\n" + 
4051
				"----------\n" + 
4052
				"2. WARNING in X.java (at line 4)\n" + 
4053
				"	<T extends Z> T foo(Object o) {  return null; } // ok\n" + 
4054
				"	                ^^^^^^^^^^^^^\n" + 
4055
				"Duplicate method foo(Object) in type X.C7\n" + 
4056
				"----------\n":
4057
					"----------\n" + 
4058
					"1. ERROR in X.java (at line 3)\n" + 
4059
					"	<T extends Y, U> T foo(Object o) {  return null; } // ok\n" + 
4060
					"	                   ^^^^^^^^^^^^^\n" + 
4061
					"Duplicate method foo(Object) in type X.C7\n" + 
4062
					"----------\n" + 
4063
					"2. ERROR in X.java (at line 4)\n" + 
4064
					"	<T extends Z> T foo(Object o) {  return null; } // ok\n" + 
4065
					"	                ^^^^^^^^^^^^^\n" + 
4066
					"Duplicate method foo(Object) in type X.C7\n" + 
4067
					"----------\n";
3885
		this.runNegativeTest(
4068
		this.runNegativeTest(
3886
			new String[] {
4069
			new String[] {
3887
				"X.java",
4070
				"X.java",
Lines 3895-3911 Link Here
3895
				"class Y {}\n" +
4078
				"class Y {}\n" +
3896
				"class Z {}"
4079
				"class Z {}"
3897
			},
4080
			},
3898
			"----------\n" + 
4081
			expectedCompilerLog
3899
			"1. ERROR in X.java (at line 3)\n" + 
3900
			"	<T extends Y, U> T foo(Object o) {  return null; } // ok\n" + 
3901
			"	                   ^^^^^^^^^^^^^\n" + 
3902
			"Duplicate method foo(Object) in type X.C7\n" + 
3903
			"----------\n" + 
3904
			"2. ERROR in X.java (at line 4)\n" + 
3905
			"	<T extends Z> T foo(Object o) {  return null; } // ok\n" + 
3906
			"	                ^^^^^^^^^^^^^\n" + 
3907
			"Duplicate method foo(Object) in type X.C7\n" + 
3908
			"----------\n"
3909
		);
4082
		);
3910
/* javac 7
4083
/* javac 7
3911
X.java:4: name clash: <T#1>foo(Object) and <T#2,U>foo(Object) have the same erasure
4084
X.java:4: name clash: <T#1>foo(Object) and <T#2,U>foo(Object) have the same erasure
Lines 3921-3926 Link Here
3921
4094
3922
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4095
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
3923
	public void test050e() {
4096
	public void test050e() {
4097
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4098
				"----------\n" + 
4099
				"1. WARNING in X.java (at line 2)\n" + 
4100
				"	<N extends B> N a(A<String> s) { return null; }\n" + 
4101
				"	                ^^^^^^^^^^^^^^\n" + 
4102
				"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + 
4103
				"----------\n" + 
4104
				"2. WARNING in X.java (at line 3)\n" + 
4105
				"	<N> Object a(A<Number> n) { return null; }\n" + 
4106
				"	           ^^^^^^^^^^^^^^\n" + 
4107
				"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + 
4108
				"----------\n" + 
4109
				"3. WARNING in X.java (at line 4)\n" + 
4110
				"	<N extends B> void b(A<String> s) {}\n" + 
4111
				"	                   ^^^^^^^^^^^^^^\n" + 
4112
				"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4113
				"----------\n" + 
4114
				"4. WARNING in X.java (at line 5)\n" + 
4115
				"	<N extends B> B b(A<Number> n) { return null; }\n" + 
4116
				"	                ^^^^^^^^^^^^^^\n" + 
4117
				"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4118
				"----------\n" + 
4119
				"5. WARNING in X.java (at line 6)\n" + 
4120
				"	void c(A<String> s) {}\n" + 
4121
				"	     ^^^^^^^^^^^^^^\n" + 
4122
				"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + 
4123
				"----------\n" + 
4124
				"6. WARNING in X.java (at line 7)\n" + 
4125
				"	B c(A<Number> n) { return null; }\n" + 
4126
				"	  ^^^^^^^^^^^^^^\n" + 
4127
				"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + 
4128
				"----------\n":
4129
					"----------\n" + 
4130
					"1. ERROR in X.java (at line 2)\n" + 
4131
					"	<N extends B> N a(A<String> s) { return null; }\n" + 
4132
					"	                ^^^^^^^^^^^^^^\n" + 
4133
					"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + 
4134
					"----------\n" + 
4135
					"2. ERROR in X.java (at line 3)\n" + 
4136
					"	<N> Object a(A<Number> n) { return null; }\n" + 
4137
					"	           ^^^^^^^^^^^^^^\n" + 
4138
					"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + 
4139
					"----------\n" + 
4140
					"3. ERROR in X.java (at line 4)\n" + 
4141
					"	<N extends B> void b(A<String> s) {}\n" + 
4142
					"	                   ^^^^^^^^^^^^^^\n" + 
4143
					"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4144
					"----------\n" + 
4145
					"4. ERROR in X.java (at line 5)\n" + 
4146
					"	<N extends B> B b(A<Number> n) { return null; }\n" + 
4147
					"	                ^^^^^^^^^^^^^^\n" + 
4148
					"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4149
					"----------\n" + 
4150
					"5. ERROR in X.java (at line 6)\n" + 
4151
					"	void c(A<String> s) {}\n" + 
4152
					"	     ^^^^^^^^^^^^^^\n" + 
4153
					"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + 
4154
					"----------\n" + 
4155
					"6. ERROR in X.java (at line 7)\n" + 
4156
					"	B c(A<Number> n) { return null; }\n" + 
4157
					"	  ^^^^^^^^^^^^^^\n" + 
4158
					"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + 
4159
					"----------\n";
3924
		this.runNegativeTest(
4160
		this.runNegativeTest(
3925
			new String[] {
4161
			new String[] {
3926
				"X.java",
4162
				"X.java",
Lines 3935-3971 Link Here
3935
				"class A<T> {}\n" +
4171
				"class A<T> {}\n" +
3936
				"class B {}\n"
4172
				"class B {}\n"
3937
			},
4173
			},
3938
			"----------\n" + 
4174
			expectedCompilerLog
3939
			"1. ERROR in X.java (at line 2)\n" + 
3940
			"	<N extends B> N a(A<String> s) { return null; }\n" + 
3941
			"	                ^^^^^^^^^^^^^^\n" + 
3942
			"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + 
3943
			"----------\n" + 
3944
			"2. ERROR in X.java (at line 3)\n" + 
3945
			"	<N> Object a(A<Number> n) { return null; }\n" + 
3946
			"	           ^^^^^^^^^^^^^^\n" + 
3947
			"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + 
3948
			"----------\n" + 
3949
			"3. ERROR in X.java (at line 4)\n" + 
3950
			"	<N extends B> void b(A<String> s) {}\n" + 
3951
			"	                   ^^^^^^^^^^^^^^\n" + 
3952
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
3953
			"----------\n" + 
3954
			"4. ERROR in X.java (at line 5)\n" + 
3955
			"	<N extends B> B b(A<Number> n) { return null; }\n" + 
3956
			"	                ^^^^^^^^^^^^^^\n" + 
3957
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
3958
			"----------\n" + 
3959
			"5. ERROR in X.java (at line 6)\n" + 
3960
			"	void c(A<String> s) {}\n" + 
3961
			"	     ^^^^^^^^^^^^^^\n" + 
3962
			"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + 
3963
			"----------\n" + 
3964
			"6. ERROR in X.java (at line 7)\n" + 
3965
			"	B c(A<Number> n) { return null; }\n" + 
3966
			"	  ^^^^^^^^^^^^^^\n" + 
3967
			"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + 
3968
			"----------\n"
3969
		);
4175
		);
3970
/* javac 7
4176
/* javac 7
3971
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure
4177
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure
Lines 4088-4093 Link Here
4088
4294
4089
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4295
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4090
	public void test050i() {
4296
	public void test050i() {
4297
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4298
				"----------\n" + 
4299
				"1. WARNING in X.java (at line 2)\n" + 
4300
				"	<N extends B> N a(A<Number> s) { return null; }\n" + 
4301
				"	                ^^^^^^^^^^^^^^\n" + 
4302
				"Duplicate method a(A<Number>) in type X\n" + 
4303
				"----------\n" + 
4304
				"2. WARNING in X.java (at line 3)\n" + 
4305
				"	<N> Object a(A<Number> n) { return null; }\n" + 
4306
				"	           ^^^^^^^^^^^^^^\n" + 
4307
				"Duplicate method a(A<Number>) in type X\n" + 
4308
				"----------\n" + 
4309
				"3. WARNING in X.java (at line 4)\n" + 
4310
				"	<N extends B> N b(A<Number> s) { return null; }\n" + 
4311
				"	                ^^^^^^^^^^^^^^\n" + 
4312
				"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4313
				"----------\n" + 
4314
				"4. WARNING in X.java (at line 5)\n" + 
4315
				"	<N> Object b(A<String> n) { return null; }\n" + 
4316
				"	           ^^^^^^^^^^^^^^\n" + 
4317
				"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4318
				"----------\n":
4319
					"----------\n" + 
4320
					"1. ERROR in X.java (at line 2)\n" + 
4321
					"	<N extends B> N a(A<Number> s) { return null; }\n" + 
4322
					"	                ^^^^^^^^^^^^^^\n" + 
4323
					"Duplicate method a(A<Number>) in type X\n" + 
4324
					"----------\n" + 
4325
					"2. ERROR in X.java (at line 3)\n" + 
4326
					"	<N> Object a(A<Number> n) { return null; }\n" + 
4327
					"	           ^^^^^^^^^^^^^^\n" + 
4328
					"Duplicate method a(A<Number>) in type X\n" + 
4329
					"----------\n" + 
4330
					"3. ERROR in X.java (at line 4)\n" + 
4331
					"	<N extends B> N b(A<Number> s) { return null; }\n" + 
4332
					"	                ^^^^^^^^^^^^^^\n" + 
4333
					"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4334
					"----------\n" + 
4335
					"4. ERROR in X.java (at line 5)\n" + 
4336
					"	<N> Object b(A<String> n) { return null; }\n" + 
4337
					"	           ^^^^^^^^^^^^^^\n" + 
4338
					"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4339
					"----------\n";
4091
		this.runNegativeTest(
4340
		this.runNegativeTest(
4092
			new String[] {
4341
			new String[] {
4093
				"X.java",
4342
				"X.java",
Lines 4100-4126 Link Here
4100
				"class A<T> {}\n" +
4349
				"class A<T> {}\n" +
4101
				"class B {}\n"
4350
				"class B {}\n"
4102
			},
4351
			},
4103
			"----------\n" + 
4352
			expectedCompilerLog
4104
			"1. ERROR in X.java (at line 2)\n" + 
4105
			"	<N extends B> N a(A<Number> s) { return null; }\n" + 
4106
			"	                ^^^^^^^^^^^^^^\n" + 
4107
			"Duplicate method a(A<Number>) in type X\n" + 
4108
			"----------\n" + 
4109
			"2. ERROR in X.java (at line 3)\n" + 
4110
			"	<N> Object a(A<Number> n) { return null; }\n" + 
4111
			"	           ^^^^^^^^^^^^^^\n" + 
4112
			"Duplicate method a(A<Number>) in type X\n" + 
4113
			"----------\n" + 
4114
			"3. ERROR in X.java (at line 4)\n" + 
4115
			"	<N extends B> N b(A<Number> s) { return null; }\n" + 
4116
			"	                ^^^^^^^^^^^^^^\n" + 
4117
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4118
			"----------\n" + 
4119
			"4. ERROR in X.java (at line 5)\n" + 
4120
			"	<N> Object b(A<String> n) { return null; }\n" + 
4121
			"	           ^^^^^^^^^^^^^^\n" + 
4122
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4123
			"----------\n"
4124
		);
4353
		);
4125
/* javac 7
4354
/* javac 7
4126
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<Number>) have the same erasure
4355
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<Number>) have the same erasure
Lines 4192-4197 Link Here
4192
	}
4421
	}
4193
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4422
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4194
	public void test050k() {
4423
	public void test050k() {
4424
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4425
				"----------\n" + 
4426
				"1. WARNING in X.java (at line 2)\n" + 
4427
				"	<N extends B> void a(A<Number> s) {}\n" + 
4428
				"	                   ^^^^^^^^^^^^^^\n" + 
4429
				"Duplicate method a(A<Number>) in type X\n" + 
4430
				"----------\n" + 
4431
				"2. WARNING in X.java (at line 3)\n" + 
4432
				"	<N extends B> B a(A<Number> n) { return null; }\n" + 
4433
				"	                ^^^^^^^^^^^^^^\n" + 
4434
				"Duplicate method a(A<Number>) in type X\n" + 
4435
				"----------\n" + 
4436
				"3. WARNING in X.java (at line 4)\n" + 
4437
				"	<N extends B> Object b(A<Number> s) { return null; }\n" + 
4438
				"	                     ^^^^^^^^^^^^^^\n" + 
4439
				"Duplicate method b(A<Number>) in type X\n" + 
4440
				"----------\n" + 
4441
				"4. WARNING in X.java (at line 5)\n" + 
4442
				"	<N extends B> B b(A<Number> n) { return null; }\n" + 
4443
				"	                ^^^^^^^^^^^^^^\n" + 
4444
				"Duplicate method b(A<Number>) in type X\n" + 
4445
				"----------\n":
4446
					"----------\n" +
4447
					"1. ERROR in X.java (at line 2)\n" +
4448
					"	<N extends B> void a(A<Number> s) {}\n" +
4449
					"	                   ^^^^^^^^^^^^^^\n" +
4450
					"Duplicate method a(A<Number>) in type X\n" +
4451
					"----------\n" +
4452
					"2. ERROR in X.java (at line 3)\n" +
4453
					"	<N extends B> B a(A<Number> n) { return null; }\n" +
4454
					"	                ^^^^^^^^^^^^^^\n" +
4455
					"Duplicate method a(A<Number>) in type X\n" +
4456
					"----------\n" +
4457
					"3. ERROR in X.java (at line 4)\n" +
4458
					"	<N extends B> Object b(A<Number> s) { return null; }\n" +
4459
					"	                     ^^^^^^^^^^^^^^\n" +
4460
					"Duplicate method b(A<Number>) in type X\n" +
4461
					"----------\n" +
4462
					"4. ERROR in X.java (at line 5)\n" +
4463
					"	<N extends B> B b(A<Number> n) { return null; }\n" +
4464
					"	                ^^^^^^^^^^^^^^\n" +
4465
					"Duplicate method b(A<Number>) in type X\n" +
4466
					"----------\n";
4195
		this.runNegativeTest(
4467
		this.runNegativeTest(
4196
			new String[] {
4468
			new String[] {
4197
				"X.java",
4469
				"X.java",
Lines 4204-4230 Link Here
4204
				"class A<T> {}\n" +
4476
				"class A<T> {}\n" +
4205
				"class B {}\n"
4477
				"class B {}\n"
4206
			},
4478
			},
4207
			"----------\n" +
4479
			expectedCompilerLog
4208
			"1. ERROR in X.java (at line 2)\n" +
4209
			"	<N extends B> void a(A<Number> s) {}\n" +
4210
			"	                   ^^^^^^^^^^^^^^\n" +
4211
			"Duplicate method a(A<Number>) in type X\n" +
4212
			"----------\n" +
4213
			"2. ERROR in X.java (at line 3)\n" +
4214
			"	<N extends B> B a(A<Number> n) { return null; }\n" +
4215
			"	                ^^^^^^^^^^^^^^\n" +
4216
			"Duplicate method a(A<Number>) in type X\n" +
4217
			"----------\n" +
4218
			"3. ERROR in X.java (at line 4)\n" +
4219
			"	<N extends B> Object b(A<Number> s) { return null; }\n" +
4220
			"	                     ^^^^^^^^^^^^^^\n" +
4221
			"Duplicate method b(A<Number>) in type X\n" +
4222
			"----------\n" +
4223
			"4. ERROR in X.java (at line 5)\n" +
4224
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
4225
			"	                ^^^^^^^^^^^^^^\n" +
4226
			"Duplicate method b(A<Number>) in type X\n" +
4227
			"----------\n"
4228
		);
4480
		);
4229
/* javac 7
4481
/* javac 7
4230
X.java:3: <N>a(A<Number>) is already defined in X
4482
X.java:3: <N>a(A<Number>) is already defined in X
Lines 4242-4247 Link Here
4242
	}
4494
	}
4243
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4495
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
4244
	public void test050l() {
4496
	public void test050l() {
4497
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4498
				"----------\n" + 
4499
				"1. WARNING in X.java (at line 2)\n" + 
4500
				"	void a(A<Number> s) {}\n" + 
4501
				"	     ^^^^^^^^^^^^^^\n" + 
4502
				"Duplicate method a(A<Number>) in type X\n" + 
4503
				"----------\n" + 
4504
				"2. WARNING in X.java (at line 3)\n" + 
4505
				"	B a(A<Number> n) { return null; }\n" + 
4506
				"	  ^^^^^^^^^^^^^^\n" + 
4507
				"Duplicate method a(A<Number>) in type X\n" + 
4508
				"----------\n" + 
4509
				"3. WARNING in X.java (at line 4)\n" + 
4510
				"	Object b(A<Number> s) {}\n" + 
4511
				"	       ^^^^^^^^^^^^^^\n" + 
4512
				"Duplicate method b(A<Number>) in type X\n" + 
4513
				"----------\n" + 
4514
				"4. ERROR in X.java (at line 4)\n" + 
4515
				"	Object b(A<Number> s) {}\n" + 
4516
				"	       ^^^^^^^^^^^^^^\n" + 
4517
				"This method must return a result of type Object\n" + 
4518
				"----------\n" + 
4519
				"5. WARNING in X.java (at line 5)\n" + 
4520
				"	B b(A<Number> n) { return null; }\n" + 
4521
				"	  ^^^^^^^^^^^^^^\n" + 
4522
				"Duplicate method b(A<Number>) in type X\n" + 
4523
				"----------\n":
4524
					"----------\n" + 
4525
					"1. ERROR in X.java (at line 2)\n" + 
4526
					"	void a(A<Number> s) {}\n" + 
4527
					"	     ^^^^^^^^^^^^^^\n" + 
4528
					"Duplicate method a(A<Number>) in type X\n" + 
4529
					"----------\n" + 
4530
					"2. ERROR in X.java (at line 3)\n" + 
4531
					"	B a(A<Number> n) { return null; }\n" + 
4532
					"	  ^^^^^^^^^^^^^^\n" + 
4533
					"Duplicate method a(A<Number>) in type X\n" + 
4534
					"----------\n" + 
4535
					"3. ERROR in X.java (at line 4)\n" + 
4536
					"	Object b(A<Number> s) {}\n" + 
4537
					"	       ^^^^^^^^^^^^^^\n" + 
4538
					"Duplicate method b(A<Number>) in type X\n" + 
4539
					"----------\n" + 
4540
					"4. ERROR in X.java (at line 4)\n" + 
4541
					"	Object b(A<Number> s) {}\n" + 
4542
					"	       ^^^^^^^^^^^^^^\n" + 
4543
					"This method must return a result of type Object\n" + 
4544
					"----------\n" + 
4545
					"5. ERROR in X.java (at line 5)\n" + 
4546
					"	B b(A<Number> n) { return null; }\n" + 
4547
					"	  ^^^^^^^^^^^^^^\n" + 
4548
					"Duplicate method b(A<Number>) in type X\n" + 
4549
					"----------\n";
4245
		this.runNegativeTest(
4550
		this.runNegativeTest(
4246
			new String[] {
4551
			new String[] {
4247
				"X.java",
4552
				"X.java",
Lines 4254-4280 Link Here
4254
				"class A<T> {}\n" +
4559
				"class A<T> {}\n" +
4255
				"class B {}\n"
4560
				"class B {}\n"
4256
			},
4561
			},
4257
			"----------\n" +
4562
			expectedCompilerLog
4258
			"1. ERROR in X.java (at line 2)\n" +
4259
			"	void a(A<Number> s) {}\n" +
4260
			"	     ^^^^^^^^^^^^^^\n" +
4261
			"Duplicate method a(A<Number>) in type X\n" +
4262
			"----------\n" +
4263
			"2. ERROR in X.java (at line 3)\n" +
4264
			"	B a(A<Number> n) { return null; }\n" +
4265
			"	  ^^^^^^^^^^^^^^\n" +
4266
			"Duplicate method a(A<Number>) in type X\n" +
4267
			"----------\n" +
4268
			"3. ERROR in X.java (at line 4)\n" +
4269
			"	Object b(A<Number> s) {}\n" +
4270
			"	       ^^^^^^^^^^^^^^\n" +
4271
			"Duplicate method b(A<Number>) in type X\n" +
4272
			"----------\n" +
4273
			"4. ERROR in X.java (at line 5)\n" +
4274
			"	B b(A<Number> n) { return null; }\n" +
4275
			"	  ^^^^^^^^^^^^^^\n" +
4276
			"Duplicate method b(A<Number>) in type X\n" +
4277
			"----------\n"
4278
		);
4563
		);
4279
/* javac 7
4564
/* javac 7
4280
X.java:3: a(A<Number>) is already defined in X
4565
X.java:3: a(A<Number>) is already defined in X
Lines 4347-4352 Link Here
4347
	}
4632
	}
4348
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470
4633
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470
4349
	public void test051b() {
4634
	public void test051b() {
4635
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4636
				"----------\n" + 
4637
				"1. WARNING in X.java (at line 2)\n" + 
4638
				"	void foo(A<String> a) {}\n" + 
4639
				"	     ^^^^^^^^^^^^^^^^\n" + 
4640
				"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
4641
				"----------\n" + 
4642
				"2. WARNING in X.java (at line 3)\n" + 
4643
				"	Object foo(A<Integer> a) { return null; }\n" + 
4644
				"	       ^^^^^^^^^^^^^^^^^\n" + 
4645
				"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
4646
				"----------\n":
4647
					"----------\n" + 
4648
					"1. ERROR in X.java (at line 2)\n" + 
4649
					"	void foo(A<String> a) {}\n" + 
4650
					"	     ^^^^^^^^^^^^^^^^\n" + 
4651
					"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
4652
					"----------\n" + 
4653
					"2. ERROR in X.java (at line 3)\n" + 
4654
					"	Object foo(A<Integer> a) { return null; }\n" + 
4655
					"	       ^^^^^^^^^^^^^^^^^\n" + 
4656
					"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
4657
					"----------\n";
4350
		this.runNegativeTest(
4658
		this.runNegativeTest(
4351
			new String[] {
4659
			new String[] {
4352
				"X.java",
4660
				"X.java",
Lines 4356-4372 Link Here
4356
				"}\n" +
4664
				"}\n" +
4357
				"class A<T> {}\n",
4665
				"class A<T> {}\n",
4358
			},
4666
			},
4359
			"----------\n" + 
4667
			expectedCompilerLog
4360
			"1. ERROR in X.java (at line 2)\n" + 
4361
			"	void foo(A<String> a) {}\n" + 
4362
			"	     ^^^^^^^^^^^^^^^^\n" + 
4363
			"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + 
4364
			"----------\n" + 
4365
			"2. ERROR in X.java (at line 3)\n" + 
4366
			"	Object foo(A<Integer> a) { return null; }\n" + 
4367
			"	       ^^^^^^^^^^^^^^^^^\n" + 
4368
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + 
4369
			"----------\n"
4370
		);
4668
		);
4371
/* javac 7
4669
/* javac 7
4372
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure
4670
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure
Lines 4489-4494 Link Here
4489
4787
4490
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4788
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4491
	public void test054() {
4789
	public void test054() {
4790
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4791
				"----------\n" + 
4792
				"1. WARNING in X.java (at line 2)\n" + 
4793
				"	void a(Object x) {}\n" + 
4794
				"	     ^^^^^^^^^^^\n" + 
4795
				"Method a(Object) has the same erasure a(Object) as another method in type X\n" + 
4796
				"----------\n" + 
4797
				"2. WARNING in X.java (at line 3)\n" + 
4798
				"	<T> T a(T x) {  return null; }\n" + 
4799
				"	      ^^^^^^\n" + 
4800
				"Method a(T) has the same erasure a(Object) as another method in type X\n" + 
4801
				"----------\n":
4802
					"----------\n" +
4803
					"1. ERROR in X.java (at line 2)\n" +
4804
					"	void a(Object x) {}\n" +
4805
					"	     ^^^^^^^^^^^\n" +
4806
					"Method a(Object) has the same erasure a(Object) as another method in type X\n" +
4807
					"----------\n" +
4808
					"2. ERROR in X.java (at line 3)\n" +
4809
					"	<T> T a(T x) {  return null; }\n" +
4810
					"	      ^^^^^^\n" +
4811
					"Method a(T) has the same erasure a(Object) as another method in type X\n" +
4812
					"----------\n";
4492
		this.runNegativeTest(
4813
		this.runNegativeTest(
4493
			new String[] {
4814
			new String[] {
4494
				"X.java",
4815
				"X.java",
Lines 4497-4513 Link Here
4497
				"	<T> T a(T x) {  return null; }\n" +
4818
				"	<T> T a(T x) {  return null; }\n" +
4498
				"}\n"
4819
				"}\n"
4499
			},
4820
			},
4500
			"----------\n" +
4821
			expectedCompilerLog
4501
			"1. ERROR in X.java (at line 2)\n" +
4502
			"	void a(Object x) {}\n" +
4503
			"	     ^^^^^^^^^^^\n" +
4504
			"Method a(Object) has the same erasure a(Object) as another method in type X\n" +
4505
			"----------\n" +
4506
			"2. ERROR in X.java (at line 3)\n" +
4507
			"	<T> T a(T x) {  return null; }\n" +
4508
			"	      ^^^^^^\n" +
4509
			"Method a(T) has the same erasure a(Object) as another method in type X\n" +
4510
			"----------\n"
4511
		);
4822
		);
4512
/* javac 7
4823
/* javac 7
4513
X.java:3: a(Object) is already defined in X
4824
X.java:3: a(Object) is already defined in X
Lines 4518-4523 Link Here
4518
	}
4829
	}
4519
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4830
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4520
	public void test054a() {
4831
	public void test054a() {
4832
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4833
				"----------\n" + 
4834
				"1. WARNING in X.java (at line 2)\n" + 
4835
				"	<T1, T2> String aaa(X x) {  return null; }\n" + 
4836
				"	                ^^^^^^^^\n" + 
4837
				"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + 
4838
				"----------\n" + 
4839
				"2. WARNING in X.java (at line 3)\n" + 
4840
				"	<T extends X> T aaa(T x) {  return null; }\n" + 
4841
				"	                ^^^^^^^^\n" + 
4842
				"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + 
4843
				"----------\n" + 
4844
				"3. WARNING in X.java (at line 4)\n" + 
4845
				"	<T> String aa(X x) {  return null; }\n" + 
4846
				"	           ^^^^^^^\n" + 
4847
				"Method aa(X) has the same erasure aa(X) as another method in type X\n" + 
4848
				"----------\n" + 
4849
				"4. WARNING in X.java (at line 5)\n" + 
4850
				"	<T extends X> T aa(T x) {  return null; }\n" + 
4851
				"	                ^^^^^^^\n" + 
4852
				"Method aa(T) has the same erasure aa(X) as another method in type X\n" + 
4853
				"----------\n" + 
4854
				"5. WARNING in X.java (at line 6)\n" + 
4855
				"	String a(X x) {  return null; }\n" + 
4856
				"	       ^^^^^^\n" + 
4857
				"Method a(X) has the same erasure a(X) as another method in type X\n" + 
4858
				"----------\n" + 
4859
				"6. WARNING in X.java (at line 7)\n" + 
4860
				"	<T extends X> T a(T x) {  return null; }\n" + 
4861
				"	                ^^^^^^\n" + 
4862
				"Method a(T) has the same erasure a(X) as another method in type X\n" + 
4863
				"----------\n" + 
4864
				"7. WARNING in X.java (at line 8)\n" + 
4865
				"	<T> String z(X x) { return null; }\n" + 
4866
				"	           ^^^^^^\n" + 
4867
				"Duplicate method z(X) in type X\n" + 
4868
				"----------\n" + 
4869
				"8. WARNING in X.java (at line 9)\n" + 
4870
				"	<T, S> Object z(X x) { return null; }\n" + 
4871
				"	              ^^^^^^\n" + 
4872
				"Duplicate method z(X) in type X\n" + 
4873
				"----------\n":
4874
					"----------\n" + 
4875
					"1. ERROR in X.java (at line 2)\n" + 
4876
					"	<T1, T2> String aaa(X x) {  return null; }\n" + 
4877
					"	                ^^^^^^^^\n" + 
4878
					"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + 
4879
					"----------\n" + 
4880
					"2. ERROR in X.java (at line 3)\n" + 
4881
					"	<T extends X> T aaa(T x) {  return null; }\n" + 
4882
					"	                ^^^^^^^^\n" + 
4883
					"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + 
4884
					"----------\n" + 
4885
					"3. ERROR in X.java (at line 4)\n" + 
4886
					"	<T> String aa(X x) {  return null; }\n" + 
4887
					"	           ^^^^^^^\n" + 
4888
					"Method aa(X) has the same erasure aa(X) as another method in type X\n" + 
4889
					"----------\n" + 
4890
					"4. ERROR in X.java (at line 5)\n" + 
4891
					"	<T extends X> T aa(T x) {  return null; }\n" + 
4892
					"	                ^^^^^^^\n" + 
4893
					"Method aa(T) has the same erasure aa(X) as another method in type X\n" + 
4894
					"----------\n" + 
4895
					"5. ERROR in X.java (at line 6)\n" + 
4896
					"	String a(X x) {  return null; }\n" + 
4897
					"	       ^^^^^^\n" + 
4898
					"Method a(X) has the same erasure a(X) as another method in type X\n" + 
4899
					"----------\n" + 
4900
					"6. ERROR in X.java (at line 7)\n" + 
4901
					"	<T extends X> T a(T x) {  return null; }\n" + 
4902
					"	                ^^^^^^\n" + 
4903
					"Method a(T) has the same erasure a(X) as another method in type X\n" + 
4904
					"----------\n" + 
4905
					"7. ERROR in X.java (at line 8)\n" + 
4906
					"	<T> String z(X x) { return null; }\n" + 
4907
					"	           ^^^^^^\n" + 
4908
					"Duplicate method z(X) in type X\n" + 
4909
					"----------\n" + 
4910
					"8. ERROR in X.java (at line 9)\n" + 
4911
					"	<T, S> Object z(X x) { return null; }\n" + 
4912
					"	              ^^^^^^\n" + 
4913
					"Duplicate method z(X) in type X\n" + 
4914
					"----------\n";
4521
		this.runNegativeTest(
4915
		this.runNegativeTest(
4522
			new String[] {
4916
			new String[] {
4523
				"X.java",
4917
				"X.java",
Lines 4532-4578 Link Here
4532
				"	<T, S> Object z(X x) { return null; }\n" +
4926
				"	<T, S> Object z(X x) { return null; }\n" +
4533
				"}\n"
4927
				"}\n"
4534
			},
4928
			},
4535
			"----------\n" + 
4929
			expectedCompilerLog
4536
			"1. ERROR in X.java (at line 2)\n" + 
4537
			"	<T1, T2> String aaa(X x) {  return null; }\n" + 
4538
			"	                ^^^^^^^^\n" + 
4539
			"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + 
4540
			"----------\n" + 
4541
			"2. ERROR in X.java (at line 3)\n" + 
4542
			"	<T extends X> T aaa(T x) {  return null; }\n" + 
4543
			"	                ^^^^^^^^\n" + 
4544
			"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + 
4545
			"----------\n" + 
4546
			"3. ERROR in X.java (at line 4)\n" + 
4547
			"	<T> String aa(X x) {  return null; }\n" + 
4548
			"	           ^^^^^^^\n" + 
4549
			"Method aa(X) has the same erasure aa(X) as another method in type X\n" + 
4550
			"----------\n" + 
4551
			"4. ERROR in X.java (at line 5)\n" + 
4552
			"	<T extends X> T aa(T x) {  return null; }\n" + 
4553
			"	                ^^^^^^^\n" + 
4554
			"Method aa(T) has the same erasure aa(X) as another method in type X\n" + 
4555
			"----------\n" + 
4556
			"5. ERROR in X.java (at line 6)\n" + 
4557
			"	String a(X x) {  return null; }\n" + 
4558
			"	       ^^^^^^\n" + 
4559
			"Method a(X) has the same erasure a(X) as another method in type X\n" + 
4560
			"----------\n" + 
4561
			"6. ERROR in X.java (at line 7)\n" + 
4562
			"	<T extends X> T a(T x) {  return null; }\n" + 
4563
			"	                ^^^^^^\n" + 
4564
			"Method a(T) has the same erasure a(X) as another method in type X\n" + 
4565
			"----------\n" + 
4566
			"7. ERROR in X.java (at line 8)\n" + 
4567
			"	<T> String z(X x) { return null; }\n" + 
4568
			"	           ^^^^^^\n" + 
4569
			"Duplicate method z(X) in type X\n" + 
4570
			"----------\n" + 
4571
			"8. ERROR in X.java (at line 9)\n" + 
4572
			"	<T, S> Object z(X x) { return null; }\n" + 
4573
			"	              ^^^^^^\n" + 
4574
			"Duplicate method z(X) in type X\n" + 
4575
			"----------\n"
4576
		);
4930
		);
4577
/* javac 7
4931
/* javac 7
4578
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure
4932
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure
Lines 4603-4608 Link Here
4603
	}
4957
	}
4604
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4958
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4605
	public void test054b() {
4959
	public void test054b() {
4960
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4961
				"----------\n" + 
4962
				"1. WARNING in X.java (at line 2)\n" + 
4963
				"	Object foo(X<T> t) { return null; }\n" + 
4964
				"	       ^^^^^^^^^^^\n" + 
4965
				"Duplicate method foo(X<T>) in type X<T>\n" + 
4966
				"----------\n" + 
4967
				"2. WARNING in X.java (at line 3)\n" + 
4968
				"	<S> String foo(X<T> s) { return null; }\n" + 
4969
				"	           ^^^^^^^^^^^\n" + 
4970
				"Duplicate method foo(X<T>) in type X<T>\n" + 
4971
				"----------\n":
4972
					"----------\n" + 
4973
					"1. ERROR in X.java (at line 2)\n" + 
4974
					"	Object foo(X<T> t) { return null; }\n" + 
4975
					"	       ^^^^^^^^^^^\n" + 
4976
					"Duplicate method foo(X<T>) in type X<T>\n" + 
4977
					"----------\n" + 
4978
					"2. ERROR in X.java (at line 3)\n" + 
4979
					"	<S> String foo(X<T> s) { return null; }\n" + 
4980
					"	           ^^^^^^^^^^^\n" + 
4981
					"Duplicate method foo(X<T>) in type X<T>\n" + 
4982
					"----------\n";
4606
		this.runNegativeTest(
4983
		this.runNegativeTest(
4607
			new String[] {
4984
			new String[] {
4608
				"X.java",
4985
				"X.java",
Lines 4611-4627 Link Here
4611
				"		 <S> String foo(X<T> s) { return null; }\n" +
4988
				"		 <S> String foo(X<T> s) { return null; }\n" +
4612
				"}\n"
4989
				"}\n"
4613
			},
4990
			},
4614
			"----------\n" + 
4991
			expectedCompilerLog
4615
			"1. ERROR in X.java (at line 2)\n" + 
4616
			"	Object foo(X<T> t) { return null; }\n" + 
4617
			"	       ^^^^^^^^^^^\n" + 
4618
			"Duplicate method foo(X<T>) in type X<T>\n" + 
4619
			"----------\n" + 
4620
			"2. ERROR in X.java (at line 3)\n" + 
4621
			"	<S> String foo(X<T> s) { return null; }\n" + 
4622
			"	           ^^^^^^^^^^^\n" + 
4623
			"Duplicate method foo(X<T>) in type X<T>\n" + 
4624
			"----------\n"
4625
		);
4992
		);
4626
/* javac 7
4993
/* javac 7
4627
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure
4994
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure
Lines 4635-4640 Link Here
4635
	}
5002
	}
4636
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
5003
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4637
	public void test054c() {
5004
	public void test054c() {
5005
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
5006
				"----------\n" + 
5007
				"1. WARNING in X.java (at line 2)\n" + 
5008
				"	<T1 extends X<T1>> void dupT() {}\n" + 
5009
				"	                        ^^^^^^\n" + 
5010
				"Duplicate method dupT() in type X<T>\n" + 
5011
				"----------\n" + 
5012
				"2. WARNING in X.java (at line 3)\n" + 
5013
				"	<T2 extends X<T2>> Object dupT() {return null;}\n" + 
5014
				"	                          ^^^^^^\n" + 
5015
				"Duplicate method dupT() in type X<T>\n" + 
5016
				"----------\n":
5017
					"----------\n" +
5018
					"1. ERROR in X.java (at line 2)\n" +
5019
					"	<T1 extends X<T1>> void dupT() {}\n" +
5020
					"	                        ^^^^^^\n" +
5021
					"Duplicate method dupT() in type X<T>\n" +
5022
					"----------\n" +
5023
					"2. ERROR in X.java (at line 3)\n" +
5024
					"	<T2 extends X<T2>> Object dupT() {return null;}\n" +
5025
					"	                          ^^^^^^\n" +
5026
					"Duplicate method dupT() in type X<T>\n" +
5027
					"----------\n";
4638
		this.runNegativeTest(
5028
		this.runNegativeTest(
4639
			new String[] {
5029
			new String[] {
4640
				"X.java",
5030
				"X.java",
Lines 4643-4659 Link Here
4643
				"		<T2 extends X<T2>> Object dupT() {return null;}\n" +
5033
				"		<T2 extends X<T2>> Object dupT() {return null;}\n" +
4644
				"}\n"
5034
				"}\n"
4645
			},
5035
			},
4646
			"----------\n" +
5036
			expectedCompilerLog
4647
			"1. ERROR in X.java (at line 2)\n" +
4648
			"	<T1 extends X<T1>> void dupT() {}\n" +
4649
			"	                        ^^^^^^\n" +
4650
			"Duplicate method dupT() in type X<T>\n" +
4651
			"----------\n" +
4652
			"2. ERROR in X.java (at line 3)\n" +
4653
			"	<T2 extends X<T2>> Object dupT() {return null;}\n" +
4654
			"	                          ^^^^^^\n" +
4655
			"Duplicate method dupT() in type X<T>\n" +
4656
			"----------\n"
4657
		);
5037
		);
4658
/* javac 7
5038
/* javac 7
4659
X.java:3: <T1>dupT() is already defined in X
5039
X.java:3: <T1>dupT() is already defined in X
Lines 4666-4671 Link Here
4666
	}
5046
	}
4667
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
5047
	// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897
4668
	public void test054d() {
5048
	public void test054d() {
5049
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
5050
				"----------\n" + 
5051
				"1. WARNING in X.java (at line 2)\n" + 
5052
				"	<T> T a(A<T> t) {return null;}\n" + 
5053
				"	      ^^^^^^^^^\n" + 
5054
				"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + 
5055
				"----------\n" + 
5056
				"2. WARNING in X.java (at line 3)\n" + 
5057
				"	<T> String a(A<Object> o) {return null;}\n" + 
5058
				"	           ^^^^^^^^^^^^^^\n" + 
5059
				"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + 
5060
				"----------\n" + 
5061
				"3. WARNING in X.java (at line 4)\n" + 
5062
				"	<T> T aa(A<T> t) {return null;}\n" + 
5063
				"	      ^^^^^^^^^^\n" + 
5064
				"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + 
5065
				"----------\n" + 
5066
				"4. WARNING in X.java (at line 5)\n" + 
5067
				"	String aa(A<Object> o) {return null;}\n" + 
5068
				"	       ^^^^^^^^^^^^^^^\n" + 
5069
				"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + 
5070
				"----------\n":
5071
					"----------\n" + 
5072
					"1. ERROR in X.java (at line 2)\n" + 
5073
					"	<T> T a(A<T> t) {return null;}\n" + 
5074
					"	      ^^^^^^^^^\n" + 
5075
					"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + 
5076
					"----------\n" + 
5077
					"2. ERROR in X.java (at line 3)\n" + 
5078
					"	<T> String a(A<Object> o) {return null;}\n" + 
5079
					"	           ^^^^^^^^^^^^^^\n" + 
5080
					"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + 
5081
					"----------\n" + 
5082
					"3. ERROR in X.java (at line 4)\n" + 
5083
					"	<T> T aa(A<T> t) {return null;}\n" + 
5084
					"	      ^^^^^^^^^^\n" + 
5085
					"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + 
5086
					"----------\n" + 
5087
					"4. ERROR in X.java (at line 5)\n" + 
5088
					"	String aa(A<Object> o) {return null;}\n" + 
5089
					"	       ^^^^^^^^^^^^^^^\n" + 
5090
					"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + 
5091
					"----------\n";
4669
		this.runNegativeTest(
5092
		this.runNegativeTest(
4670
			new String[] {
5093
			new String[] {
4671
				"X.java",
5094
				"X.java",
Lines 4677-4703 Link Here
4677
				"}\n" +
5100
				"}\n" +
4678
				"class A<T> {}\n",
5101
				"class A<T> {}\n",
4679
			},
5102
			},
4680
			"----------\n" + 
5103
			expectedCompilerLog
4681
			"1. ERROR in X.java (at line 2)\n" + 
4682
			"	<T> T a(A<T> t) {return null;}\n" + 
4683
			"	      ^^^^^^^^^\n" + 
4684
			"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + 
4685
			"----------\n" + 
4686
			"2. ERROR in X.java (at line 3)\n" + 
4687
			"	<T> String a(A<Object> o) {return null;}\n" + 
4688
			"	           ^^^^^^^^^^^^^^\n" + 
4689
			"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + 
4690
			"----------\n" + 
4691
			"3. ERROR in X.java (at line 4)\n" + 
4692
			"	<T> T aa(A<T> t) {return null;}\n" + 
4693
			"	      ^^^^^^^^^^\n" + 
4694
			"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + 
4695
			"----------\n" + 
4696
			"4. ERROR in X.java (at line 5)\n" + 
4697
			"	String aa(A<Object> o) {return null;}\n" + 
4698
			"	       ^^^^^^^^^^^^^^^\n" + 
4699
			"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + 
4700
			"----------\n"
4701
		);
5104
		);
4702
/* javac 7
5105
/* javac 7
4703
X.java:3: name clash: <T#1>a(A<Object>) and <T#2>a(A<T#2>) have the same erasure
5106
X.java:3: name clash: <T#1>a(A<Object>) and <T#2>a(A<T#2>) have the same erasure
Lines 4821-4826 Link Here
4821
	}
5224
	}
4822
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898
5225
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898
4823
	public void test058a() {
5226
	public void test058a() {
5227
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
5228
				"----------\n" + 
5229
				"1. ERROR in X.java (at line 3)\n" + 
5230
				"	new X<Object>().foo(\"X\");\n" + 
5231
				"	                ^^^\n" + 
5232
				"The method foo(String) is ambiguous for the type X<Object>\n" + 
5233
				"----------\n" + 
5234
				"2. ERROR in X.java (at line 4)\n" + 
5235
				"	new X<Object>().foo2(\"X\");\n" + 
5236
				"	                ^^^^\n" + 
5237
				"The method foo2(String) is ambiguous for the type X<Object>\n" + 
5238
				"----------\n" + 
5239
				"3. WARNING in X.java (at line 6)\n" + 
5240
				"	<T> T foo(T t) {return null;}\n" + 
5241
				"	      ^^^^^^^^\n" + 
5242
				"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + 
5243
				"----------\n" + 
5244
				"4. WARNING in X.java (at line 7)\n" + 
5245
				"	void foo(A a) {}\n" + 
5246
				"	     ^^^^^^^^\n" + 
5247
				"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + 
5248
				"----------\n" + 
5249
				"5. WARNING in X.java (at line 8)\n" + 
5250
				"	<T> T foo2(T t) {return null;}\n" + 
5251
				"	      ^^^^^^^^^\n" + 
5252
				"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + 
5253
				"----------\n" + 
5254
				"6. WARNING in X.java (at line 9)\n" + 
5255
				"	<T> void foo2(A a) {}\n" + 
5256
				"	         ^^^^^^^^^\n" + 
5257
				"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + 
5258
				"----------\n":
5259
					"----------\n" + 
5260
					"1. ERROR in X.java (at line 6)\n" + 
5261
					"	<T> T foo(T t) {return null;}\n" + 
5262
					"	      ^^^^^^^^\n" + 
5263
					"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + 
5264
					"----------\n" + 
5265
					"2. ERROR in X.java (at line 7)\n" + 
5266
					"	void foo(A a) {}\n" + 
5267
					"	     ^^^^^^^^\n" + 
5268
					"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + 
5269
					"----------\n" + 
5270
					"3. ERROR in X.java (at line 8)\n" + 
5271
					"	<T> T foo2(T t) {return null;}\n" + 
5272
					"	      ^^^^^^^^^\n" + 
5273
					"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + 
5274
					"----------\n" + 
5275
					"4. ERROR in X.java (at line 9)\n" + 
5276
					"	<T> void foo2(A a) {}\n" + 
5277
					"	         ^^^^^^^^^\n" + 
5278
					"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + 
5279
					"----------\n";
4824
		this.runNegativeTest(
5280
		this.runNegativeTest(
4825
			new String[] {
5281
			new String[] {
4826
				"X.java",
5282
				"X.java",
Lines 4835-4861 Link Here
4835
				"	<T> void foo2(A a) {}\n" +
5291
				"	<T> void foo2(A a) {}\n" +
4836
				"}\n"
5292
				"}\n"
4837
			},
5293
			},
4838
			"----------\n" + 
5294
			expectedCompilerLog
4839
			"1. ERROR in X.java (at line 6)\n" + 
4840
			"	<T> T foo(T t) {return null;}\n" + 
4841
			"	      ^^^^^^^^\n" + 
4842
			"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + 
4843
			"----------\n" + 
4844
			"2. ERROR in X.java (at line 7)\n" + 
4845
			"	void foo(A a) {}\n" + 
4846
			"	     ^^^^^^^^\n" + 
4847
			"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + 
4848
			"----------\n" + 
4849
			"3. ERROR in X.java (at line 8)\n" + 
4850
			"	<T> T foo2(T t) {return null;}\n" + 
4851
			"	      ^^^^^^^^^\n" + 
4852
			"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + 
4853
			"----------\n" + 
4854
			"4. ERROR in X.java (at line 9)\n" + 
4855
			"	<T> void foo2(A a) {}\n" + 
4856
			"	         ^^^^^^^^^\n" + 
4857
			"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + 
4858
			"----------\n"
4859
		);
5295
		);
4860
/* javac 7
5296
/* javac 7
4861
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure
5297
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure
Lines 4876-4881 Link Here
4876
	}
5312
	}
4877
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898
5313
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898
4878
	public void test058b() {
5314
	public void test058b() {
5315
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
5316
				"----------\n" + 
5317
				"1. ERROR in X.java (at line 3)\n" + 
5318
				"	new X<Object>().foo(\"X\");\n" + 
5319
				"	                ^^^\n" + 
5320
				"The method foo(String) is ambiguous for the type X<Object>\n" + 
5321
				"----------\n" + 
5322
				"2. ERROR in X.java (at line 4)\n" + 
5323
				"	new X<Object>().foo2(\"X\");\n" + 
5324
				"	                ^^^^\n" + 
5325
				"The method foo2(String) is ambiguous for the type X<Object>\n" + 
5326
				"----------\n" + 
5327
				"3. WARNING in X.java (at line 6)\n" + 
5328
				"	<T> T foo(T t) {return null;}\n" + 
5329
				"	      ^^^^^^^^\n" + 
5330
				"Name clash: The method foo(T) of type X<A> has the same erasure as foo(A) of type Y<A> but does not override it\n" + 
5331
				"----------\n" + 
5332
				"4. WARNING in X.java (at line 7)\n" + 
5333
				"	<T> T foo2(T t) {return null;}\n" + 
5334
				"	      ^^^^^^^^^\n" + 
5335
				"Name clash: The method foo2(T) of type X<A> has the same erasure as foo2(A) of type Y<A> but does not override it\n" + 
5336
				"----------\n":
5337
					"----------\n" +
5338
					"1. ERROR in X.java (at line 3)\n" + 
5339
					"	new X<Object>().foo(\"X\");\n" + 
5340
					"	                ^^^\n" + 
5341
					"The method foo(String) is ambiguous for the type X<Object>\n" + 
5342
					"----------\n" + 
5343
					"2. ERROR in X.java (at line 4)\n" + 
5344
					"	new X<Object>().foo2(\"X\");\n" + 
5345
					"	                ^^^^\n" + 
5346
					"The method foo2(String) is ambiguous for the type X<Object>\n" + 
5347
					"----------\n" + 
5348
					"3. ERROR in X.java (at line 6)\n" + 
5349
					"	<T> T foo(T t) {return null;}\n" + 
5350
					"	      ^^^^^^^^\n" + 
5351
					"Name clash: The method foo(T) of type X<A> has the same erasure as foo(A) of type Y<A> but does not override it\n" + 
5352
					"----------\n" + 
5353
					"4. ERROR in X.java (at line 7)\n" + 
5354
					"	<T> T foo2(T t) {return null;}\n" + 
5355
					"	      ^^^^^^^^^\n" + 
5356
					"Name clash: The method foo2(T) of type X<A> has the same erasure as foo2(A) of type Y<A> but does not override it\n" + 
5357
					"----------\n";
4879
		this.runNegativeTest(
5358
		this.runNegativeTest(
4880
			new String[] {
5359
			new String[] {
4881
				"X.java",
5360
				"X.java",
Lines 4892-4918 Link Here
4892
				"	<T> void foo2(A a) {}\n" +
5371
				"	<T> void foo2(A a) {}\n" +
4893
				"}"
5372
				"}"
4894
			},
5373
			},
4895
			"----------\n" +
5374
			expectedCompilerLog
4896
			"1. ERROR in X.java (at line 3)\n" + 
4897
			"	new X<Object>().foo(\"X\");\n" + 
4898
			"	                ^^^\n" + 
4899
			"The method foo(String) is ambiguous for the type X<Object>\n" + 
4900
			"----------\n" + 
4901
			"2. ERROR in X.java (at line 4)\n" + 
4902
			"	new X<Object>().foo2(\"X\");\n" + 
4903
			"	                ^^^^\n" + 
4904
			"The method foo2(String) is ambiguous for the type X<Object>\n" + 
4905
			"----------\n" + 
4906
			"3. ERROR in X.java (at line 6)\n" + 
4907
			"	<T> T foo(T t) {return null;}\n" + 
4908
			"	      ^^^^^^^^\n" + 
4909
			"Name clash: The method foo(T) of type X<A> has the same erasure as foo(A) of type Y<A> but does not override it\n" + 
4910
			"----------\n" + 
4911
			"4. ERROR in X.java (at line 7)\n" + 
4912
			"	<T> T foo2(T t) {return null;}\n" + 
4913
			"	      ^^^^^^^^^\n" + 
4914
			"Name clash: The method foo2(T) of type X<A> has the same erasure as foo2(A) of type Y<A> but does not override it\n" + 
4915
			"----------\n"
4916
		);
5375
		);
4917
/* javac 7
5376
/* javac 7
4918
X.java:3: reference to foo is ambiguous, both method foo(A) in Y and method <T>foo(T) in X match
5377
X.java:3: reference to foo is ambiguous, both method foo(A) in Y and method <T>foo(T) in X match
Lines 6877-6882 Link Here
6877
7336
6878
// name conflict
7337
// name conflict
6879
public void test101() {
7338
public void test101() {
7339
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
7340
			"----------\n" + 
7341
			"1. WARNING in X.java (at line 3)\n" + 
7342
			"	Integer getX(List<Integer> l) {\n" + 
7343
			"	        ^^^^^^^^^^^^^^^^^^^^^\n" + 
7344
			"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + 
7345
			"----------\n" + 
7346
			"2. WARNING in X.java (at line 6)\n" + 
7347
			"	String getX(List<String> l) {\n" + 
7348
			"	       ^^^^^^^^^^^^^^^^^^^^\n" + 
7349
			"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + 
7350
			"----------\n" + 
7351
			"3. WARNING in X.java (at line 11)\n" + 
7352
			"	Integer getX(List<Integer> l) {\n" + 
7353
			"	        ^^^^^^^^^^^^^^^^^^^^^\n" + 
7354
			"Duplicate method getX(List<Integer>) in type Y\n" + 
7355
			"----------\n" + 
7356
			"4. WARNING in X.java (at line 14)\n" + 
7357
			"	String getX(List<Integer> l) {\n" + 
7358
			"	       ^^^^^^^^^^^^^^^^^^^^^\n" + 
7359
			"Duplicate method getX(List<Integer>) in type Y\n" + 
7360
			"----------\n":
7361
				"----------\n" + 
7362
				"1. ERROR in X.java (at line 3)\n" + 
7363
				"	Integer getX(List<Integer> l) {\n" + 
7364
				"	        ^^^^^^^^^^^^^^^^^^^^^\n" + 
7365
				"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + 
7366
				"----------\n" + 
7367
				"2. ERROR in X.java (at line 6)\n" + 
7368
				"	String getX(List<String> l) {\n" + 
7369
				"	       ^^^^^^^^^^^^^^^^^^^^\n" + 
7370
				"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + 
7371
				"----------\n" + 
7372
				"3. ERROR in X.java (at line 11)\n" + 
7373
				"	Integer getX(List<Integer> l) {\n" + 
7374
				"	        ^^^^^^^^^^^^^^^^^^^^^\n" + 
7375
				"Duplicate method getX(List<Integer>) in type Y\n" + 
7376
				"----------\n" + 
7377
				"4. ERROR in X.java (at line 14)\n" + 
7378
				"	String getX(List<Integer> l) {\n" + 
7379
				"	       ^^^^^^^^^^^^^^^^^^^^^\n" + 
7380
				"Duplicate method getX(List<Integer>) in type Y\n" + 
7381
				"----------\n";
6880
	this.runNegativeTest(
7382
	this.runNegativeTest(
6881
		new String[] {
7383
		new String[] {
6882
			"X.java",
7384
			"X.java",
Lines 6898-6924 Link Here
6898
			"    }\n" +
7400
			"    }\n" +
6899
			"}"
7401
			"}"
6900
		},
7402
		},
6901
		"----------\n" + 
7403
		expectedCompilerLog
6902
		"1. ERROR in X.java (at line 3)\n" + 
6903
		"	Integer getX(List<Integer> l) {\n" + 
6904
		"	        ^^^^^^^^^^^^^^^^^^^^^\n" + 
6905
		"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + 
6906
		"----------\n" + 
6907
		"2. ERROR in X.java (at line 6)\n" + 
6908
		"	String getX(List<String> l) {\n" + 
6909
		"	       ^^^^^^^^^^^^^^^^^^^^\n" + 
6910
		"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + 
6911
		"----------\n" + 
6912
		"3. ERROR in X.java (at line 11)\n" + 
6913
		"	Integer getX(List<Integer> l) {\n" + 
6914
		"	        ^^^^^^^^^^^^^^^^^^^^^\n" + 
6915
		"Duplicate method getX(List<Integer>) in type Y\n" + 
6916
		"----------\n" + 
6917
		"4. ERROR in X.java (at line 14)\n" + 
6918
		"	String getX(List<Integer> l) {\n" + 
6919
		"	       ^^^^^^^^^^^^^^^^^^^^^\n" + 
6920
		"Duplicate method getX(List<Integer>) in type Y\n" + 
6921
		"----------\n"
6922
	);
7404
	);
6923
}
7405
}
6924
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159973
7406
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159973
Lines 7971-7976 Link Here
7971
}
8453
}
7972
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830
8454
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830
7973
public void test120a() {
8455
public void test120a() {
8456
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
8457
			"----------\n" + 
8458
			"1. WARNING in Bar.java (at line 2)\n" + 
8459
			"	int getThing(V v) { return 1; }\n" + 
8460
			"	    ^^^^^^^^^^^^^\n" + 
8461
			"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8462
			"----------\n" + 
8463
			"2. WARNING in Bar.java (at line 3)\n" + 
8464
			"	boolean getThing(E e) { return true; }\n" + 
8465
			"	        ^^^^^^^^^^^^^\n" + 
8466
			"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8467
			"----------\n":
8468
				"----------\n" + 
8469
				"1. ERROR in Bar.java (at line 2)\n" + 
8470
				"	int getThing(V v) { return 1; }\n" + 
8471
				"	    ^^^^^^^^^^^^^\n" + 
8472
				"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8473
				"----------\n" + 
8474
				"2. ERROR in Bar.java (at line 3)\n" + 
8475
				"	boolean getThing(E e) { return true; }\n" + 
8476
				"	        ^^^^^^^^^^^^^\n" + 
8477
				"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8478
				"----------\n";
7974
	this.runNegativeTest(
8479
	this.runNegativeTest(
7975
		new String[] {
8480
		new String[] {
7976
			"Bar.java",
8481
			"Bar.java",
Lines 7980-7996 Link Here
7980
			"}\n" +
8485
			"}\n" +
7981
			"public class Bar<V,E> extends Foo<V,E> {}"
8486
			"public class Bar<V,E> extends Foo<V,E> {}"
7982
		},
8487
		},
7983
		"----------\n" + 
8488
		expectedCompilerLog
7984
		"1. ERROR in Bar.java (at line 2)\n" + 
7985
		"	int getThing(V v) { return 1; }\n" + 
7986
		"	    ^^^^^^^^^^^^^\n" + 
7987
		"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
7988
		"----------\n" + 
7989
		"2. ERROR in Bar.java (at line 3)\n" + 
7990
		"	boolean getThing(E e) { return true; }\n" + 
7991
		"	        ^^^^^^^^^^^^^\n" + 
7992
		"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
7993
		"----------\n"
7994
	);
8489
	);
7995
}
8490
}
7996
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477
8491
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477
Lines 9700-9705 Link Here
9700
// JDK7 (7b100) behavior. (earlier we would issue an extra name clash)
10195
// JDK7 (7b100) behavior. (earlier we would issue an extra name clash)
9701
public void test177() {
10196
public void test177() {
9702
	if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187()
10197
	if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187()
10198
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
10199
				"----------\n" + 
10200
				"1. WARNING in X.java (at line 3)\n" + 
10201
				"	class A extends LinkedHashMap {\n" + 
10202
				"	      ^\n" + 
10203
				"The serializable class A does not declare a static final serialVersionUID field of type long\n" + 
10204
				"----------\n" + 
10205
				"2. WARNING in X.java (at line 3)\n" + 
10206
				"	class A extends LinkedHashMap {\n" + 
10207
				"	                ^^^^^^^^^^^^^\n" + 
10208
				"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + 
10209
				"----------\n" + 
10210
				"3. WARNING in X.java (at line 4)\n" + 
10211
				"	public A foo(Collection c) { return this; }\n" + 
10212
				"	             ^^^^^^^^^^\n" + 
10213
				"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
10214
				"----------\n" + 
10215
				"4. WARNING in X.java (at line 6)\n" + 
10216
				"	class X extends A implements I {\n" + 
10217
				"	      ^\n" + 
10218
				"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
10219
				"----------\n" + 
10220
				"5. WARNING in X.java (at line 7)\n" + 
10221
				"	@Override public X foo(Collection<?> c) { return this; }\n" + 
10222
				"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
10223
				"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + 
10224
				"----------\n":
10225
					"----------\n" + 
10226
					"1. WARNING in X.java (at line 3)\n" + 
10227
					"	class A extends LinkedHashMap {\n" + 
10228
					"	      ^\n" + 
10229
					"The serializable class A does not declare a static final serialVersionUID field of type long\n" + 
10230
					"----------\n" + 
10231
					"2. WARNING in X.java (at line 3)\n" + 
10232
					"	class A extends LinkedHashMap {\n" + 
10233
					"	                ^^^^^^^^^^^^^\n" + 
10234
					"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + 
10235
					"----------\n" + 
10236
					"3. WARNING in X.java (at line 4)\n" + 
10237
					"	public A foo(Collection c) { return this; }\n" + 
10238
					"	             ^^^^^^^^^^\n" + 
10239
					"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
10240
					"----------\n" + 
10241
					"4. WARNING in X.java (at line 6)\n" + 
10242
					"	class X extends A implements I {\n" + 
10243
					"	      ^\n" + 
10244
					"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
10245
					"----------\n" + 
10246
					"5. ERROR in X.java (at line 7)\n" + 
10247
					"	@Override public X foo(Collection<?> c) { return this; }\n" + 
10248
					"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
10249
					"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + 
10250
					"----------\n";
9703
		this.runNegativeTest(
10251
		this.runNegativeTest(
9704
			new String[] {
10252
			new String[] {
9705
				"X.java",
10253
				"X.java",
Lines 9712-9743 Link Here
9712
				"	@Override public X foo(Collection<?> c) { return this; }\n" +
10260
				"	@Override public X foo(Collection<?> c) { return this; }\n" +
9713
				"}"
10261
				"}"
9714
			},
10262
			},
9715
			"----------\n" + 
10263
			expectedCompilerLog
9716
			"1. WARNING in X.java (at line 3)\n" + 
9717
			"	class A extends LinkedHashMap {\n" + 
9718
			"	      ^\n" + 
9719
			"The serializable class A does not declare a static final serialVersionUID field of type long\n" + 
9720
			"----------\n" + 
9721
			"2. WARNING in X.java (at line 3)\n" + 
9722
			"	class A extends LinkedHashMap {\n" + 
9723
			"	                ^^^^^^^^^^^^^\n" + 
9724
			"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + 
9725
			"----------\n" + 
9726
			"3. WARNING in X.java (at line 4)\n" + 
9727
			"	public A foo(Collection c) { return this; }\n" + 
9728
			"	             ^^^^^^^^^^\n" + 
9729
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
9730
			"----------\n" + 
9731
			"4. WARNING in X.java (at line 6)\n" + 
9732
			"	class X extends A implements I {\n" + 
9733
			"	      ^\n" + 
9734
			"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
9735
			"----------\n" + 
9736
			"5. ERROR in X.java (at line 7)\n" + 
9737
			"	@Override public X foo(Collection<?> c) { return this; }\n" + 
9738
			"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
9739
			"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + 
9740
			"----------\n"
9741
		);
10264
		);
9742
	} else {
10265
	} else {
9743
		this.runNegativeTest(
10266
		this.runNegativeTest(
Lines 9777-9783 Link Here
9777
			"	@Override public X foo(Collection<?> c) { return this; }\n" + 
10300
			"	@Override public X foo(Collection<?> c) { return this; }\n" + 
9778
			"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
10301
			"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
9779
			"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + 
10302
			"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + 
9780
			"----------\n" + 
10303
			"----------\n" +
9781
			"6. ERROR in X.java (at line 7)\n" + 
10304
			"6. ERROR in X.java (at line 7)\n" + 
9782
			"	@Override public X foo(Collection<?> c) { return this; }\n" + 
10305
			"	@Override public X foo(Collection<?> c) { return this; }\n" + 
9783
			"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
10306
			"	                   ^^^^^^^^^^^^^^^^^^^^\n" + 
Lines 10246-10251 Link Here
10246
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
10769
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
10247
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=?
10770
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=?
10248
public void test187() {
10771
public void test187() {
10772
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6 )?
10773
			"----------\n" + 
10774
			"1. WARNING in X.java (at line 6)\n" + 
10775
			"	double f(List<Integer> l) {return 0;}\n" + 
10776
			"	       ^^^^^^^^^^^^^^^^^^\n" + 
10777
			"Name clash: The method f(List<Integer>) of type Y has the same erasure as f(List<String>) of type X but does not override it\n" + 
10778
			"----------\n" + 
10779
			"2. WARNING in X.java (at line 13)\n" + 
10780
			"	int f(List<String> l) {return 0;}\n" + 
10781
			"	    ^^^^^^^^^^^^^^^^^\n" + 
10782
			"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + 
10783
			"----------\n" + 
10784
			"3. WARNING in X.java (at line 14)\n" + 
10785
			"	double f(List<Integer> l) {return 0;}\n" + 
10786
			"	       ^^^^^^^^^^^^^^^^^^\n" + 
10787
			"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + 
10788
			"----------\n":
10789
				"----------\n" + 
10790
				"1. ERROR in X.java (at line 6)\n" + 
10791
				"	double f(List<Integer> l) {return 0;}\n" + 
10792
				"	       ^^^^^^^^^^^^^^^^^^\n" + 
10793
				"Name clash: The method f(List<Integer>) of type Y has the same erasure as f(List<String>) of type X but does not override it\n" + 
10794
				"----------\n" + 
10795
				"2. ERROR in X.java (at line 13)\n" + 
10796
				"	int f(List<String> l) {return 0;}\n" + 
10797
				"	    ^^^^^^^^^^^^^^^^^\n" + 
10798
				"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + 
10799
				"----------\n" + 
10800
				"3. ERROR in X.java (at line 14)\n" + 
10801
				"	double f(List<Integer> l) {return 0;}\n" + 
10802
				"	       ^^^^^^^^^^^^^^^^^^\n" + 
10803
				"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + 
10804
				"----------\n";
10249
	this.runNegativeTest(
10805
	this.runNegativeTest(
10250
		new String[] {
10806
		new String[] {
10251
			"X.java",
10807
			"X.java",
Lines 10265-10286 Link Here
10265
    			"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7
10821
    			"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7
10266
			"}"
10822
			"}"
10267
		},
10823
		},
10268
		"----------\n" + 
10824
		expectedCompilerLog
10269
		"1. ERROR in X.java (at line 6)\n" + 
10270
		"	double f(List<Integer> l) {return 0;}\n" + 
10271
		"	       ^^^^^^^^^^^^^^^^^^\n" + 
10272
		"Name clash: The method f(List<Integer>) of type Y has the same erasure as f(List<String>) of type X but does not override it\n" + 
10273
		"----------\n" + 
10274
		"2. ERROR in X.java (at line 13)\n" + 
10275
		"	int f(List<String> l) {return 0;}\n" + 
10276
		"	    ^^^^^^^^^^^^^^^^^\n" + 
10277
		"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + 
10278
		"----------\n" + 
10279
		"3. ERROR in X.java (at line 14)\n" + 
10280
		"	double f(List<Integer> l) {return 0;}\n" + 
10281
		"	       ^^^^^^^^^^^^^^^^^^\n" + 
10282
		"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + 
10283
		"----------\n"
10284
	);
10825
	);
10285
}
10826
}
10286
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836
10827
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836
Lines 10702-10707 Link Here
10702
}
11243
}
10703
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088
11244
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088
10704
public void test200() {
11245
public void test200() {
11246
	Map options = getCompilerOptions();
11247
	String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE);
11248
	String errorMessage = compliance == JavaCore.VERSION_1_6 ?
11249
			"----------\n" + 
11250
			"1. WARNING in X.java (at line 3)\n" + 
11251
			"	int foo(Collection bar) { return 0; }\n" + 
11252
			"	    ^^^^^^^^^^^^^^^^^^^\n" + 
11253
			"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + 
11254
			"----------\n" + 
11255
			"2. WARNING in X.java (at line 3)\n" + 
11256
			"	int foo(Collection bar) { return 0; }\n" + 
11257
			"	        ^^^^^^^^^^\n" + 
11258
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
11259
			"----------\n" + 
11260
			"3. WARNING in X.java (at line 4)\n" + 
11261
			"	double foo(Collection<String> bar) {return 0; }\n" + 
11262
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11263
			"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + 
11264
			"----------\n" :
11265
				"----------\n" + 
11266
				"1. ERROR in X.java (at line 3)\n" + 
11267
				"	int foo(Collection bar) { return 0; }\n" + 
11268
				"	    ^^^^^^^^^^^^^^^^^^^\n" + 
11269
				"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + 
11270
				"----------\n" + 
11271
				"2. WARNING in X.java (at line 3)\n" + 
11272
				"	int foo(Collection bar) { return 0; }\n" + 
11273
				"	        ^^^^^^^^^^\n" + 
11274
				"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
11275
				"----------\n" + 
11276
				"3. ERROR in X.java (at line 4)\n" + 
11277
				"	double foo(Collection<String> bar) {return 0; }\n" + 
11278
				"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11279
				"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + 
11280
				"----------\n";
10705
	this.runNegativeTest(
11281
	this.runNegativeTest(
10706
		new String[] {
11282
		new String[] {
10707
			"X.java",
11283
			"X.java",
Lines 10711-10732 Link Here
10711
			"	double foo(Collection<String> bar) {return 0; }\n" +
11287
			"	double foo(Collection<String> bar) {return 0; }\n" +
10712
			"}"
11288
			"}"
10713
		},
11289
		},
10714
		"----------\n" + 
11290
		errorMessage
10715
		"1. ERROR in X.java (at line 3)\n" + 
10716
		"	int foo(Collection bar) { return 0; }\n" + 
10717
		"	    ^^^^^^^^^^^^^^^^^^^\n" + 
10718
		"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + 
10719
		"----------\n" + 
10720
		"2. WARNING in X.java (at line 3)\n" + 
10721
		"	int foo(Collection bar) { return 0; }\n" + 
10722
		"	        ^^^^^^^^^^\n" + 
10723
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
10724
		"----------\n" + 
10725
		"3. ERROR in X.java (at line 4)\n" + 
10726
		"	double foo(Collection<String> bar) {return 0; }\n" + 
10727
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
10728
		"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + 
10729
		"----------\n"
10730
	);
11291
	);
10731
/* javac 7
11292
/* javac 7
10732
X.java:4: foo(Collection) is already defined in X
11293
X.java:4: foo(Collection) is already defined in X
Lines 12342-12357 Link Here
12342
			"}\n" +
12903
			"}\n" +
12343
			"interface C  extends A, B { \n" +
12904
			"interface C  extends A, B { \n" +
12344
			"int get(List l);      // name clash error here\n" +
12905
			"int get(List l);      // name clash error here\n" +
12345
            "}\n" +
12906
         "}\n" +
12346
			"public class X {\n" +
12907
			"public class X {\n" +
12347
            "    public static void main(String [] args) {\n" +
12908
         "    public static void main(String [] args) {\n" +
12348
			"        System.out.println(\"Built OK\");\n" +
12909
			"        System.out.println(\"Built OK\");\n" +
12349
            "    }\n" +
12910
         "    }\n" +
12350
			"}"
12911
			"}"
12351
		},
12912
		},
12352
		"Built OK");
12913
		"Built OK");
12353
}
12914
}
12354
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089
12915
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089
12355
public void test353089b() throws Exception {
12916
public void test353089b() throws Exception {
12356
	this.runNegativeTest(
12917
	this.runNegativeTest(
12357
		new String[] {
12918
		new String[] {
Lines 12411-12417 Link Here
12411
		"Zork cannot be resolved to a type\n" + 
12972
		"Zork cannot be resolved to a type\n" + 
12412
		"----------\n");
12973
		"----------\n");
12413
}
12974
}
12414
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089
12975
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089
12415
public void test353089c() throws Exception {
12976
public void test353089c() throws Exception {
12416
	this.runNegativeTest(
12977
	this.runNegativeTest(
12417
		new String[] {
12978
		new String[] {
Lines 12436-12439 Link Here
12436
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
12997
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
12437
		"----------\n");
12998
		"----------\n");
12438
}
12999
}
13000
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13001
public void testBug317719() throws Exception {
13002
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13003
			"----------\n" + 
13004
			"1. WARNING in X.java (at line 4)\n" + 
13005
			"	public <T extends List> T foo() { return null; }\n" + 
13006
			"	                  ^^^^\n" + 
13007
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
13008
			"----------\n" + 
13009
			"2. WARNING in X.java (at line 4)\n" + 
13010
			"	public <T extends List> T foo() { return null; }\n" + 
13011
			"	                          ^^^^^\n" + 
13012
			"Duplicate method foo() in type X\n" + 
13013
			"----------\n" + 
13014
			"3. WARNING in X.java (at line 5)\n" + 
13015
			"	public <T extends Set> T foo() { return null; }\n" + 
13016
			"	                  ^^^\n" + 
13017
			"Set is a raw type. References to generic type Set<E> should be parameterized\n" + 
13018
			"----------\n" + 
13019
			"4. WARNING in X.java (at line 5)\n" + 
13020
			"	public <T extends Set> T foo() { return null; }\n" + 
13021
			"	                         ^^^^^\n" + 
13022
			"Duplicate method foo() in type X\n" + 
13023
			"----------\n" + 
13024
			"5. ERROR in X.java (at line 6)\n" + 
13025
			"	Zork z;\n" + 
13026
			"	^^^^\n" + 
13027
			"Zork cannot be resolved to a type\n" + 
13028
			"----------\n":
13029
				"----------\n" + 
13030
				"1. WARNING in X.java (at line 4)\n" + 
13031
				"	public <T extends List> T foo() { return null; }\n" + 
13032
				"	                  ^^^^\n" + 
13033
				"List is a raw type. References to generic type List<E> should be parameterized\n" + 
13034
				"----------\n" + 
13035
				"2. ERROR in X.java (at line 4)\n" + 
13036
				"	public <T extends List> T foo() { return null; }\n" + 
13037
				"	                          ^^^^^\n" + 
13038
				"Duplicate method foo() in type X\n" + 
13039
				"----------\n" + 
13040
				"3. WARNING in X.java (at line 5)\n" + 
13041
				"	public <T extends Set> T foo() { return null; }\n" + 
13042
				"	                  ^^^\n" + 
13043
				"Set is a raw type. References to generic type Set<E> should be parameterized\n" + 
13044
				"----------\n" + 
13045
				"4. ERROR in X.java (at line 5)\n" + 
13046
				"	public <T extends Set> T foo() { return null; }\n" + 
13047
				"	                         ^^^^^\n" + 
13048
				"Duplicate method foo() in type X\n" + 
13049
				"----------\n" + 
13050
				"5. ERROR in X.java (at line 6)\n" + 
13051
				"	Zork z;\n" + 
13052
				"	^^^^\n" + 
13053
				"Zork cannot be resolved to a type\n" + 
13054
				"----------\n";
13055
	this.runNegativeTest(
13056
		new String[] {
13057
			"X.java",
13058
			"import java.util.List;\n" +
13059
			"import java.util.Set;\n" +
13060
			"class X {\n" +
13061
			"    public <T extends List> T foo() { return null; }\n" +
13062
			"	 public <T extends Set> T foo() { return null; }\n" +
13063
			"	 Zork z;\n" +
13064
			"}\n"
13065
		},
13066
		output);
13067
}
13068
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13069
public void testBug317719a() throws Exception {
13070
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13071
			"----------\n" + 
13072
			"1. WARNING in X.java (at line 4)\n" + 
13073
			"	public Integer same(List<Integer> a) { return null; }\n" + 
13074
			"	               ^^^^^^^^^^^^^^^^^^^^^\n" + 
13075
			"Method same(List<Integer>) has the same erasure same(List<E>) as another method in type X\n" + 
13076
			"----------\n" + 
13077
			"2. WARNING in X.java (at line 5)\n" + 
13078
			"	public String same(List<String> b) { return null; }\n" + 
13079
			"	              ^^^^^^^^^^^^^^^^^^^^\n" + 
13080
			"Method same(List<String>) has the same erasure same(List<E>) as another method in type X\n" + 
13081
			"----------\n" + 
13082
			"3. ERROR in X.java (at line 6)\n" + 
13083
			"	Zork z;\n" + 
13084
			"	^^^^\n" + 
13085
			"Zork cannot be resolved to a type\n" + 
13086
			"----------\n":
13087
				"----------\n" + 
13088
				"1. ERROR in X.java (at line 4)\n" + 
13089
				"	public Integer same(List<Integer> a) { return null; }\n" + 
13090
				"	               ^^^^^^^^^^^^^^^^^^^^^\n" + 
13091
				"Method same(List<Integer>) has the same erasure same(List<E>) as another method in type X\n" + 
13092
				"----------\n" + 
13093
				"2. ERROR in X.java (at line 5)\n" + 
13094
				"	public String same(List<String> b) { return null; }\n" + 
13095
				"	              ^^^^^^^^^^^^^^^^^^^^\n" + 
13096
				"Method same(List<String>) has the same erasure same(List<E>) as another method in type X\n" + 
13097
				"----------\n" + 
13098
				"3. ERROR in X.java (at line 6)\n" + 
13099
				"	Zork z;\n" + 
13100
				"	^^^^\n" + 
13101
				"Zork cannot be resolved to a type\n" + 
13102
				"----------\n";
13103
	this.runNegativeTest(
13104
		new String[] {
13105
			"X.java",
13106
			"import java.util.List;\n" +
13107
			"import java.util.Set;\n" +
13108
			"class X {\n" +
13109
			"    public Integer same(List<Integer> a) { return null; }\n" +
13110
			"	 public String same(List<String> b) { return null; }\n" +
13111
			"	 Zork z;\n" +
13112
			"}\n"
13113
		},
13114
		output);
13115
}
13116
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13117
public void testBug317719b() throws Exception {
13118
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13119
			"----------\n" + 
13120
			"1. WARNING in X.java (at line 3)\n" + 
13121
			"	public static String doIt(final List<String> arg) { return null; }\n" + 
13122
			"	                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13123
			"Method doIt(List<String>) has the same erasure doIt(List<E>) as another method in type X\n" + 
13124
			"----------\n" + 
13125
			"2. WARNING in X.java (at line 4)\n" + 
13126
			"	public static CharSequence doIt(final List<CharSequence> arg) { return null; }\n" + 
13127
			"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13128
			"Method doIt(List<CharSequence>) has the same erasure doIt(List<E>) as another method in type X\n" + 
13129
			"----------\n" + 
13130
			"3. ERROR in X.java (at line 5)\n" + 
13131
			"	Zork z;\n" + 
13132
			"	^^^^\n" + 
13133
			"Zork cannot be resolved to a type\n" + 
13134
			"----------\n":
13135
				"----------\n" + 
13136
				"1. ERROR in X.java (at line 3)\n" + 
13137
				"	public static String doIt(final List<String> arg) { return null; }\n" + 
13138
				"	                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13139
				"Method doIt(List<String>) has the same erasure doIt(List<E>) as another method in type X\n" + 
13140
				"----------\n" + 
13141
				"2. ERROR in X.java (at line 4)\n" + 
13142
				"	public static CharSequence doIt(final List<CharSequence> arg) { return null; }\n" + 
13143
				"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13144
				"Method doIt(List<CharSequence>) has the same erasure doIt(List<E>) as another method in type X\n" + 
13145
				"----------\n" + 
13146
				"3. ERROR in X.java (at line 5)\n" + 
13147
				"	Zork z;\n" + 
13148
				"	^^^^\n" + 
13149
				"Zork cannot be resolved to a type\n" + 
13150
				"----------\n";
13151
	this.runNegativeTest(
13152
		new String[] {
13153
			"X.java",
13154
			"import java.util.List;\n" +
13155
			"class X {\n" +
13156
			"    public static String doIt(final List<String> arg) { return null; }\n" +
13157
			"	 public static CharSequence doIt(final List<CharSequence> arg) { return null; }\n" +
13158
			"	 Zork z;\n" +
13159
			"}\n"
13160
		},
13161
		output);
13162
}
13163
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13164
public void testBug317719c() throws Exception {
13165
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13166
			"----------\n" + 
13167
			"1. WARNING in X.java (at line 3)\n" + 
13168
			"	protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + 
13169
			"	                            ^^^^^^\n" + 
13170
			"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
13171
			"----------\n" + 
13172
			"2. WARNING in X.java (at line 3)\n" + 
13173
			"	protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + 
13174
			"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13175
			"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + 
13176
			"----------\n" + 
13177
			"3. WARNING in X.java (at line 4)\n" + 
13178
			"	protected static <T extends Number> T same(Collection<? extends T> p_col) { return null; }\n" + 
13179
			"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13180
			"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + 
13181
			"----------\n" + 
13182
			"4. ERROR in X.java (at line 5)\n" + 
13183
			"	Zork z;\n" + 
13184
			"	^^^^\n" + 
13185
			"Zork cannot be resolved to a type\n" + 
13186
			"----------\n":
13187
				"----------\n" + 
13188
				"1. WARNING in X.java (at line 3)\n" + 
13189
				"	protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + 
13190
				"	                            ^^^^^^\n" + 
13191
				"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
13192
				"----------\n" + 
13193
				"2. ERROR in X.java (at line 3)\n" + 
13194
				"	protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + 
13195
				"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13196
				"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + 
13197
				"----------\n" + 
13198
				"3. ERROR in X.java (at line 4)\n" + 
13199
				"	protected static <T extends Number> T same(Collection<? extends T> p_col) { return null; }\n" + 
13200
				"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13201
				"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + 
13202
				"----------\n" + 
13203
				"4. ERROR in X.java (at line 5)\n" + 
13204
				"	Zork z;\n" + 
13205
				"	^^^^\n" + 
13206
				"Zork cannot be resolved to a type\n" + 
13207
				"----------\n";
13208
	this.runNegativeTest(
13209
		new String[] {
13210
			"X.java",
13211
			"import java.util.Collection;\n" +
13212
			"class X {\n" +
13213
			"    protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" +
13214
			"	 protected static <T extends Number> T same(Collection<? extends T> p_col) { return null; }\n" +
13215
			"	 Zork z;\n" +
13216
			"}\n"
13217
		},
13218
		output);
13219
}
13220
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13221
public void testBug317719d() throws Exception {
13222
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13223
			"----------\n" + 
13224
			"1. WARNING in X.java (at line 3)\n" + 
13225
			"	public static boolean foo(List<String> x) { return true; }\n" + 
13226
			"	                      ^^^^^^^^^^^^^^^^^^^\n" + 
13227
			"Method foo(List<String>) has the same erasure foo(List<E>) as another method in type X\n" + 
13228
			"----------\n" + 
13229
			"2. WARNING in X.java (at line 4)\n" + 
13230
			"	public static int foo(List<Integer> x) { return 2; }\n" + 
13231
			"	                  ^^^^^^^^^^^^^^^^^^^^\n" + 
13232
			"Method foo(List<Integer>) has the same erasure foo(List<E>) as another method in type X\n" + 
13233
			"----------\n" + 
13234
			"3. ERROR in X.java (at line 5)\n" + 
13235
			"	Zork z;\n" + 
13236
			"	^^^^\n" + 
13237
			"Zork cannot be resolved to a type\n" + 
13238
			"----------\n":
13239
				"----------\n" + 
13240
				"1. ERROR in X.java (at line 3)\n" + 
13241
				"	public static boolean foo(List<String> x) { return true; }\n" + 
13242
				"	                      ^^^^^^^^^^^^^^^^^^^\n" + 
13243
				"Method foo(List<String>) has the same erasure foo(List<E>) as another method in type X\n" + 
13244
				"----------\n" + 
13245
				"2. ERROR in X.java (at line 4)\n" + 
13246
				"	public static int foo(List<Integer> x) { return 2; }\n" + 
13247
				"	                  ^^^^^^^^^^^^^^^^^^^^\n" + 
13248
				"Method foo(List<Integer>) has the same erasure foo(List<E>) as another method in type X\n" + 
13249
				"----------\n" + 
13250
				"3. ERROR in X.java (at line 5)\n" + 
13251
				"	Zork z;\n" + 
13252
				"	^^^^\n" + 
13253
				"Zork cannot be resolved to a type\n" + 
13254
				"----------\n";
13255
	this.runNegativeTest(
13256
		new String[] {
13257
			"X.java",
13258
			"import java.util.List;\n" +
13259
			"class X {\n" +
13260
			"    public static boolean foo(List<String> x) { return true; }\n" +
13261
			"	 public static int foo(List<Integer> x) { return 2; }\n" +
13262
			"	 Zork z;\n" +
13263
			"}\n"
13264
		},
13265
		output);
13266
}
13267
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13268
public void testBug317719e() throws Exception {
13269
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13270
			"----------\n" + 
13271
			"1. WARNING in X.java (at line 3)\n" + 
13272
			"	public String getFirst (ArrayList<String> ss) { return ss.get(0); }\n" + 
13273
			"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13274
			"Method getFirst(ArrayList<String>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + 
13275
			"----------\n" + 
13276
			"2. WARNING in X.java (at line 4)\n" + 
13277
			"	public Integer getFirst (ArrayList<Integer> ss) { return ss.get(0); }\n" + 
13278
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13279
			"Method getFirst(ArrayList<Integer>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + 
13280
			"----------\n" + 
13281
			"3. ERROR in X.java (at line 5)\n" + 
13282
			"	Zork z;\n" + 
13283
			"	^^^^\n" + 
13284
			"Zork cannot be resolved to a type\n" + 
13285
			"----------\n":
13286
				"----------\n" + 
13287
				"1. ERROR in X.java (at line 3)\n" + 
13288
				"	public String getFirst (ArrayList<String> ss) { return ss.get(0); }\n" + 
13289
				"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13290
				"Method getFirst(ArrayList<String>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + 
13291
				"----------\n" + 
13292
				"2. ERROR in X.java (at line 4)\n" + 
13293
				"	public Integer getFirst (ArrayList<Integer> ss) { return ss.get(0); }\n" + 
13294
				"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13295
				"Method getFirst(ArrayList<Integer>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + 
13296
				"----------\n" + 
13297
				"3. ERROR in X.java (at line 5)\n" + 
13298
				"	Zork z;\n" + 
13299
				"	^^^^\n" + 
13300
				"Zork cannot be resolved to a type\n" + 
13301
				"----------\n";
13302
	this.runNegativeTest(
13303
		new String[] {
13304
			"X.java",
13305
			"import java.util.ArrayList;\n" +
13306
			"class X {\n" +
13307
			"    public String getFirst (ArrayList<String> ss) { return ss.get(0); }\n" +
13308
			"	 public Integer getFirst (ArrayList<Integer> ss) { return ss.get(0); }\n" +
13309
			"	 Zork z;\n" +
13310
			"}\n"
13311
		},
13312
		output);
13313
}
13314
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13315
public void testBug317719f() throws Exception {
13316
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13317
			"----------\n" + 
13318
			"1. WARNING in X.java (at line 3)\n" + 
13319
			"	public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + 
13320
			"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13321
			"Method forAccountSet(List) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + 
13322
			"----------\n" + 
13323
			"2. WARNING in X.java (at line 3)\n" + 
13324
			"	public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + 
13325
			"	                                                    ^^^^\n" + 
13326
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
13327
			"----------\n" + 
13328
			"3. WARNING in X.java (at line 4)\n" + 
13329
			"	public static <R extends Object> ChildX<R> forAccountSet(List<R> list) { return null; }\n" + 
13330
			"	                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13331
			"Method forAccountSet(List<R>) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + 
13332
			"----------\n" + 
13333
			"4. ERROR in X.java (at line 5)\n" + 
13334
			"	Zork z;\n" + 
13335
			"	^^^^\n" + 
13336
			"Zork cannot be resolved to a type\n" + 
13337
			"----------\n":
13338
				"----------\n" + 
13339
				"1. ERROR in X.java (at line 3)\n" + 
13340
				"	public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + 
13341
				"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13342
				"Method forAccountSet(List) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + 
13343
				"----------\n" + 
13344
				"2. WARNING in X.java (at line 3)\n" + 
13345
				"	public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + 
13346
				"	                                                    ^^^^\n" + 
13347
				"List is a raw type. References to generic type List<E> should be parameterized\n" + 
13348
				"----------\n" + 
13349
				"3. ERROR in X.java (at line 4)\n" + 
13350
				"	public static <R extends Object> ChildX<R> forAccountSet(List<R> list) { return null; }\n" + 
13351
				"	                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13352
				"Method forAccountSet(List<R>) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + 
13353
				"----------\n" + 
13354
				"4. ERROR in X.java (at line 5)\n" + 
13355
				"	Zork z;\n" + 
13356
				"	^^^^\n" + 
13357
				"Zork cannot be resolved to a type\n" + 
13358
				"----------\n";
13359
	this.runNegativeTest(
13360
		new String[] {
13361
			"X.java",
13362
			"import java.util.List;\n" +
13363
			"class X<Z> {\n" +
13364
			"    public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" +
13365
			"	 public static <R extends Object> ChildX<R> forAccountSet(List<R> list) { return null; }\n" +
13366
			"	 Zork z;\n" +
13367
			"}\n" +
13368
			"class ChildX<Z> extends X<Z>{}\n"
13369
		},
13370
		output);
13371
}
13372
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13373
public void testBug317719g() throws Exception {
13374
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13375
			"----------\n" + 
13376
			"1. WARNING in X.java (at line 3)\n" + 
13377
			"	public static int[] doIt(Collection<int[]> col) { return new int[1]; }\n" + 
13378
			"	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13379
			"Method doIt(Collection<int[]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + 
13380
			"----------\n" + 
13381
			"2. WARNING in X.java (at line 4)\n" + 
13382
			"	public static int[][] doIt(Collection<int[][]> col) { return new int[0][0]; }\n" + 
13383
			"	                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13384
			"Method doIt(Collection<int[][]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + 
13385
			"----------\n" + 
13386
			"3. WARNING in X.java (at line 5)\n" + 
13387
			"	public int[] doIt2(Collection<int[]> col) { return new int[0]; }\n" + 
13388
			"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13389
			"Method doIt2(Collection<int[]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + 
13390
			"----------\n" + 
13391
			"4. WARNING in X.java (at line 6)\n" + 
13392
			"	public int[][] doIt2(Collection<int[][]> col) { return new int[0][0]; }\n" + 
13393
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13394
			"Method doIt2(Collection<int[][]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + 
13395
			"----------\n" + 
13396
			"5. ERROR in X.java (at line 7)\n" + 
13397
			"	Zork z;\n" + 
13398
			"	^^^^\n" + 
13399
			"Zork cannot be resolved to a type\n" + 
13400
			"----------\n":
13401
				"----------\n" + 
13402
				"1. ERROR in X.java (at line 3)\n" + 
13403
				"	public static int[] doIt(Collection<int[]> col) { return new int[1]; }\n" + 
13404
				"	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13405
				"Method doIt(Collection<int[]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + 
13406
				"----------\n" + 
13407
				"2. ERROR in X.java (at line 4)\n" + 
13408
				"	public static int[][] doIt(Collection<int[][]> col) { return new int[0][0]; }\n" + 
13409
				"	                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13410
				"Method doIt(Collection<int[][]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + 
13411
				"----------\n" + 
13412
				"3. ERROR in X.java (at line 5)\n" + 
13413
				"	public int[] doIt2(Collection<int[]> col) { return new int[0]; }\n" + 
13414
				"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13415
				"Method doIt2(Collection<int[]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + 
13416
				"----------\n" + 
13417
				"4. ERROR in X.java (at line 6)\n" + 
13418
				"	public int[][] doIt2(Collection<int[][]> col) { return new int[0][0]; }\n" + 
13419
				"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13420
				"Method doIt2(Collection<int[][]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + 
13421
				"----------\n" + 
13422
				"5. ERROR in X.java (at line 7)\n" + 
13423
				"	Zork z;\n" + 
13424
				"	^^^^\n" + 
13425
				"Zork cannot be resolved to a type\n" + 
13426
				"----------\n";
13427
	this.runNegativeTest(
13428
		new String[] {
13429
			"X.java",
13430
			"import java.util.Collection;\n" +
13431
			"class X<Z> {\n" +
13432
			"    public static int[] doIt(Collection<int[]> col) { return new int[1]; }\n" +
13433
			"	 public static int[][] doIt(Collection<int[][]> col) { return new int[0][0]; }\n" +
13434
			"	 public int[] doIt2(Collection<int[]> col) { return new int[0]; }\n" +
13435
			"	 public int[][] doIt2(Collection<int[][]> col) { return new int[0][0]; }\n" +
13436
			"	 Zork z;\n" +
13437
			"}\n" +
13438
			"class ChildX<Z> extends X<Z>{}\n"
13439
		},
13440
		output);
13441
}
13442
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719
13443
public void testBug317719h() throws Exception {
13444
	String output = this.complianceLevel == ClassFileConstants.JDK1_6 ?
13445
			"----------\n" + 
13446
			"1. WARNING in Test.java (at line 3)\n" + 
13447
			"	public class Test<Key, Value> extends LinkedHashMap<Key, Collection<Value>> {\n" + 
13448
			"	             ^^^^\n" + 
13449
			"The serializable class Test does not declare a static final serialVersionUID field of type long\n" + 
13450
			"----------\n" + 
13451
			"2. WARNING in Test.java (at line 4)\n" + 
13452
			"	public Collection<Value> put(Key k, Value v) { return null; }\n" + 
13453
			"	                         ^^^^^^^^^^^^^^^^^^^\n" + 
13454
			"Name clash: The method put(Key, Value) of type Test<Key,Value> has the same erasure as put(K, V) of type HashMap<K,V> but does not override it\n" + 
13455
			"----------\n" + 
13456
			"3. WARNING in Test.java (at line 5)\n" + 
13457
			"	public Collection<Value> get(Key k) { return null; }\n" + 
13458
			"	                         ^^^^^^^^^^\n" + 
13459
			"Name clash: The method get(Key) of type Test<Key,Value> has the same erasure as get(Object) of type LinkedHashMap<K,V> but does not override it\n" + 
13460
			"----------\n" + 
13461
			"4. ERROR in Test.java (at line 6)\n" + 
13462
			"	Zork z;\n" + 
13463
			"	^^^^\n" + 
13464
			"Zork cannot be resolved to a type\n" + 
13465
			"----------\n":
13466
				"----------\n" + 
13467
				"1. WARNING in Test.java (at line 3)\n" + 
13468
				"	public class Test<Key, Value> extends LinkedHashMap<Key, Collection<Value>> {\n" + 
13469
				"	             ^^^^\n" + 
13470
				"The serializable class Test does not declare a static final serialVersionUID field of type long\n" + 
13471
				"----------\n" + 
13472
				"2. ERROR in Test.java (at line 4)\n" + 
13473
				"	public Collection<Value> put(Key k, Value v) { return null; }\n" + 
13474
				"	                         ^^^^^^^^^^^^^^^^^^^\n" + 
13475
				"Name clash: The method put(Key, Value) of type Test<Key,Value> has the same erasure as put(K, V) of type HashMap<K,V> but does not override it\n" + 
13476
				"----------\n" + 
13477
				"3. ERROR in Test.java (at line 5)\n" + 
13478
				"	public Collection<Value> get(Key k) { return null; }\n" + 
13479
				"	                         ^^^^^^^^^^\n" + 
13480
				"Name clash: The method get(Key) of type Test<Key,Value> has the same erasure as get(Object) of type LinkedHashMap<K,V> but does not override it\n" + 
13481
				"----------\n" + 
13482
				"4. ERROR in Test.java (at line 6)\n" + 
13483
				"	Zork z;\n" + 
13484
				"	^^^^\n" + 
13485
				"Zork cannot be resolved to a type\n" + 
13486
				"----------\n";
13487
	this.runNegativeTest(
13488
		new String[] {
13489
			"Test.java",
13490
			"import java.util.Collection;\n" +
13491
			"import java.util.LinkedHashMap;\n" +
13492
			"public class Test<Key, Value> extends LinkedHashMap<Key, Collection<Value>> {\n" +
13493
			"    public Collection<Value> put(Key k, Value v) { return null; }\n" +
13494
			"	 public Collection<Value> get(Key k) { return null; }\n" +
13495
			"	 Zork z;\n" +
13496
			"}\n"
13497
		},
13498
		output);
13499
}
12439
}
13500
}

Return to bug 317719