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 / +11 lines)
Lines 196-202 Link Here
196
			final MethodBinding thisMethod = current[i];
196
			final MethodBinding thisMethod = current[i];
197
			if (thisMethod.areParameterErasuresEqual(bridge) && thisMethod.returnType.erasure() == bridge.returnType.erasure()) {
197
			if (thisMethod.areParameterErasuresEqual(bridge) && thisMethod.returnType.erasure() == bridge.returnType.erasure()) {
198
				// use inherited method for problem reporting.
198
				// use inherited method for problem reporting.
199
				problemReporter(thisMethod).methodNameClash(thisMethod, inheritedMethod.declaringClass.isRawType() ? inheritedMethod : inheritedMethod.original());
199
				problemReporter(thisMethod).methodNameClash(thisMethod, inheritedMethod.declaringClass.isRawType() ? inheritedMethod : inheritedMethod.original(), ProblemSeverities.Error);
200
				return;	
200
				return;	
201
			}
201
			}
202
		}
202
		}
Lines 725-730 Link Here
725
	MethodBinding original = methodToCheck.original(); // can be the same as inherited
725
	MethodBinding original = methodToCheck.original(); // can be the same as inherited
726
	if (!current.areParameterErasuresEqual(original))
726
	if (!current.areParameterErasuresEqual(original))
727
		return false;
727
		return false;
728
	int severity = ProblemSeverities.Error;
729
	if (this.environment.globalOptions.complianceLevel == ClassFileConstants.JDK1_6) {
730
		// with fix for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
731
		// we now ignore return types when detecting name clashes
732
		// FYI for now we will only make this change when compliance is set to 1.7 or higher
733
		if (current.returnType.erasure() != original.returnType.erasure())
734
			severity = ProblemSeverities.Warning;
735
	}
728
	if (!treatAsSynthetic) {
736
	if (!treatAsSynthetic) {
729
		// For a user method, see if current class overrides the inherited method. If it does,
737
		// For a user method, see if current class overrides the inherited method. If it does,
730
		// then any grievance we may have ought to be against the current class's method and
738
		// then any grievance we may have ought to be against the current class's method and
Lines 748-754 Link Here
748
	if (!current.areParameterErasuresEqual(original))
756
	if (!current.areParameterErasuresEqual(original))
749
		return false;
757
		return false;
750
	original = inherited.original();  // For error reporting use, inherited.original()
758
	original = inherited.original();  // For error reporting use, inherited.original()
751
	problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original);
759
	problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original, severity);
760
	if (severity == ProblemSeverities.Warning) return false;
752
	return true;
761
	return true;
753
}
762
}
754
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
763
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-6 / +73 lines)
Lines 30-35 Link Here
30
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
30
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
31
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
31
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
32
import org.eclipse.jdt.internal.compiler.impl.Constant;
32
import org.eclipse.jdt.internal.compiler.impl.Constant;
33
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
33
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
34
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
34
import org.eclipse.jdt.internal.compiler.util.Util;
35
import org.eclipse.jdt.internal.compiler.util.Util;
35
36
Lines 1187-1192 Link Here
1187
1188
1188
		// find & report collision cases
1189
		// find & report collision cases
1189
		boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
1190
		boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
1191
		boolean compliance16 = this.scope.compilerOptions().complianceLevel == ClassFileConstants.JDK1_6;
1192
		int severity = ProblemSeverities.Error;
1190
		for (int i = 0, length = this.methods.length; i < length; i++) {
1193
		for (int i = 0, length = this.methods.length; i < length; i++) {
1191
			MethodBinding method = resolvedMethods[i];
1194
			MethodBinding method = resolvedMethods[i];
1192
			if (method == null)
1195
			if (method == null)
Lines 1199-1210 Link Here
1199
					continue nextSibling;
1202
					continue nextSibling;
1200
				if (!CharOperation.equals(selector, method2.selector))
1203
				if (!CharOperation.equals(selector, method2.selector))
1201
					break nextSibling; // methods with same selector are contiguous
1204
					break nextSibling; // methods with same selector are contiguous
1202
1205
				
1203
				if (complyTo15 ? !method.areParameterErasuresEqual(method2) : !method.areParametersEqual(method2))
1206
//				if (compliance16 && method.returnType != null && method2.returnType != null) {
1204
					continue nextSibling; // otherwise duplicates / name clash
1207
//						// 8.4.2, for collision to be detected between m1 and m2:
1208
//						// signature(m1) == signature(m2) i.e. same arity, same type parameter count, can be substituted
1209
//						// signature(m1) == erasure(signature(m2)) or erasure(signature(m1)) == signature(m2)
1210
//						TypeBinding[] params1 = method.parameters;
1211
//						TypeBinding[] params2 = method2.parameters;
1212
//						int pLength = params1.length;
1213
//						if (pLength != params2.length)
1214
//							continue nextSibling;
1215
//						if (pLength > 0) {
1216
//							// check to see if the erasure of either method is equal to the other
1217
//							int index = pLength;
1218
//							for (; --index >= 0;) {
1219
//								if (params1[index] != params2[index].erasure())
1220
//									break;
1221
//								if (params1[index] == params2[index]) {
1222
//									TypeBinding type = params1[index].leafComponentType();
1223
//									if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
1224
//										index = pLength; // handle comparing identical source types like X<T>... its erasure is itself BUT we need to answer false
1225
//										break;
1226
//									}
1227
//								}
1228
//							}
1229
//							if (index >= 0 && index < pLength) {
1230
//								for (index = pLength; --index >= 0;)
1231
//									if (params1[index].erasure() != params2[index])
1232
//										break;
1233
//							}
1234
//							if (index >= 0)
1235
//								continue nextSibling;
1236
//						}
1237
//						boolean equalParams = method.areParametersEqual(method2);
1238
//						boolean equalParamsErasure = method.areParameterErasuresEqual(method2);
1239
//						if (equalParams) {
1240
//							// duplicates regardless of return types
1241
//						} else if (equalParamsErasure){
1242
//							// with fix for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1243
//							// we now ignore return types in 1.7 when detecting duplicates, just as we did before 1.5 
1244
//							// name clash for sure if not duplicates, report as duplicates
1245
//							// Only in 1.6, we have to make sure even return types are same
1246
//							if (compliance16) {
1247
//								if (method.returnType.erasure() != method2.returnType.erasure()) {
1248
//									severity = ProblemSeverities.Warning;
1249
//								}
1250
//								// else return types also equal. All conditions satisfied
1251
//								// to give error in 1.6 compliance as well.
1252
//							}
1253
//						}
1254
//					} 
1255
1256
				if (complyTo15 && method.areParameterErasuresEqual(method2)) {
1257
					// we now ignore return types in 1.7 when detecting duplicates, just as we did before 1.5 
1258
					// name clash for sure if not duplicates, report as duplicates
1259
					// Only in 1.6, we have to make sure even return types are same
1260
					if (compliance16 && method.returnType != null && method2.returnType != null) {
1261
						if (!method.areParametersEqual(method2) && method.returnType.erasure() != method2.returnType.erasure()) {
1262
							severity = ProblemSeverities.Warning;
1263
						}
1264
						// else return types also equal. All conditions satisfied
1265
						// to give error in 1.6 compliance as well.
1266
					}
1267
				} else if (!method.areParametersEqual(method2)) {
1268
					// prior to 1.5, parameters identical meant a collision case
1269
					continue nextSibling;
1270
				}
1271
				// otherwise duplicates / name clash
1205
				boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
1272
				boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
1206
				// report duplicate
1273
				// report duplicate
1207
				boolean removeMethod2 = true;
1274
				boolean removeMethod2 = (severity == ProblemSeverities.Error) ? true : false; // do not remove if in 1.6 and just a warning given
1208
				if (methodDecl == null) {
1275
				if (methodDecl == null) {
1209
					methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
1276
					methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
1210
					if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
1277
					if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
Lines 1214-1220 Link Here
1214
							// remove user defined methods & keep the synthetic
1281
							// remove user defined methods & keep the synthetic
1215
							removeMethod = true;
1282
							removeMethod = true;
1216
						} else {
1283
						} else {
1217
							this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
1284
							this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2), severity);
1218
						}
1285
						}
1219
						if (removeMethod) {
1286
						if (removeMethod) {
1220
							removeMethod2 = false;
1287
							removeMethod2 = false;
Lines 1233-1239 Link Here
1233
						this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
1300
						this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
1234
						removeMethod2 = true;
1301
						removeMethod2 = true;
1235
					} else {
1302
					} else {
1236
						this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
1303
						this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2), severity);
1237
					}
1304
					}
1238
					if (removeMethod2) {
1305
					if (removeMethod2) {
1239
						method2Decl.binding = null;
1306
						method2Decl.binding = null;
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-2 / +5 lines)
Lines 1597-1603 Link Here
1597
		nodeSourceStart(local, location),
1597
		nodeSourceStart(local, location),
1598
		nodeSourceEnd(local, location));
1598
		nodeSourceEnd(local, location));
1599
}
1599
}
1600
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, boolean equalParameters) {
1600
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, boolean equalParameters, int severity) {
1601
    MethodBinding method = methodDecl.binding;
1601
    MethodBinding method = methodDecl.binding;
1602
    if (equalParameters) {
1602
    if (equalParameters) {
1603
		this.handle(
1603
		this.handle(
Lines 1610-1615 Link Here
1610
				new String(methodDecl.selector),
1610
				new String(methodDecl.selector),
1611
				new String(method.declaringClass.shortReadableName()),
1611
				new String(method.declaringClass.shortReadableName()),
1612
				typesAsString(method, true)},
1612
				typesAsString(method, true)},
1613
			severity,
1613
			methodDecl.sourceStart,
1614
			methodDecl.sourceStart,
1614
			methodDecl.sourceEnd);
1615
			methodDecl.sourceEnd);
1615
    } else {
1616
    } else {
Lines 1630-1635 Link Here
1630
				new String(method.declaringClass.shortReadableName()),
1631
				new String(method.declaringClass.shortReadableName()),
1631
				typesAsString(method, true),
1632
				typesAsString(method, true),
1632
				typesAsString(method, erasures, true) },
1633
				typesAsString(method, erasures, true) },
1634
			severity,
1633
			methodDecl.sourceStart,
1635
			methodDecl.sourceStart,
1634
			methodDecl.sourceEnd);
1636
			methodDecl.sourceEnd);
1635
    }
1637
    }
Lines 5095-5101 Link Here
5095
		method.sourceEnd);
5097
		method.sourceEnd);
5096
}
5098
}
5097
5099
5098
public void methodNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod) {
5100
public void methodNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod, int severity) {
5099
	this.handle(
5101
	this.handle(
5100
		IProblem.MethodNameClash,
5102
		IProblem.MethodNameClash,
5101
		new String[] {
5103
		new String[] {
Lines 5112-5117 Link Here
5112
			typesAsString(inheritedMethod, true),
5114
			typesAsString(inheritedMethod, true),
5113
			new String(inheritedMethod.declaringClass.shortReadableName()),
5115
			new String(inheritedMethod.declaringClass.shortReadableName()),
5114
		 },
5116
		 },
5117
		severity,
5115
		currentMethod.sourceStart(),
5118
		currentMethod.sourceStart(),
5116
		currentMethod.sourceEnd());
5119
		currentMethod.sourceEnd());
5117
}
5120
}
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-11 / +16 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 3697-3712 Link Here
3697
			"  }\n" +
3697
			"  }\n" +
3698
			"}",
3698
			"}",
3699
		},
3699
		},
3700
		"----------\n" +
3700
		"----------\n" + 
3701
		"1. ERROR in p\\Toplevel12.java (at line 4)\n" +
3701
		"1. ERROR in p\\Toplevel12.java (at line 4)\n" + 
3702
		"	Object local(){\n" +
3702
		"	Object local(){\n" + 
3703
		"	       ^^^^^^^\n" +
3703
		"	       ^^^^^^^\n" + 
3704
		"Duplicate method local() in type Toplevel12\n" +
3704
		"Duplicate method local() in type Toplevel12\n" + 
3705
		"----------\n" +
3705
		"----------\n" + 
3706
		"2. ERROR in p\\Toplevel12.java (at line 17)\n" +
3706
		"2. ERROR in p\\Toplevel12.java (at line 15)\n" + 
3707
		"	void local(){\n" +
3707
		"	return new Package2.Sub();\n" + 
3708
		"	     ^^^^^^^\n" +
3708
		"	       ^^^^^^^^^^^^^^^^^^\n" + 
3709
		"Duplicate method local() in type Toplevel12\n" +
3709
		"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" + 
3710
		"----------\n" + 
3711
		"3. ERROR in p\\Toplevel12.java (at line 17)\n" + 
3712
		"	void local(){\n" + 
3713
		"	     ^^^^^^^\n" + 
3714
		"Duplicate method local() in type Toplevel12\n" + 
3710
		"----------\n"
3715
		"----------\n"
3711
	);
3716
	);
3712
}
3717
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-190 / +444 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 278-300 Link Here
278
	}
279
	}
279
	public void test006() {
280
	public void test006() {
280
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
281
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
281
		this.runNegativeTest(
282
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
282
			new String[] {
283
		"----------\n" + 
283
				"X.java",
284
		"1. ERROR in X.java (at line 3)\n" + 
284
				"public class X<T> {\n" +
285
		"	new Y<Object>().foo(\"X\");\n" + 
285
				"   void test() {\n" +
286
		"	                ^^^\n" + 
286
				"   	new Y<Object>().foo(\"X\");\n" +
287
		"The method foo(Object) is ambiguous for the type Y<Object>\n" + 
287
				"   	new Y<Object>().foo2(\"X\");\n" +
288
		"----------\n" + 
288
				"   }\n" +
289
		"2. ERROR in X.java (at line 4)\n" + 
289
				"	<U1> U1 foo(U1 t) {return null;}\n" +
290
		"	new Y<Object>().foo2(\"X\");\n" + 
290
				"	<U2> U2 foo2(U2 t) {return null;}\n" +
291
		"	                ^^^^\n" + 
291
				"}\n" +
292
		"The method foo2(Object) is ambiguous for the type Y<Object>\n" + 
292
				"class Y<T2> extends X<T2> {\n" +
293
		"----------\n" + 
293
				"	void foo(T2 t) {}\n" +
294
		"3. WARNING in X.java (at line 10)\n" + 
294
				"	<U3> void foo2(T2 t) {}\n" +
295
		"	void foo(T2 t) {}\n" + 
295
				"}\n"
296
		"	     ^^^^^^^^^\n" + 
296
			},
297
		"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" +
298
		"----------\n" + 
299
		"4. WARNING in X.java (at line 11)\n" + 
300
		"	<U3> void foo2(T2 t) {}\n" + 
301
		"	          ^^^^^^^^^^\n" + 
302
		"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" + 
303
		"----------\n":
304
			"----------\n" + 
298
			"1. ERROR in X.java (at line 3)\n" + 
305
			"1. ERROR in X.java (at line 3)\n" + 
299
			"	new Y<Object>().foo(\"X\");\n" + 
306
			"	new Y<Object>().foo(\"X\");\n" + 
300
			"	                ^^^\n" + 
307
			"	                ^^^\n" + 
Lines 314-320 Link Here
314
			"	<U3> void foo2(T2 t) {}\n" + 
321
			"	<U3> void foo2(T2 t) {}\n" + 
315
			"	          ^^^^^^^^^^\n" + 
322
			"	          ^^^^^^^^^^\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" + 
323
			"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"
324
			"----------\n";
325
		this.runNegativeTest(
326
			new String[] {
327
				"X.java",
328
				"public class X<T> {\n" +
329
				"   void test() {\n" +
330
				"   	new Y<Object>().foo(\"X\");\n" +
331
				"   	new Y<Object>().foo2(\"X\");\n" +
332
				"   }\n" +
333
				"	<U1> U1 foo(U1 t) {return null;}\n" +
334
				"	<U2> U2 foo2(U2 t) {return null;}\n" +
335
				"}\n" +
336
				"class Y<T2> extends X<T2> {\n" +
337
				"	void foo(T2 t) {}\n" +
338
				"	<U3> void foo2(T2 t) {}\n" +
339
				"}\n"
340
			},
341
			expectedCompilerLog
318
		);
342
		);
319
/* javac 7
343
/* javac 7
320
X.java:3: reference to foo is ambiguous, both method <U1>foo(U1) in X and method
344
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
565
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090
542
	public void test011a() {
566
	public void test011a() {
543
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
567
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
568
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
569
		"----------\n" + 
570
		"1. WARNING in Combined.java (at line 2)\n" + 
571
		"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
572
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
573
		"Method pickOne(T) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
574
		"----------\n" + 
575
		"2. WARNING in Combined.java (at line 3)\n" + 
576
		"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
577
		"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
578
		"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
579
		"----------\n":
580
			"----------\n" + 
581
			"1. ERROR in Combined.java (at line 2)\n" + 
582
			"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
583
			"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
584
			"Method pickOne(T) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
585
			"----------\n" + 
586
			"2. ERROR in Combined.java (at line 3)\n" + 
587
			"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
588
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
589
			"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Combined<A,B>\n" + 
590
			"----------\n";
544
		this.runNegativeTest(
591
		this.runNegativeTest(
545
			new String[] {
592
			new String[] {
546
				"Combined.java",
593
				"Combined.java",
Lines 555-571 Link Here
555
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
602
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
556
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
603
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
557
			},
604
			},
558
			"----------\n" + 
605
			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
		);
606
		);
570
/* javac 7
607
/* javac 7
571
X.java:3: name clash: <T#1>pickOne(Comparable<T#1>) and <T#2>pickOne(T#2) have the same erasure
608
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
617
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090
581
	public void test011b() {
618
	public void test011b() {
582
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
619
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
583
		this.runNegativeTest(
620
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
584
			new String[] {
621
		"----------\n" + 
585
				"Test1.java",
622
		"1. WARNING in Test1.java (at line 2)\n" + 
586
				"public class Test1<AA, BB> {\n" +
623
		"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
587
				"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" +
624
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
588
				"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" +
625
		"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" +
626
		"----------\n" + 
590
				"}\n" +
627
		"2. WARNING in Test1.java (at line 3)\n" + 
591
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
628
		"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" + 
592
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
629
		"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
593
			},
630
		"Method pickOne(Comparable<T>) has the same erasure pickOne(Comparable<T>) as another method in type Test1<AA,BB>\n" + 
631
		"----------\n" + 
632
		"3. WARNING in Test1.java (at line 4)\n" + 
633
		"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
634
		"	                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
635
		"Type safety: Unchecked invocation pickOne(Comparable) of the generic method pickOne(T) of type Test1<Integer,Integer>\n" + 
636
		"----------\n" + 
637
		"4. WARNING in Test1.java (at line 4)\n" + 
638
		"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
639
		"	                                                                  ^^^^^^^^^^\n" + 
640
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
641
		"----------\n":
594
			"----------\n" + 
642
			"----------\n" + 
595
			"1. ERROR in Test1.java (at line 2)\n" + 
643
			"1. ERROR in Test1.java (at line 2)\n" + 
596
			"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" + 
644
			"	<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" + 
659
			"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" + 
612
			"	                                                                  ^^^^^^^^^^\n" + 
660
			"	                                                                  ^^^^^^^^^^\n" + 
613
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
661
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
614
			"----------\n"
662
			"----------\n";
663
		this.runNegativeTest(
664
			new String[] {
665
				"Test1.java",
666
				"public class Test1<AA, BB> {\n" +
667
				"	<T extends Comparable<T>> void pickOne(T value) throws ExOne {}\n" +
668
				"	<T> T pickOne(Comparable<T> value) throws ExTwo { return null;}\n" +
669
				"	void pickOne2(Test1<Integer,Integer> c) throws ExOne { c.pickOne((Comparable) \"test\"); }\n" +
670
				"}\n" +
671
				"class ExOne extends Exception {static final long serialVersionUID = 1;}\n" +
672
				"class ExTwo extends Exception {static final long serialVersionUID = 2;}"
673
			},
674
			expectedCompilerLog
615
		);
675
		);
616
/* javac 7
676
/* javac 7
617
X.java:3: name clash: <T#1>pickOne(Comparable<T#1>) and <T#2>pickOne(T#2) have the same erasure
677
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
1630
	// variant: having both methods in the same class should not change anything
1571
	public void test021() {
1631
	public void test021() {
1572
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1632
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1573
		this.runNegativeTest(
1633
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
1574
			new String[] {
1634
		"----------\n" + 
1575
				"Y.java",
1635
		"1. WARNING in Y.java (at line 3)\n" + 
1576
				"class X<T extends Object> {\n" +
1636
		"	public class Y<V extends String> extends X<V> {\n" + 
1577
				"}\n" +
1637
		"	                         ^^^^^^\n" + 
1578
				"public class Y<V extends String> extends X<V> {\n" +
1638
		"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" +
1639
		"----------\n" + 
1580
				"    System.out.print(true);\n" +
1640
		"2. WARNING in Y.java (at line 4)\n" + 
1581
				"    return new Y<W>();\n" +
1641
		"	public static <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1582
				"  }\n" +
1642
		"	                         ^^^^^^\n" + 
1583
				"  public static <U extends Object> X<U> make(Class<U> clazz) {\n" +
1643
		"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" +
1644
		"----------\n" + 
1585
				"    return new X<U>();\n" +
1645
		"3. WARNING in Y.java (at line 4)\n" + 
1586
				"  }\n" +
1646
		"	public static <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1587
				"  public static void main(String[] args) throws Exception {\n" +
1647
		"	                                      ^^^^^^^^^^^^^^^^^^^^\n" + 
1588
				"    Y.make(getClazz());\n" +
1648
		"Method make(Class<W>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1589
				"  }\n" +
1649
		"----------\n" + 
1590
				"  public static Class getClazz() {\n" +
1650
		"4. WARNING in Y.java (at line 8)\n" + 
1591
				"    return String.class;\n" +
1651
		"	public static <U extends Object> X<U> make(Class<U> clazz) {\n" + 
1592
				"  }\n" +
1652
		"	                                      ^^^^^^^^^^^^^^^^^^^^\n" + 
1593
				"}"
1653
		"Method make(Class<U>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1594
			},
1654
		"----------\n" + 
1655
		"5. WARNING in Y.java (at line 13)\n" + 
1656
		"	Y.make(getClazz());\n" + 
1657
		"	^^^^^^^^^^^^^^^^^^\n" + 
1658
		"Type safety: Unchecked invocation make(Class) of the generic method make(Class<W>) of type Y\n" + 
1659
		"----------\n" + 
1660
		"6. WARNING in Y.java (at line 13)\n" + 
1661
		"	Y.make(getClazz());\n" + 
1662
		"	       ^^^^^^^^^^\n" + 
1663
		"Type safety: The expression of type Class needs unchecked conversion to conform to Class<String>\n" + 
1664
		"----------\n" + 
1665
		"7. WARNING in Y.java (at line 15)\n" + 
1666
		"	public static Class getClazz() {\n" + 
1667
		"	              ^^^^^\n" + 
1668
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1669
		"----------\n":
1595
			"----------\n" + 
1670
			"----------\n" + 
1596
			"1. WARNING in Y.java (at line 3)\n" + 
1671
			"1. WARNING in Y.java (at line 3)\n" + 
1597
			"	public class Y<V extends String> extends X<V> {\n" + 
1672
			"	public class Y<V extends String> extends X<V> {\n" + 
Lines 1627-1633 Link Here
1627
			"	public static Class getClazz() {\n" + 
1702
			"	public static Class getClazz() {\n" + 
1628
			"	              ^^^^^\n" + 
1703
			"	              ^^^^^\n" + 
1629
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1704
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1630
			"----------\n"
1705
			"----------\n";
1706
		this.runNegativeTest(
1707
			new String[] {
1708
				"Y.java",
1709
				"class X<T extends Object> {\n" +
1710
				"}\n" +
1711
				"public class Y<V extends String> extends X<V> {\n" +
1712
				"  public static <W extends String> Y<W> make(Class<W> clazz) {\n" +
1713
				"    System.out.print(true);\n" +
1714
				"    return new Y<W>();\n" +
1715
				"  }\n" +
1716
				"  public static <U extends Object> X<U> make(Class<U> clazz) {\n" +
1717
				"    System.out.print(false);\n" +
1718
				"    return new X<U>();\n" +
1719
				"  }\n" +
1720
				"  public static void main(String[] args) throws Exception {\n" +
1721
				"    Y.make(getClazz());\n" +
1722
				"  }\n" +
1723
				"  public static Class getClazz() {\n" +
1724
				"    return String.class;\n" +
1725
				"  }\n" +
1726
				"}"
1727
			},
1728
			expectedCompilerLog
1631
		);
1729
		);
1632
/* javac 7
1730
/* javac 7
1633
X.java:8: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
1731
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
1757
	// variant: using instances triggers raw methods, which are ambiguous
1660
	public void test022() {
1758
	public void test022() {
1661
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1759
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950
1662
		this.runNegativeTest(
1760
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
1663
			new String[] {
1761
		"----------\n" + 
1664
				"X.java",
1762
		"1. WARNING in X.java (at line 3)\n" + 
1665
				"public class X<T extends Object> {\n" +
1763
		"	class Y<V extends String> extends X<V> {\n" + 
1666
				"}\n" +
1764
		"	                  ^^^^^^\n" + 
1667
				"class Y<V extends String> extends X<V> {\n" +
1765
		"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" +
1766
		"----------\n" + 
1669
				"    return new Y<W>();\n" +
1767
		"2. WARNING in X.java (at line 4)\n" + 
1670
				"  }\n" +
1768
		"	public <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1671
				"  public <U extends Object> X<U> make(Class<U> clazz) {\n" +
1769
		"	                  ^^^^^^\n" + 
1672
				"    return new X<U>();\n" +
1770
		"The type parameter W should not be bounded by the final type String. Final types cannot be further extended\n" + 
1673
				"  }\n" +
1771
		"----------\n" + 
1674
				"  public static void main(String[] args) throws Exception {\n" +
1772
		"3. WARNING in X.java (at line 4)\n" + 
1675
				"    Y y = new Y();\n" +
1773
		"	public <W extends String> Y<W> make(Class<W> clazz) {\n" + 
1676
				"    y.make(String.class);\n" +
1774
		"	                               ^^^^^^^^^^^^^^^^^^^^\n" + 
1677
				"    y.make(getClazz());\n" +
1775
		"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" +
1776
		"----------\n" + 
1679
				"  }\n" +
1777
		"4. WARNING in X.java (at line 7)\n" + 
1680
				"  public static Class getClazz() {\n" +
1778
		"	public <U extends Object> X<U> make(Class<U> clazz) {\n" + 
1681
				"    return String.class;\n" +
1779
		"	                               ^^^^^^^^^^^^^^^^^^^^\n" + 
1682
				"  }\n" +
1780
		"Method make(Class<U>) has the same erasure make(Class<T>) as another method in type Y<V>\n" + 
1683
				"}"
1781
		"----------\n" + 
1684
			},
1782
		"5. WARNING in X.java (at line 11)\n" + 
1783
		"	Y y = new Y();\n" + 
1784
		"	^\n" + 
1785
		"Y is a raw type. References to generic type Y<V> should be parameterized\n" + 
1786
		"----------\n" + 
1787
		"6. WARNING in X.java (at line 11)\n" + 
1788
		"	Y y = new Y();\n" + 
1789
		"	          ^\n" + 
1790
		"Y is a raw type. References to generic type Y<V> should be parameterized\n" + 
1791
		"----------\n" + 
1792
		"7. ERROR in X.java (at line 12)\n" + 
1793
		"	y.make(String.class);\n" + 
1794
		"	  ^^^^\n" + 
1795
		"The method make(Class) is ambiguous for the type Y\n" + 
1796
		"----------\n" + 
1797
		"8. ERROR in X.java (at line 13)\n" + 
1798
		"	y.make(getClazz());\n" + 
1799
		"	  ^^^^\n" + 
1800
		"The method make(Class) is ambiguous for the type Y\n" + 
1801
		"----------\n" + 
1802
		"9. ERROR in X.java (at line 14)\n" + 
1803
		"	y.make(getClazz().newInstance().getClass());\n" + 
1804
		"	  ^^^^\n" + 
1805
		"The method make(Class) is ambiguous for the type Y\n" + 
1806
		"----------\n" + 
1807
		"10. WARNING in X.java (at line 16)\n" + 
1808
		"	public static Class getClazz() {\n" + 
1809
		"	              ^^^^^\n" + 
1810
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1811
		"----------\n":
1685
			"----------\n" + 
1812
			"----------\n" + 
1686
			"1. WARNING in X.java (at line 3)\n" + 
1813
			"1. WARNING in X.java (at line 3)\n" + 
1687
			"	class Y<V extends String> extends X<V> {\n" + 
1814
			"	class Y<V extends String> extends X<V> {\n" + 
Lines 1732-1738 Link Here
1732
			"	public static Class getClazz() {\n" + 
1859
			"	public static Class getClazz() {\n" + 
1733
			"	              ^^^^^\n" + 
1860
			"	              ^^^^^\n" + 
1734
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1861
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
1735
			"----------\n"
1862
			"----------\n";
1863
		this.runNegativeTest(
1864
			new String[] {
1865
				"X.java",
1866
				"public class X<T extends Object> {\n" +
1867
				"}\n" +
1868
				"class Y<V extends String> extends X<V> {\n" +
1869
				"  public <W extends String> Y<W> make(Class<W> clazz) {\n" +
1870
				"    return new Y<W>();\n" +
1871
				"  }\n" +
1872
				"  public <U extends Object> X<U> make(Class<U> clazz) {\n" +
1873
				"    return new X<U>();\n" +
1874
				"  }\n" +
1875
				"  public static void main(String[] args) throws Exception {\n" +
1876
				"    Y y = new Y();\n" +
1877
				"    y.make(String.class);\n" +
1878
				"    y.make(getClazz());\n" +
1879
				"    y.make(getClazz().newInstance().getClass());\n" +
1880
				"  }\n" +
1881
				"  public static Class getClazz() {\n" +
1882
				"    return String.class;\n" +
1883
				"  }\n" +
1884
				"}"
1885
			},
1886
			expectedCompilerLog
1736
		);
1887
		);
1737
/* javac 7
1888
/* javac 7
1738
X.java:7: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
1889
X.java:7: name clash: <U>make(Class<U>) and <W>make(Class<W>) have the same erasure
Lines 3274-3279 Link Here
3274
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=268837
3425
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=268837
3275
// See that this test case exhibits the bug 345947
3426
// See that this test case exhibits the bug 345947
3276
public void test076() {
3427
public void test076() {
3428
	String output = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3429
			"----------\n" + 
3430
			"1. WARNING in X.java (at line 8)\n" + 
3431
			"	<U> J<String> b();\n" + 
3432
			"	              ^^^\n" + 
3433
			"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" + 
3434
			"----------\n" + 
3435
			"2. ERROR in X.java (at line 15)\n" + 
3436
			"	J<Integer> b = ints.a();\n" + 
3437
			"	               ^^^^^^^^\n" + 
3438
			"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3439
			"----------\n" + 
3440
			"3. ERROR in X.java (at line 16)\n" + 
3441
			"	J<Object> c = ints.a();\n" + 
3442
			"	              ^^^^^^^^\n" + 
3443
			"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3444
			"----------\n" + 
3445
			"4. WARNING in X.java (at line 17)\n" + 
3446
			"	J d = ints.a();\n" + 
3447
			"	^\n" + 
3448
			"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3449
			"----------\n" + 
3450
			"5. ERROR in X.java (at line 19)\n" + 
3451
			"	I<Integer> f = ints.a();\n" + 
3452
			"	               ^^^^^^^^\n" + 
3453
			"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3454
			"----------\n" + 
3455
			"6. ERROR in X.java (at line 20)\n" + 
3456
			"	I<Object> g = ints.a();\n" + 
3457
			"	              ^^^^^^^^\n" + 
3458
			"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3459
			"----------\n" + 
3460
			"7. WARNING in X.java (at line 21)\n" + 
3461
			"	I h = ints.a();\n" + 
3462
			"	^\n" + 
3463
			"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3464
			"----------\n" + 
3465
			"8. ERROR in X.java (at line 24)\n" + 
3466
			"	ints.b();\n" + 
3467
			"	     ^\n" + 
3468
			"The method b() is ambiguous for the type J<Integer>\n" + 
3469
			"----------\n" + 
3470
			"9. ERROR in X.java (at line 25)\n" + 
3471
			"	J<String> a = ints.b();\n" + 
3472
			"	                   ^\n" + 
3473
			"The method b() is ambiguous for the type J<Integer>\n" + 
3474
			"----------\n" + 
3475
			"10. ERROR in X.java (at line 26)\n" + 
3476
			"	J<Integer> b = ints.b();\n" + 
3477
			"	                    ^\n" + 
3478
			"The method b() is ambiguous for the type J<Integer>\n" + 
3479
			"----------\n" + 
3480
			"11. ERROR in X.java (at line 27)\n" + 
3481
			"	J<Object> c = ints.b();\n" + 
3482
			"	                   ^\n" + 
3483
			"The method b() is ambiguous for the type J<Integer>\n" + 
3484
			"----------\n" + 
3485
			"12. WARNING in X.java (at line 28)\n" + 
3486
			"	J d = ints.b();\n" + 
3487
			"	^\n" + 
3488
			"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3489
			"----------\n" + 
3490
			"13. ERROR in X.java (at line 28)\n" + 
3491
			"	J d = ints.b();\n" + 
3492
			"	           ^\n" + 
3493
			"The method b() is ambiguous for the type J<Integer>\n" + 
3494
			"----------\n" + 
3495
			"14. ERROR in X.java (at line 29)\n" + 
3496
			"	I<String> e = ints.b();\n" + 
3497
			"	                   ^\n" + 
3498
			"The method b() is ambiguous for the type J<Integer>\n" + 
3499
			"----------\n" + 
3500
			"15. ERROR in X.java (at line 30)\n" + 
3501
			"	I<Integer> f = ints.b();\n" + 
3502
			"	                    ^\n" + 
3503
			"The method b() is ambiguous for the type J<Integer>\n" + 
3504
			"----------\n" + 
3505
			"16. ERROR in X.java (at line 31)\n" + 
3506
			"	I<Object> g = ints.b();\n" + 
3507
			"	                   ^\n" + 
3508
			"The method b() is ambiguous for the type J<Integer>\n" + 
3509
			"----------\n" + 
3510
			"17. WARNING in X.java (at line 32)\n" + 
3511
			"	I h = ints.b();\n" + 
3512
			"	^\n" + 
3513
			"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3514
			"----------\n" + 
3515
			"18. ERROR in X.java (at line 32)\n" + 
3516
			"	I h = ints.b();\n" + 
3517
			"	           ^\n" + 
3518
			"The method b() is ambiguous for the type J<Integer>\n" + 
3519
			"----------\n" + 
3520
			"19. WARNING in X.java (at line 39)\n" + 
3521
			"	J d = ints.c();\n" + 
3522
			"	^\n" + 
3523
			"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3524
			"----------\n" + 
3525
			"20. WARNING in X.java (at line 43)\n" + 
3526
			"	I h = ints.c();\n" + 
3527
			"	^\n" + 
3528
			"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3529
			"----------\n":
3530
				"----------\n" + 
3531
				"1. ERROR in X.java (at line 8)\n" + 
3532
				"	<U> J<String> b();\n" + 
3533
				"	              ^^^\n" + 
3534
				"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" + 
3535
				"----------\n" + 
3536
				"2. ERROR in X.java (at line 15)\n" + 
3537
				"	J<Integer> b = ints.a();\n" + 
3538
				"	               ^^^^^^^^\n" + 
3539
				"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3540
				"----------\n" + 
3541
				"3. ERROR in X.java (at line 16)\n" + 
3542
				"	J<Object> c = ints.a();\n" + 
3543
				"	              ^^^^^^^^\n" + 
3544
				"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3545
				"----------\n" + 
3546
				"4. WARNING in X.java (at line 17)\n" + 
3547
				"	J d = ints.a();\n" + 
3548
				"	^\n" + 
3549
				"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3550
				"----------\n" + 
3551
				"5. ERROR in X.java (at line 19)\n" + 
3552
				"	I<Integer> f = ints.a();\n" + 
3553
				"	               ^^^^^^^^\n" + 
3554
				"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3555
				"----------\n" + 
3556
				"6. ERROR in X.java (at line 20)\n" + 
3557
				"	I<Object> g = ints.a();\n" + 
3558
				"	              ^^^^^^^^\n" + 
3559
				"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3560
				"----------\n" + 
3561
				"7. WARNING in X.java (at line 21)\n" + 
3562
				"	I h = ints.a();\n" + 
3563
				"	^\n" + 
3564
				"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3565
				"----------\n" + 
3566
				"8. ERROR in X.java (at line 24)\n" + 
3567
				"	ints.b();\n" + 
3568
				"	     ^\n" + 
3569
				"The method b() is ambiguous for the type J<Integer>\n" + 
3570
				"----------\n" + 
3571
				"9. ERROR in X.java (at line 25)\n" + 
3572
				"	J<String> a = ints.b();\n" + 
3573
				"	                   ^\n" + 
3574
				"The method b() is ambiguous for the type J<Integer>\n" + 
3575
				"----------\n" + 
3576
				"10. ERROR in X.java (at line 26)\n" + 
3577
				"	J<Integer> b = ints.b();\n" + 
3578
				"	                    ^\n" + 
3579
				"The method b() is ambiguous for the type J<Integer>\n" + 
3580
				"----------\n" + 
3581
				"11. ERROR in X.java (at line 27)\n" + 
3582
				"	J<Object> c = ints.b();\n" + 
3583
				"	                   ^\n" + 
3584
				"The method b() is ambiguous for the type J<Integer>\n" + 
3585
				"----------\n" + 
3586
				"12. WARNING in X.java (at line 28)\n" + 
3587
				"	J d = ints.b();\n" + 
3588
				"	^\n" + 
3589
				"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3590
				"----------\n" + 
3591
				"13. ERROR in X.java (at line 28)\n" + 
3592
				"	J d = ints.b();\n" + 
3593
				"	           ^\n" + 
3594
				"The method b() is ambiguous for the type J<Integer>\n" + 
3595
				"----------\n" + 
3596
				"14. ERROR in X.java (at line 29)\n" + 
3597
				"	I<String> e = ints.b();\n" + 
3598
				"	                   ^\n" + 
3599
				"The method b() is ambiguous for the type J<Integer>\n" + 
3600
				"----------\n" + 
3601
				"15. ERROR in X.java (at line 30)\n" + 
3602
				"	I<Integer> f = ints.b();\n" + 
3603
				"	                    ^\n" + 
3604
				"The method b() is ambiguous for the type J<Integer>\n" + 
3605
				"----------\n" + 
3606
				"16. ERROR in X.java (at line 31)\n" + 
3607
				"	I<Object> g = ints.b();\n" + 
3608
				"	                   ^\n" + 
3609
				"The method b() is ambiguous for the type J<Integer>\n" + 
3610
				"----------\n" + 
3611
				"17. WARNING in X.java (at line 32)\n" + 
3612
				"	I h = ints.b();\n" + 
3613
				"	^\n" + 
3614
				"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3615
				"----------\n" + 
3616
				"18. ERROR in X.java (at line 32)\n" + 
3617
				"	I h = ints.b();\n" + 
3618
				"	           ^\n" + 
3619
				"The method b() is ambiguous for the type J<Integer>\n" + 
3620
				"----------\n" + 
3621
				"19. WARNING in X.java (at line 39)\n" + 
3622
				"	J d = ints.c();\n" + 
3623
				"	^\n" + 
3624
				"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3625
				"----------\n" + 
3626
				"20. WARNING in X.java (at line 43)\n" + 
3627
				"	I h = ints.c();\n" + 
3628
				"	^\n" + 
3629
				"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3630
				"----------\n";
3277
	this.runNegativeTest(
3631
	this.runNegativeTest(
3278
		new String[] {
3632
		new String[] {
3279
			"X.java",
3633
			"X.java",
Lines 3323-3429 Link Here
3323
			"	}\n" +
3677
			"	}\n" +
3324
			"}"
3678
			"}"
3325
		},
3679
		},
3326
		"----------\n" + 
3680
		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
	);
3681
	);
3428
}
3682
}
3429
3683
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-141 / +288 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[] { "test050l" };
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 3828-3833 Link Here
3828
	}
3881
	}
3829
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3882
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
3830
	public void test050c() {
3883
	public void test050c() {
3884
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
3885
				"----------\n" + 
3886
				"1. ERROR in X.java (at line 3)\n" + 
3887
				"	A<Y> foo(A<Y> o) {  return null; } // duplicate\n" + 
3888
				"	     ^^^^^^^^^^^\n" + 
3889
				"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3890
				"----------\n" + 
3891
				"2. ERROR in X.java (at line 4)\n" + 
3892
				"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" + 
3893
				"	     ^^^^^^^^^^^\n" + 
3894
				"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3895
				"----------\n" + 
3896
				"3. WARNING in X.java (at line 7)\n" + 
3897
				"	<T extends Y> T foo(A<Y> o) {  return null; } // ok\n" + 
3898
				"	                ^^^^^^^^^^^\n" + 
3899
				"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3900
				"----------\n" + 
3901
				"4. WARNING in X.java (at line 8)\n" + 
3902
				"	<T extends Z> T foo(A<Z> o) {  return null; } // ok\n" + 
3903
				"	                ^^^^^^^^^^^\n" + 
3904
				"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3905
				"----------\n":
3906
					"----------\n" + 
3907
					"1. ERROR in X.java (at line 3)\n" + 
3908
					"	A<Y> foo(A<Y> o) {  return null; } // duplicate\n" + 
3909
					"	     ^^^^^^^^^^^\n" + 
3910
					"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3911
					"----------\n" + 
3912
					"2. ERROR in X.java (at line 4)\n" + 
3913
					"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" + 
3914
					"	     ^^^^^^^^^^^\n" + 
3915
					"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + 
3916
					"----------\n" + 
3917
					"3. ERROR in X.java (at line 7)\n" + 
3918
					"	<T extends Y> T foo(A<Y> o) {  return null; } // ok\n" + 
3919
					"	                ^^^^^^^^^^^\n" + 
3920
					"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3921
					"----------\n" + 
3922
					"4. ERROR in X.java (at line 8)\n" + 
3923
					"	<T extends Z> T foo(A<Z> o) {  return null; } // ok\n" + 
3924
					"	                ^^^^^^^^^^^\n" + 
3925
					"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + 
3926
					"----------\n";
3831
		this.runNegativeTest(
3927
		this.runNegativeTest(
3832
			new String[] {
3928
			new String[] {
3833
				"X.java",
3929
				"X.java",
Lines 3845-3871 Link Here
3845
				"class Y {}\n" +
3941
				"class Y {}\n" +
3846
				"class Z {}"
3942
				"class Z {}"
3847
			},
3943
			},
3848
			"----------\n" + 
3944
			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
		);
3945
		);
3870
/* javac 7
3946
/* javac 7
3871
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure
3947
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure
Lines 3921-3926 Link Here
3921
3997
3922
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
3998
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423
3923
	public void test050e() {
3999
	public void test050e() {
4000
		String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
4001
				"----------\n" + 
4002
				"1. WARNING in X.java (at line 2)\n" + 
4003
				"	<N extends B> N a(A<String> s) { return null; }\n" + 
4004
				"	                ^^^^^^^^^^^^^^\n" + 
4005
				"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + 
4006
				"----------\n" + 
4007
				"2. WARNING in X.java (at line 3)\n" + 
4008
				"	<N> Object a(A<Number> n) { return null; }\n" + 
4009
				"	           ^^^^^^^^^^^^^^\n" + 
4010
				"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + 
4011
				"----------\n" + 
4012
				"3. WARNING in X.java (at line 4)\n" + 
4013
				"	<N extends B> void b(A<String> s) {}\n" + 
4014
				"	                   ^^^^^^^^^^^^^^\n" + 
4015
				"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4016
				"----------\n" + 
4017
				"4. WARNING in X.java (at line 5)\n" + 
4018
				"	<N extends B> B b(A<Number> n) { return null; }\n" + 
4019
				"	                ^^^^^^^^^^^^^^\n" + 
4020
				"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4021
				"----------\n" + 
4022
				"5. WARNING in X.java (at line 6)\n" + 
4023
				"	void c(A<String> s) {}\n" + 
4024
				"	     ^^^^^^^^^^^^^^\n" + 
4025
				"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + 
4026
				"----------\n" + 
4027
				"6. WARNING in X.java (at line 7)\n" + 
4028
				"	B c(A<Number> n) { return null; }\n" + 
4029
				"	  ^^^^^^^^^^^^^^\n" + 
4030
				"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + 
4031
				"----------\n":
4032
					"----------\n" + 
4033
					"1. ERROR in X.java (at line 2)\n" + 
4034
					"	<N extends B> N a(A<String> s) { return null; }\n" + 
4035
					"	                ^^^^^^^^^^^^^^\n" + 
4036
					"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + 
4037
					"----------\n" + 
4038
					"2. ERROR in X.java (at line 3)\n" + 
4039
					"	<N> Object a(A<Number> n) { return null; }\n" + 
4040
					"	           ^^^^^^^^^^^^^^\n" + 
4041
					"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + 
4042
					"----------\n" + 
4043
					"3. ERROR in X.java (at line 4)\n" + 
4044
					"	<N extends B> void b(A<String> s) {}\n" + 
4045
					"	                   ^^^^^^^^^^^^^^\n" + 
4046
					"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + 
4047
					"----------\n" + 
4048
					"4. ERROR in X.java (at line 5)\n" + 
4049
					"	<N extends B> B b(A<Number> n) { return null; }\n" + 
4050
					"	                ^^^^^^^^^^^^^^\n" + 
4051
					"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + 
4052
					"----------\n" + 
4053
					"5. ERROR in X.java (at line 6)\n" + 
4054
					"	void c(A<String> s) {}\n" + 
4055
					"	     ^^^^^^^^^^^^^^\n" + 
4056
					"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + 
4057
					"----------\n" + 
4058
					"6. ERROR in X.java (at line 7)\n" + 
4059
					"	B c(A<Number> n) { return null; }\n" + 
4060
					"	  ^^^^^^^^^^^^^^\n" + 
4061
					"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + 
4062
					"----------\n";
3924
		this.runNegativeTest(
4063
		this.runNegativeTest(
3925
			new String[] {
4064
			new String[] {
3926
				"X.java",
4065
				"X.java",
Lines 3935-3971 Link Here
3935
				"class A<T> {}\n" +
4074
				"class A<T> {}\n" +
3936
				"class B {}\n"
4075
				"class B {}\n"
3937
			},
4076
			},
3938
			"----------\n" + 
4077
			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
		);
4078
		);
3970
/* javac 7
4079
/* javac 7
3971
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure
4080
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure
Lines 4254-4279 Link Here
4254
				"class A<T> {}\n" +
4363
				"class A<T> {}\n" +
4255
				"class B {}\n"
4364
				"class B {}\n"
4256
			},
4365
			},
4257
			"----------\n" +
4366
			"----------\n" + 
4258
			"1. ERROR in X.java (at line 2)\n" +
4367
			"1. ERROR in X.java (at line 2)\n" + 
4259
			"	void a(A<Number> s) {}\n" +
4368
			"	void a(A<Number> s) {}\n" + 
4260
			"	     ^^^^^^^^^^^^^^\n" +
4369
			"	     ^^^^^^^^^^^^^^\n" + 
4261
			"Duplicate method a(A<Number>) in type X\n" +
4370
			"Duplicate method a(A<Number>) in type X\n" + 
4262
			"----------\n" +
4371
			"----------\n" + 
4263
			"2. ERROR in X.java (at line 3)\n" +
4372
			"2. ERROR in X.java (at line 3)\n" + 
4264
			"	B a(A<Number> n) { return null; }\n" +
4373
			"	B a(A<Number> n) { return null; }\n" + 
4265
			"	  ^^^^^^^^^^^^^^\n" +
4374
			"	  ^^^^^^^^^^^^^^\n" + 
4266
			"Duplicate method a(A<Number>) in type X\n" +
4375
			"Duplicate method a(A<Number>) in type X\n" + 
4267
			"----------\n" +
4376
			"----------\n" + 
4268
			"3. ERROR in X.java (at line 4)\n" +
4377
			"3. ERROR in X.java (at line 4)\n" + 
4269
			"	Object b(A<Number> s) {}\n" +
4378
			"	Object b(A<Number> s) {}\n" + 
4270
			"	       ^^^^^^^^^^^^^^\n" +
4379
			"	       ^^^^^^^^^^^^^^\n" + 
4271
			"Duplicate method b(A<Number>) in type X\n" +
4380
			"Duplicate method b(A<Number>) in type X\n" + 
4272
			"----------\n" +
4381
			"----------\n" + 
4273
			"4. ERROR in X.java (at line 5)\n" +
4382
			"4. ERROR in X.java (at line 4)\n" + 
4274
			"	B b(A<Number> n) { return null; }\n" +
4383
			"	Object b(A<Number> s) {}\n" + 
4275
			"	  ^^^^^^^^^^^^^^\n" +
4384
			"	       ^^^^^^^^^^^^^^\n" + 
4276
			"Duplicate method b(A<Number>) in type X\n" +
4385
			"This method must return a result of type Object\n" + 
4386
			"----------\n" + 
4387
			"5. ERROR in X.java (at line 5)\n" + 
4388
			"	B b(A<Number> n) { return null; }\n" + 
4389
			"	  ^^^^^^^^^^^^^^\n" + 
4390
			"Duplicate method b(A<Number>) in type X\n" + 
4277
			"----------\n"
4391
			"----------\n"
4278
		);
4392
		);
4279
/* javac 7
4393
/* javac 7
Lines 7971-7976 Link Here
7971
}
8085
}
7972
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830
8086
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830
7973
public void test120a() {
8087
public void test120a() {
8088
	String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)?
8089
			"----------\n" + 
8090
			"1. WARNING in Bar.java (at line 2)\n" + 
8091
			"	int getThing(V v) { return 1; }\n" + 
8092
			"	    ^^^^^^^^^^^^^\n" + 
8093
			"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8094
			"----------\n" + 
8095
			"2. WARNING in Bar.java (at line 3)\n" + 
8096
			"	boolean getThing(E e) { return true; }\n" + 
8097
			"	        ^^^^^^^^^^^^^\n" + 
8098
			"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8099
			"----------\n":
8100
				"----------\n" + 
8101
				"1. ERROR in Bar.java (at line 2)\n" + 
8102
				"	int getThing(V v) { return 1; }\n" + 
8103
				"	    ^^^^^^^^^^^^^\n" + 
8104
				"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8105
				"----------\n" + 
8106
				"2. ERROR in Bar.java (at line 3)\n" + 
8107
				"	boolean getThing(E e) { return true; }\n" + 
8108
				"	        ^^^^^^^^^^^^^\n" + 
8109
				"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + 
8110
				"----------\n";
7974
	this.runNegativeTest(
8111
	this.runNegativeTest(
7975
		new String[] {
8112
		new String[] {
7976
			"Bar.java",
8113
			"Bar.java",
Lines 7980-7996 Link Here
7980
			"}\n" +
8117
			"}\n" +
7981
			"public class Bar<V,E> extends Foo<V,E> {}"
8118
			"public class Bar<V,E> extends Foo<V,E> {}"
7982
		},
8119
		},
7983
		"----------\n" + 
8120
		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
	);
8121
	);
7995
}
8122
}
7996
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477
8123
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477
Lines 10702-10707 Link Here
10702
}
10829
}
10703
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088
10830
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088
10704
public void test200() {
10831
public void test200() {
10832
	Map options = getCompilerOptions();
10833
	String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE);
10834
	String errorMessage = compliance == JavaCore.VERSION_1_6 ?
10835
			"----------\n" + 
10836
			"1. WARNING in X.java (at line 3)\n" + 
10837
			"	int foo(Collection bar) { return 0; }\n" + 
10838
			"	    ^^^^^^^^^^^^^^^^^^^\n" + 
10839
			"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + 
10840
			"----------\n" + 
10841
			"2. WARNING in X.java (at line 3)\n" + 
10842
			"	int foo(Collection bar) { return 0; }\n" + 
10843
			"	        ^^^^^^^^^^\n" + 
10844
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
10845
			"----------\n" + 
10846
			"3. WARNING in X.java (at line 4)\n" + 
10847
			"	double foo(Collection<String> bar) {return 0; }\n" + 
10848
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
10849
			"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + 
10850
			"----------\n" :
10851
				"----------\n" + 
10852
				"1. ERROR in X.java (at line 3)\n" + 
10853
				"	int foo(Collection bar) { return 0; }\n" + 
10854
				"	    ^^^^^^^^^^^^^^^^^^^\n" + 
10855
				"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + 
10856
				"----------\n" + 
10857
				"2. WARNING in X.java (at line 3)\n" + 
10858
				"	int foo(Collection bar) { return 0; }\n" + 
10859
				"	        ^^^^^^^^^^\n" + 
10860
				"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
10861
				"----------\n" + 
10862
				"3. ERROR in X.java (at line 4)\n" + 
10863
				"	double foo(Collection<String> bar) {return 0; }\n" + 
10864
				"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
10865
				"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + 
10866
				"----------\n";
10705
	this.runNegativeTest(
10867
	this.runNegativeTest(
10706
		new String[] {
10868
		new String[] {
10707
			"X.java",
10869
			"X.java",
Lines 10711-10732 Link Here
10711
			"	double foo(Collection<String> bar) {return 0; }\n" +
10873
			"	double foo(Collection<String> bar) {return 0; }\n" +
10712
			"}"
10874
			"}"
10713
		},
10875
		},
10714
		"----------\n" + 
10876
		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
	);
10877
	);
10731
/* javac 7
10878
/* javac 7
10732
X.java:4: foo(Collection) is already defined in X
10879
X.java:4: foo(Collection) is already defined in X

Return to bug 317719