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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-2 / +1 lines)
Lines 1316-1322 Link Here
1316
		ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
1316
		ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
1317
		assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
1317
		assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
1318
		CompilationUnit unit = (CompilationUnit) result;
1318
		CompilationUnit unit = (CompilationUnit) result;
1319
		assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
1319
		assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
1320
		ASTNode node = getASTNode(unit, 0);
1320
		ASTNode node = getASTNode(unit, 0);
1321
		assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
1321
		assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
1322
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
1322
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
Lines 1326-1332 Link Here
1326
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1326
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1327
		MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
1327
		MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
1328
		assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
1328
		assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
1329
		assertNull("Got a binding", methodDeclaration.resolveBinding());
1330
		bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
1329
		bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
1331
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1330
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1332
		assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier());
1331
		assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier());
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (-2 / +1 lines)
Lines 1233-1239 Link Here
1233
		ASTNode result = runConversion(sourceUnit, true);
1233
		ASTNode result = runConversion(sourceUnit, true);
1234
		assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
1234
		assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
1235
		CompilationUnit unit = (CompilationUnit) result;
1235
		CompilationUnit unit = (CompilationUnit) result;
1236
		assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
1236
		assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
1237
		ASTNode node = getASTNode(unit, 0);
1237
		ASTNode node = getASTNode(unit, 0);
1238
		assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
1238
		assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
1239
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
1239
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
Lines 1243-1249 Link Here
1243
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1243
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1244
		MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
1244
		MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
1245
		assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
1245
		assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
1246
		assertNull("Got a binding", methodDeclaration.resolveBinding());
1247
		bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
1246
		bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
1248
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1247
		assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
1249
		assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier());
1248
		assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier());
(-)src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java (+1 lines)
Lines 4859-4864 Link Here
4859
		"completion token location={STATEMENT_START}\n" +
4859
		"completion token location={STATEMENT_START}\n" +
4860
		"visibleElements={\n" +
4860
		"visibleElements={\n" +
4861
		"	source [in addDataDependencies(int)#2 [in Foo [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" +
4861
		"	source [in addDataDependencies(int)#2 [in Foo [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" +
4862
		"	addDataDependencies(int) {key=Ltest/X~Foo;.addDataDependencies(I)I} [in Foo [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" +
4862
		"	hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" +
4863
		"	hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" +
4863
		"}",
4864
		"}",
4864
		result.context);
4865
		result.context);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-23 / +3 lines)
Lines 1165-1187 Link Here
1165
				}
1165
				}
1166
				boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
1166
				boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
1167
				// report duplicate
1167
				// report duplicate
1168
				if (methodDecl == null) {
1169
					methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
1170
					if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
1171
						if (isEnumSpecialMethod) {
1172
							this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
1173
						} else {
1174
							this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
1175
						}
1176
						methodDecl.binding = null;
1177
						// do not alter original method array until resolution is over, due to reentrance (143259)
1178
						if (resolvedMethods == this.methods) {
1179
							System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
1180
						}
1181
						resolvedMethods[i] = null;
1182
						failed++;
1183
					}
1184
				}
1185
				AbstractMethodDeclaration method2Decl = method2.sourceMethod();
1168
				AbstractMethodDeclaration method2Decl = method2.sourceMethod();
1186
				if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
1169
				if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
1187
					if (isEnumSpecialMethod) {
1170
					if (isEnumSpecialMethod) {
Lines 1191-1212 Link Here
1191
					}
1174
					}
1192
					method2Decl.binding = null;
1175
					method2Decl.binding = null;
1193
					// do not alter original method array until resolution is over, due to reentrance (143259)
1176
					// do not alter original method array until resolution is over, due to reentrance (143259)
1194
					if (resolvedMethods == this.methods) {
1177
					if (resolvedMethods == this.methods)
1195
						System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
1178
						System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
1196
					}
1197
					resolvedMethods[j] = null;
1179
					resolvedMethods[j] = null;
1198
					failed++;
1180
					failed++;
1199
				}
1181
				}
1200
			}
1182
			}
1201
			if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions
1183
			if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions
1202
				methodDecl = method.sourceMethod();
1184
				methodDecl = method.sourceMethod();
1203
				if (methodDecl != null) {
1185
				if (methodDecl != null)
1204
					methodDecl.binding = null;
1186
					methodDecl.binding = null;
1205
				}
1206
				// do not alter original method array until resolution is over, due to reentrance (143259)
1187
				// do not alter original method array until resolution is over, due to reentrance (143259)
1207
				if (resolvedMethods == this.methods) {
1188
				if (resolvedMethods == this.methods)
1208
					System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
1189
					System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
1209
				}
1210
				resolvedMethods[i] = null;
1190
				resolvedMethods[i] = null;
1211
				failed++;
1191
				failed++;
1212
			}
1192
			}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (-28 lines)
Lines 91-97 Link Here
91
		// iterate the field declarations to create the bindings, lose all duplicates
91
		// iterate the field declarations to create the bindings, lose all duplicates
92
		FieldBinding[] fieldBindings = new FieldBinding[count];
92
		FieldBinding[] fieldBindings = new FieldBinding[count];
93
		HashtableOfObject knownFieldNames = new HashtableOfObject(count);
93
		HashtableOfObject knownFieldNames = new HashtableOfObject(count);
94
		boolean duplicate = false;
95
		count = 0;
94
		count = 0;
96
		for (int i = 0; i < size; i++) {
95
		for (int i = 0; i < size; i++) {
97
			FieldDeclaration field = fields[i];
96
			FieldDeclaration field = fields[i];
Lines 105-123 Link Here
105
				checkAndSetModifiersForField(fieldBinding, field);
104
				checkAndSetModifiersForField(fieldBinding, field);
106
105
107
				if (knownFieldNames.containsKey(field.name)) {
106
				if (knownFieldNames.containsKey(field.name)) {
108
					duplicate = true;
109
					FieldBinding previousBinding = (FieldBinding) knownFieldNames.get(field.name);
110
					if (previousBinding != null) {
111
						for (int f = 0; f < i; f++) {
112
							FieldDeclaration previousField = fields[f];
113
							if (previousField.binding == previousBinding) {
114
								problemReporter().duplicateFieldInType(sourceType, previousField);
115
								previousField.binding = null;
116
								break;
117
							}
118
						}
119
					}
120
					knownFieldNames.put(field.name, null); // ensure that the duplicate field is found & removed
121
					problemReporter().duplicateFieldInType(sourceType, field);
107
					problemReporter().duplicateFieldInType(sourceType, field);
122
					field.binding = null;
108
					field.binding = null;
123
				} else {
109
				} else {
Lines 128-147 Link Here
128
			}
114
			}
129
		}
115
		}
130
		// remove duplicate fields
116
		// remove duplicate fields
131
		if (duplicate) {
132
			FieldBinding[] newFieldBindings = new FieldBinding[fieldBindings.length];
133
			// we know we'll be removing at least 1 duplicate name
134
			size = count;
135
			count = 0;
136
			for (int i = 0; i < size; i++) {
137
				FieldBinding fieldBinding = fieldBindings[i];
138
				if (knownFieldNames.get(fieldBinding.name) != null) {
139
					fieldBinding.id = count;
140
					newFieldBindings[count++] = fieldBinding;
141
				}
142
			}
143
			fieldBindings = newFieldBindings;
144
		}
145
		if (count != fieldBindings.length)
117
		if (count != fieldBindings.length)
146
			System.arraycopy(fieldBindings, 0, fieldBindings = new FieldBinding[count], 0, count);
118
			System.arraycopy(fieldBindings, 0, fieldBindings = new FieldBinding[count], 0, count);
147
		sourceType.tagBits &= ~(TagBits.AreFieldsSorted|TagBits.AreFieldsComplete); // in case some static imports reached already into this type
119
		sourceType.tagBits &= ~(TagBits.AreFieldsSorted|TagBits.AreFieldsComplete); // in case some static imports reached already into this type
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-148 / +44 lines)
Lines 3379-3395 Link Here
3379
				"class A {}\n"
3379
				"class A {}\n"
3380
			},
3380
			},
3381
			"----------\n" +
3381
			"----------\n" +
3382
			"1. ERROR in X.java (at line 5)\n" +
3382
			"1. ERROR in X.java (at line 6)\n" +
3383
			"	class Y<T extends A> extends X<T> {\n" +
3384
			"	      ^\n" +
3385
			"Duplicate methods named id with the parameters (A) and (T) are defined by the type X<T>\n" +
3386
			"----------\n" +
3387
			"2. ERROR in X.java (at line 6)\n" +
3388
			"	@Override T id(T x) { return x; }\n" +
3383
			"	@Override T id(T x) { return x; }\n" +
3389
			"	            ^^^^^^^\n" +
3384
			"	            ^^^^^^^\n" +
3390
			"Method id(T) has the same erasure id(A) as another method in type Y<T>\n" +
3385
			"Name clash: The method id(T) of type Y<T> has the same erasure as id(A) of type X<T> but does not override it\n" +
3391
			"----------\n" +
3386
			"----------\n" +
3392
			"3. ERROR in X.java (at line 7)\n" +
3387
			"2. ERROR in X.java (at line 7)\n" +
3393
			"	@Override A id(A x) { return x; }\n" +
3388
			"	@Override A id(A x) { return x; }\n" +
3394
			"	            ^^^^^^^\n" +
3389
			"	            ^^^^^^^\n" +
3395
			"Method id(A) has the same erasure id(A) as another method in type Y<T>\n" +
3390
			"Method id(A) has the same erasure id(A) as another method in type Y<T>\n" +
Lines 3500-3531 Link Here
3500
				"class Z {}"
3495
				"class Z {}"
3501
			},
3496
			},
3502
			"----------\n" +
3497
			"----------\n" +
3503
			"1. ERROR in X.java (at line 3)\n" +
3498
			"1. ERROR in X.java (at line 4)\n" +
3504
			"	Y foo(Object o) {  return null; } // duplicate\n" +
3505
			"	  ^^^^^^^^^^^^^\n" +
3506
			"Duplicate method foo(Object) in type X.C1\n" +
3507
			"----------\n" +
3508
			"2. ERROR in X.java (at line 4)\n" +
3509
			"	Z foo(Object o) {  return null; } // duplicate\n" +
3499
			"	Z foo(Object o) {  return null; } // duplicate\n" +
3510
			"	  ^^^^^^^^^^^^^\n" +
3500
			"	  ^^^^^^^^^^^^^\n" +
3511
			"Duplicate method foo(Object) in type X.C1\n" +
3501
			"Duplicate method foo(Object) in type X.C1\n" +
3512
			"----------\n" +
3502
			"----------\n" +
3513
			"3. ERROR in X.java (at line 11)\n" +
3503
			"2. ERROR in X.java (at line 12)\n" +
3514
			"	A<Y> foo(Object o) {  return null; } // duplicate\n" +
3515
			"	     ^^^^^^^^^^^^^\n" +
3516
			"Duplicate method foo(Object) in type X.C3\n" +
3517
			"----------\n" +
3518
			"4. ERROR in X.java (at line 12)\n" +
3519
			"	A<Z> foo(Object o) {  return null; } // duplicate\n" +
3504
			"	A<Z> foo(Object o) {  return null; } // duplicate\n" +
3520
			"	     ^^^^^^^^^^^^^\n" +
3505
			"	     ^^^^^^^^^^^^^\n" +
3521
			"Duplicate method foo(Object) in type X.C3\n" +
3506
			"Duplicate method foo(Object) in type X.C3\n" +
3522
			"----------\n" +
3507
			"----------\n" +
3523
			"5. ERROR in X.java (at line 15)\n" +
3508
			"3. ERROR in X.java (at line 16)\n" +
3524
			"	Y foo(Object o) {  return null; } // duplicate\n" +
3525
			"	  ^^^^^^^^^^^^^\n" +
3526
			"Duplicate method foo(Object) in type X.C4\n" +
3527
			"----------\n" +
3528
			"6. ERROR in X.java (at line 16)\n" +
3529
			"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" +
3509
			"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" +
3530
			"	                ^^^^^^^^^^^^^\n" +
3510
			"	                ^^^^^^^^^^^^^\n" +
3531
			"Duplicate method foo(Object) in type X.C4\n" +
3511
			"Duplicate method foo(Object) in type X.C4\n" +
Lines 3555-3566 Link Here
3555
				"class Z {}"
3535
				"class Z {}"
3556
			},
3536
			},
3557
			"----------\n" +
3537
			"----------\n" +
3558
			"1. ERROR in X.java (at line 3)\n" +
3538
			"1. ERROR in X.java (at line 4)\n" +
3559
			"	A<Y> foo(A<Y> o) {  return null; } // duplicate\n" +
3560
			"	     ^^^^^^^^^^^\n" +
3561
			"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" +
3562
			"----------\n" +
3563
			"2. ERROR in X.java (at line 4)\n" +
3564
			"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" +
3539
			"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" +
3565
			"	     ^^^^^^^^^^^\n" +
3540
			"	     ^^^^^^^^^^^\n" +
3566
			"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" +
3541
			"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" +
Lines 3619-3630 Link Here
3619
				"class B {}\n"
3594
				"class B {}\n"
3620
			},
3595
			},
3621
			"----------\n" +
3596
			"----------\n" +
3622
			"1. ERROR in X.java (at line 2)\n" +
3597
			"1. ERROR in X.java (at line 3)\n" +
3623
			"	<N extends B> N a(A<String> s) { return null; }\n" +
3624
			"	                ^^^^^^^^^^^^^^\n" +
3625
			"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" +
3626
			"----------\n" +
3627
			"2. ERROR in X.java (at line 3)\n" +
3628
			"	<N> B a(A<Number> n) { return null; }\n" +
3598
			"	<N> B a(A<Number> n) { return null; }\n" +
3629
			"	      ^^^^^^^^^^^^^^\n" +
3599
			"	      ^^^^^^^^^^^^^^\n" +
3630
			"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" +
3600
			"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" +
Lines 3645-3656 Link Here
3645
				"class B {}\n"
3615
				"class B {}\n"
3646
			},
3616
			},
3647
			"----------\n" +
3617
			"----------\n" +
3648
			"1. ERROR in X.java (at line 2)\n" +
3618
			"1. ERROR in X.java (at line 3)\n" +
3649
			"	<N extends B> N b(A<String> s) { return null; }\n" +
3650
			"	                ^^^^^^^^^^^^^^\n" +
3651
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" +
3652
			"----------\n" +
3653
			"2. ERROR in X.java (at line 3)\n" +
3654
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3619
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3655
			"	                ^^^^^^^^^^^^^^\n" +
3620
			"	                ^^^^^^^^^^^^^^\n" +
3656
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" +
3621
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" +
Lines 3671-3682 Link Here
3671
				"class B {}\n"
3636
				"class B {}\n"
3672
			},
3637
			},
3673
			"----------\n" +
3638
			"----------\n" +
3674
			"1. ERROR in X.java (at line 2)\n" +
3639
			"1. ERROR in X.java (at line 3)\n" +
3675
			"	B c(A<String> s) { return null; }\n" +
3676
			"	  ^^^^^^^^^^^^^^\n" +
3677
			"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" +
3678
			"----------\n" +
3679
			"2. ERROR in X.java (at line 3)\n" +
3680
			"	B c(A<Number> n) { return null; }\n" +
3640
			"	B c(A<Number> n) { return null; }\n" +
3681
			"	  ^^^^^^^^^^^^^^\n" +
3641
			"	  ^^^^^^^^^^^^^^\n" +
3682
			"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" +
3642
			"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" +
Lines 3717-3738 Link Here
3717
				"class B {}\n"
3677
				"class B {}\n"
3718
			},
3678
			},
3719
			"----------\n" +
3679
			"----------\n" +
3720
			"1. ERROR in X.java (at line 2)\n" +
3680
			"1. ERROR in X.java (at line 3)\n" +
3721
			"	<N extends B> N a(A<Number> s) { return null; }\n" +
3722
			"	                ^^^^^^^^^^^^^^\n" +
3723
			"Duplicate method a(A<Number>) in type X\n" +
3724
			"----------\n" +
3725
			"2. ERROR in X.java (at line 3)\n" +
3726
			"	<N> B a(A<Number> n) { return null; }\n" +
3681
			"	<N> B a(A<Number> n) { return null; }\n" +
3727
			"	      ^^^^^^^^^^^^^^\n" +
3682
			"	      ^^^^^^^^^^^^^^\n" +
3728
			"Duplicate method a(A<Number>) in type X\n" +
3683
			"Duplicate method a(A<Number>) in type X\n" +
3729
			"----------\n" +
3684
			"----------\n" +
3730
			"3. ERROR in X.java (at line 4)\n" +
3685
			"2. ERROR in X.java (at line 5)\n" +
3731
			"	<N extends B> N b(A<Number> s) { return null; }\n" +
3732
			"	                ^^^^^^^^^^^^^^\n" +
3733
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" +
3734
			"----------\n" +
3735
			"4. ERROR in X.java (at line 5)\n" +
3736
			"	<N> B b(A<String> n) { return null; }\n" +
3686
			"	<N> B b(A<String> n) { return null; }\n" +
3737
			"	      ^^^^^^^^^^^^^^\n" +
3687
			"	      ^^^^^^^^^^^^^^\n" +
3738
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" +
3688
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" +
Lines 3756-3777 Link Here
3756
				"class B {}\n"
3706
				"class B {}\n"
3757
			},
3707
			},
3758
			"----------\n" +
3708
			"----------\n" +
3759
			"1. ERROR in X.java (at line 2)\n" +
3709
			"1. ERROR in X.java (at line 3)\n" +
3760
			"	<N extends B> void a(A<Number> s) {}\n" +
3761
			"	                   ^^^^^^^^^^^^^^\n" +
3762
			"Duplicate method a(A<Number>) in type X\n" +
3763
			"----------\n" +
3764
			"2. ERROR in X.java (at line 3)\n" +
3765
			"	<N extends B> B a(A<Number> n) { return null; }\n" +
3710
			"	<N extends B> B a(A<Number> n) { return null; }\n" +
3766
			"	                ^^^^^^^^^^^^^^\n" +
3711
			"	                ^^^^^^^^^^^^^^\n" +
3767
			"Duplicate method a(A<Number>) in type X\n" +
3712
			"Duplicate method a(A<Number>) in type X\n" +
3768
			"----------\n" +
3713
			"----------\n" +
3769
			"3. ERROR in X.java (at line 4)\n" +
3714
			"2. ERROR in X.java (at line 5)\n" +
3770
			"	<N extends B> Object b(A<Number> s) { return null; }\n" +
3771
			"	                     ^^^^^^^^^^^^^^\n" +
3772
			"Duplicate method b(A<Number>) in type X\n" +
3773
			"----------\n" +
3774
			"4. ERROR in X.java (at line 5)\n" +
3775
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3715
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3776
			"	                ^^^^^^^^^^^^^^\n" +
3716
			"	                ^^^^^^^^^^^^^^\n" +
3777
			"Duplicate method b(A<Number>) in type X\n" +
3717
			"Duplicate method b(A<Number>) in type X\n" +
Lines 3795-3816 Link Here
3795
				"class B {}\n"
3735
				"class B {}\n"
3796
			},
3736
			},
3797
			"----------\n" +
3737
			"----------\n" +
3798
			"1. ERROR in X.java (at line 2)\r\n" +
3738
			"1. ERROR in X.java (at line 3)\r\n" +
3799
			"	void a(A<Number> s) {}\r\n" +
3800
			"	     ^^^^^^^^^^^^^^\n" +
3801
			"Duplicate method a(A<Number>) in type X\n" +
3802
			"----------\n" +
3803
			"2. ERROR in X.java (at line 3)\r\n" +
3804
			"	B a(A<Number> n) { return null; }\r\n" +
3739
			"	B a(A<Number> n) { return null; }\r\n" +
3805
			"	  ^^^^^^^^^^^^^^\n" +
3740
			"	  ^^^^^^^^^^^^^^\n" +
3806
			"Duplicate method a(A<Number>) in type X\n" +
3741
			"Duplicate method a(A<Number>) in type X\n" +
3807
			"----------\n" +
3742
			"----------\n" +
3808
			"3. ERROR in X.java (at line 4)\r\n" +
3743
			"2. ERROR in X.java (at line 5)\r\n" +
3809
			"	Object b(A<Number> s) {}\r\n" +
3810
			"	       ^^^^^^^^^^^^^^\n" +
3811
			"Duplicate method b(A<Number>) in type X\n" +
3812
			"----------\n" +
3813
			"4. ERROR in X.java (at line 5)\r\n" +
3814
			"	B b(A<Number> n) { return null; }\r\n" +
3744
			"	B b(A<Number> n) { return null; }\r\n" +
3815
			"	  ^^^^^^^^^^^^^^\n" +
3745
			"	  ^^^^^^^^^^^^^^\n" +
3816
			"Duplicate method b(A<Number>) in type X\n" +
3746
			"Duplicate method b(A<Number>) in type X\n" +
Lines 3853-3864 Link Here
3853
				"class A<T> {}\n",
3783
				"class A<T> {}\n",
3854
			},
3784
			},
3855
			"----------\n" +
3785
			"----------\n" +
3856
			"1. ERROR in X.java (at line 2)\n" +
3786
			"1. ERROR in X.java (at line 3)\n" +
3857
			"	void foo(A<String> a) {}\n" +
3858
			"	     ^^^^^^^^^^^^^^^^\n" +
3859
			"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" +
3860
			"----------\n" +
3861
			"2. ERROR in X.java (at line 3)\n" +
3862
			"	void foo(A<Integer> a) {}\n" +
3787
			"	void foo(A<Integer> a) {}\n" +
3863
			"	     ^^^^^^^^^^^^^^^^^\n" +
3788
			"	     ^^^^^^^^^^^^^^^^^\n" +
3864
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" +
3789
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" +
Lines 4003-4014 Link Here
4003
				"}\n"
3928
				"}\n"
4004
			},
3929
			},
4005
			"----------\n" +
3930
			"----------\n" +
4006
			"1. ERROR in X.java (at line 2)\n" +
3931
			"1. ERROR in X.java (at line 3)\n" +
4007
			"	void a(Object x) {}\n" +
4008
			"	     ^^^^^^^^^^^\n" +
4009
			"Method a(Object) has the same erasure a(Object) as another method in type X\n" +
4010
			"----------\n" +
4011
			"2. ERROR in X.java (at line 3)\n" +
4012
			"	<T> T a(T x) {  return null; }\n" +
3932
			"	<T> T a(T x) {  return null; }\n" +
4013
			"	      ^^^^^^\n" +
3933
			"	      ^^^^^^\n" +
4014
			"Method a(T) has the same erasure a(Object) as another method in type X\n" +
3934
			"Method a(T) has the same erasure a(Object) as another method in type X\n" +
Lines 4034-4045 Link Here
4034
				"}\n"
3954
				"}\n"
4035
			},
3955
			},
4036
			"----------\n" +
3956
			"----------\n" +
4037
			"1. ERROR in X.java (at line 6)\n" +
3957
			"1. ERROR in X.java (at line 7)\n" +
4038
			"	String a(X x) {  return null; }\n" +
4039
			"	       ^^^^^^\n" +
4040
			"Method a(X) has the same erasure a(X) as another method in type X\n" +
4041
			"----------\n" +
4042
			"2. ERROR in X.java (at line 7)\n" +
4043
			"	<T extends X> T a(T x) {  return null; }\n" +
3958
			"	<T extends X> T a(T x) {  return null; }\n" +
4044
			"	                ^^^^^^\n" +
3959
			"	                ^^^^^^\n" +
4045
			"Method a(T) has the same erasure a(X) as another method in type X\n" +
3960
			"Method a(T) has the same erasure a(X) as another method in type X\n" +
Lines 4071-4082 Link Here
4071
				"}\n"
3986
				"}\n"
4072
			},
3987
			},
4073
			"----------\n" +
3988
			"----------\n" +
4074
			"1. ERROR in X.java (at line 2)\r\n" +
3989
			"1. ERROR in X.java (at line 3)\r\n" +
4075
			"	<T1 extends X<T1>> void dupT() {}\r\n" +
4076
			"	                        ^^^^^^\n" +
4077
			"Duplicate method dupT() in type X<T>\n" +
4078
			"----------\n" +
4079
			"2. ERROR in X.java (at line 3)\r\n" +
4080
			"	<T2 extends X<T2>> Object dupT() {return null;}\r\n" +
3990
			"	<T2 extends X<T2>> Object dupT() {return null;}\r\n" +
4081
			"	                          ^^^^^^\n" +
3991
			"	                          ^^^^^^\n" +
4082
			"Duplicate method dupT() in type X<T>\n" +
3992
			"Duplicate method dupT() in type X<T>\n" +
Lines 5026-5037 Link Here
5026
				"interface J {}\n"
4936
				"interface J {}\n"
5027
			},
4937
			},
5028
			"----------\n" +
4938
			"----------\n" +
5029
			"1. ERROR in A.java (at line 2)\r\n" +
4939
			"1. ERROR in A.java (at line 3)\r\n" +
5030
			"	<T, S extends J & I<T>> void foo() { }\r\n" +
5031
			"	                             ^^^^^\n" +
5032
			"Duplicate method foo() in type A\n" +
5033
			"----------\n" +
5034
			"2. ERROR in A.java (at line 3)\r\n" +
5035
			"	<T, S extends I<T> & J> void foo() { }\r\n" +
4940
			"	<T, S extends I<T> & J> void foo() { }\r\n" +
5036
			"	                             ^^^^^\n" +
4941
			"	                             ^^^^^\n" +
5037
			"Duplicate method foo() in type A\n" +
4942
			"Duplicate method foo() in type A\n" +
Lines 5052-5063 Link Here
5052
				"interface K extends J {}"
4957
				"interface K extends J {}"
5053
			},
4958
			},
5054
			"----------\n" +
4959
			"----------\n" +
5055
			"1. ERROR in A.java (at line 2)\r\n" +
4960
			"1. ERROR in A.java (at line 3)\r\n" +
5056
			"	<T, S extends J & I<T>> void foo() { }\r\n" +
5057
			"	                             ^^^^^\n" +
5058
			"Duplicate method foo() in type A\n" +
5059
			"----------\n" +
5060
			"2. ERROR in A.java (at line 3)\r\n" +
5061
			"	<T, S extends I<T> & K> void foo() { }\r\n" +
4961
			"	<T, S extends I<T> & K> void foo() { }\r\n" +
5062
			"	                             ^^^^^\n" +
4962
			"	                             ^^^^^\n" +
5063
			"Duplicate method foo() in type A\n" +
4963
			"Duplicate method foo() in type A\n" +
Lines 5978-6031 Link Here
5978
			"5. ERROR in DataSet.java (at line 6)\n" +
5878
			"5. ERROR in DataSet.java (at line 6)\n" +
5979
			"	public <S> S[] toArray(S[] s) {\n" +
5879
			"	public <S> S[] toArray(S[] s) {\n" +
5980
			"	               ^^^^^^^^^^^^^^\n" +
5880
			"	               ^^^^^^^^^^^^^^\n" +
5981
			"Method toArray(S[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" +
5881
			"Name clash: The method toArray(S[]) of type DataSet<T> has the same erasure as toArray(Object[]) of type List but does not override it\n" +
5882
			"----------\n" +
5883
			"6. ERROR in DataSet.java (at line 6)\n" +
5884
			"	public <S> S[] toArray(S[] s) {\n" +
5885
			"	               ^^^^^^^^^^^^^^\n" +
5886
			"Name clash: The method toArray(S[]) of type DataSet<T> has the same erasure as toArray(Object[]) of type Collection but does not override it\n" +
5982
			"----------\n" +
5887
			"----------\n" +
5983
			"6. ERROR in DataSet.java (at line 9)\n" +
5888
			"7. ERROR in DataSet.java (at line 9)\n" +
5984
			"	public Object[] toArray(Object[] o) {\n" +
5889
			"	public Object[] toArray(Object[] o) {\n" +
5985
			"	                ^^^^^^^^^^^^^^^^^^^\n" +
5890
			"	                ^^^^^^^^^^^^^^^^^^^\n" +
5986
			"Method toArray(Object[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" +
5891
			"Method toArray(Object[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" +
5987
			"----------\n" +
5892
			"----------\n" +
5988
			"7. WARNING in DataSet.java (at line 14)\n" +
5893
			"8. WARNING in DataSet.java (at line 14)\n" +
5989
			"	public boolean addAll(Collection c) {	return false; }\n" +
5894
			"	public boolean addAll(Collection c) {	return false; }\n" +
5990
			"	                      ^^^^^^^^^^\n" +
5895
			"	                      ^^^^^^^^^^\n" +
5991
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5896
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5992
			"----------\n" +
5897
			"----------\n" +
5993
			"8. WARNING in DataSet.java (at line 15)\n" +
5898
			"9. WARNING in DataSet.java (at line 15)\n" +
5994
			"	public boolean addAll(int index, Collection c) {	return false; }\n" +
5899
			"	public boolean addAll(int index, Collection c) {	return false; }\n" +
5995
			"	                                 ^^^^^^^^^^\n" +
5900
			"	                                 ^^^^^^^^^^\n" +
5996
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5901
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5997
			"----------\n" +
5902
			"----------\n" +
5998
			"9. WARNING in DataSet.java (at line 18)\n" +
5903
			"10. WARNING in DataSet.java (at line 18)\n" +
5999
			"	public boolean containsAll(Collection c) { return false; }\n" +
5904
			"	public boolean containsAll(Collection c) { return false; }\n" +
6000
			"	                           ^^^^^^^^^^\n" +
5905
			"	                           ^^^^^^^^^^\n" +
6001
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5906
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6002
			"----------\n" +
5907
			"----------\n" +
6003
			"10. WARNING in DataSet.java (at line 22)\n" +
5908
			"11. WARNING in DataSet.java (at line 22)\n" +
6004
			"	public Iterator iterator() {	return null; }\n" +
5909
			"	public Iterator iterator() {	return null; }\n" +
6005
			"	       ^^^^^^^^\n" +
5910
			"	       ^^^^^^^^\n" +
6006
			"Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" +
5911
			"Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" +
6007
			"----------\n" +
5912
			"----------\n" +
6008
			"11. WARNING in DataSet.java (at line 24)\n" +
5913
			"12. WARNING in DataSet.java (at line 24)\n" +
6009
			"	public ListIterator listIterator() {	return null; }\n" +
5914
			"	public ListIterator listIterator() {	return null; }\n" +
6010
			"	       ^^^^^^^^^^^^\n" +
5915
			"	       ^^^^^^^^^^^^\n" +
6011
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
5916
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
6012
			"----------\n" +
5917
			"----------\n" +
6013
			"12. WARNING in DataSet.java (at line 25)\n" +
5918
			"13. WARNING in DataSet.java (at line 25)\n" +
6014
			"	public ListIterator listIterator(int index) {	return null; }\n" +
5919
			"	public ListIterator listIterator(int index) {	return null; }\n" +
6015
			"	       ^^^^^^^^^^^^\n" +
5920
			"	       ^^^^^^^^^^^^\n" +
6016
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
5921
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
6017
			"----------\n" +
5922
			"----------\n" +
6018
			"13. WARNING in DataSet.java (at line 28)\n" +
5923
			"14. WARNING in DataSet.java (at line 28)\n" +
6019
			"	public boolean removeAll(Collection c) {	return false; }\n" +
5924
			"	public boolean removeAll(Collection c) {	return false; }\n" +
6020
			"	                         ^^^^^^^^^^\n" +
5925
			"	                         ^^^^^^^^^^\n" +
6021
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5926
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6022
			"----------\n" +
5927
			"----------\n" +
6023
			"14. WARNING in DataSet.java (at line 29)\n" +
5928
			"15. WARNING in DataSet.java (at line 29)\n" +
6024
			"	public boolean retainAll(Collection c) {	return false; }\n" +
5929
			"	public boolean retainAll(Collection c) {	return false; }\n" +
6025
			"	                         ^^^^^^^^^^\n" +
5930
			"	                         ^^^^^^^^^^\n" +
6026
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5931
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6027
			"----------\n" +
5932
			"----------\n" +
6028
			"15. WARNING in DataSet.java (at line 32)\n" +
5933
			"16. WARNING in DataSet.java (at line 32)\n" +
6029
			"	public List subList(int fromIndex, int toIndex) {	return null; }\n" +
5934
			"	public List subList(int fromIndex, int toIndex) {	return null; }\n" +
6030
			"	       ^^^^\n" +
5935
			"	       ^^^^\n" +
6031
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
5936
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
Lines 6219-6230 Link Here
6219
			"}"
6124
			"}"
6220
		},
6125
		},
6221
		"----------\n" +
6126
		"----------\n" +
6222
		"1. ERROR in X.java (at line 11)\n" +
6127
		"1. ERROR in X.java (at line 14)\n" +
6223
		"	Integer getX(List<Integer> l) {\n" +
6224
		"	        ^^^^^^^^^^^^^^^^^^^^^\n" +
6225
		"Duplicate method getX(List<Integer>) in type Y\n" +
6226
		"----------\n" +
6227
		"2. ERROR in X.java (at line 14)\n" +
6228
		"	String getX(List<Integer> l) {\n" +
6128
		"	String getX(List<Integer> l) {\n" +
6229
		"	       ^^^^^^^^^^^^^^^^^^^^^\n" +
6129
		"	       ^^^^^^^^^^^^^^^^^^^^^\n" +
6230
		"Duplicate method getX(List<Integer>) in type Y\n" +
6130
		"Duplicate method getX(List<Integer>) in type Y\n" +
Lines 8176-8201 Link Here
8176
			"}\n"
8076
			"}\n"
8177
		},
8077
		},
8178
		"----------\n" +
8078
		"----------\n" +
8179
		"1. ERROR in X.java (at line 3)\n" +
8079
		"1. ERROR in X.java (at line 7)\n" +
8180
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date){\n" +
8181
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
8182
		"Method method3(X.D1<String>, X.D1<String>, X.D1<Date>) has the same erasure method3(X.D1<T>, X.D1<T>, X.D1<T>) as another method in type X\n" +
8183
		"----------\n" +
8184
		"2. ERROR in X.java (at line 7)\n" +
8185
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date){\n" +
8080
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date){\n" +
8186
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
8081
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
8187
		"Method method3(X.D1<String>, X.D1<String>, X.D1<String>) has the same erasure method3(X.D1<T>, X.D1<T>, X.D1<T>) as another method in type X\n" +
8082
		"Method method3(X.D1<String>, X.D1<String>, X.D1<String>) has the same erasure method3(X.D1<T>, X.D1<T>, X.D1<T>) as another method in type X\n" +
8188
		"----------\n" +
8083
		"----------\n" +
8189
		"3. WARNING in X.java (at line 11)\n" +
8084
		"2. WARNING in X.java (at line 11)\n" +
8190
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date, D1 ... notUsed){\n" +
8085
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date, D1 ... notUsed){\n" +
8191
		"	                                                                                    ^^\n" +
8086
		"	                                                                                    ^^\n" +
8192
		"X.D1 is a raw type. References to generic type X.D1<T> should be parameterized\n" +
8087
		"X.D1 is a raw type. References to generic type X.D1<T> should be parameterized\n" +
8193
		"----------\n" +
8088
		"----------\n" +
8194
		"4. WARNING in X.java (at line 15)\n" +
8089
		"3. WARNING in X.java (at line 15)\n" +
8195
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date, D2 ... notUsed){\n" +
8090
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date, D2 ... notUsed){\n" +
8196
		"	                                                                            ^^\n" +
8091
		"	                                                                            ^^\n" +
8197
		"X.D2 is a raw type. References to generic type X.D2<T> should be parameterized\n" +
8092
		"X.D2 is a raw type. References to generic type X.D2<T> should be parameterized\n" +
8198
		"----------\n");
8093
		"----------\n"
8094
	);
8199
}
8095
}
8200
public void test151() {
8096
public void test151() {
8201
	this.runConformTest(
8097
	this.runConformTest(
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-22 / +23 lines)
Lines 176-187 Link Here
176
			"}"
176
			"}"
177
		},
177
		},
178
		"----------\n" +
178
		"----------\n" +
179
		"1. ERROR in X.java (at line 3)\n" +
179
		"1. ERROR in X.java (at line 6)\n" +
180
		"	BLEU, \n" +
181
		"	^^^^\n" +
182
		"Duplicate field X.BLEU\n" +
183
		"----------\n" +
184
		"2. ERROR in X.java (at line 6)\n" +
185
		"	BLEU;\n" +
180
		"	BLEU;\n" +
186
		"	^^^^\n" +
181
		"	^^^^\n" +
187
		"Duplicate field X.BLEU\n" +
182
		"Duplicate field X.BLEU\n" +
Lines 328-359 Link Here
328
			"}\n"
323
			"}\n"
329
		},
324
		},
330
		"----------\n" +
325
		"----------\n" +
331
		"1. ERROR in X.java (at line 7)\n" +
326
		"1. ERROR in X.java (at line 8)\n" +
332
		"	void dup() {} \n" +
333
		"	     ^^^^^\n" +
334
		"Duplicate method dup() in type X\n" +
335
		"----------\n" +
336
		"2. ERROR in X.java (at line 8)\n" +
337
		"	void values() {} \n" +
327
		"	void values() {} \n" +
338
		"	     ^^^^^^^^\n" +
328
		"	     ^^^^^^^^\n" +
339
		"The enum X already defines the method values() implicitly\n" +
329
		"The enum X already defines the method values() implicitly\n" +
340
		"----------\n" +
330
		"----------\n" +
341
		"3. ERROR in X.java (at line 9)\n" +
331
		"2. ERROR in X.java (at line 9)\n" +
342
		"	void dup() {} \n" +
332
		"	void dup() {} \n" +
343
		"	     ^^^^^\n" +
333
		"	     ^^^^^\n" +
344
		"Duplicate method dup() in type X\n" +
334
		"Duplicate method dup() in type X\n" +
345
		"----------\n" +
335
		"----------\n" +
346
		"4. ERROR in X.java (at line 10)\n" +
336
		"3. ERROR in X.java (at line 10)\n" +
347
		"	void values() {} \n" +
337
		"	void values() {} \n" +
348
		"	     ^^^^^^^^\n" +
338
		"	     ^^^^^^^^\n" +
349
		"The enum X already defines the method values() implicitly\n" +
339
		"The enum X already defines the method values() implicitly\n" +
350
		"----------\n" +
340
		"----------\n" +
351
		"5. ERROR in X.java (at line 11)\n" +
341
		"4. ERROR in X.java (at line 11)\n" +
352
		"	Missing dup() {} \n" +
342
		"	Missing dup() {} \n" +
353
		"	^^^^^^^\n" +
343
		"	^^^^^^^\n" +
354
		"Missing cannot be resolved to a type\n" +
344
		"Missing cannot be resolved to a type\n" +
355
		"----------\n" +
345
		"----------\n" +
356
		"6. ERROR in X.java (at line 11)\n" +
346
		"5. ERROR in X.java (at line 11)\n" +
357
		"	Missing dup() {} \n" +
347
		"	Missing dup() {} \n" +
358
		"	        ^^^^^\n" +
348
		"	        ^^^^^\n" +
359
		"Duplicate method dup() in type X\n" +
349
		"Duplicate method dup() in type X\n" +
Lines 1957-1972 Link Here
1957
            "}",
1947
            "}",
1958
        },
1948
        },
1959
        "----------\n" +
1949
        "----------\n" +
1960
		"1. ERROR in X.java (at line 3)\n" +
1950
		"1. ERROR in X.java (at line 2)\n" +
1961
		"	abstract int getSquare();\n" +
1951
		"	ONE, TWO, THREE;\n" +
1962
		"	             ^^^^^^^^^^^\n" +
1952
		"	^^^\n" +
1963
		"Duplicate method getSquare() in type X\n" +
1953
		"The enum constant ONE must define the abstract method getSquare()\n" +
1964
		"----------\n" +
1954
		"----------\n" +
1965
		"2. ERROR in X.java (at line 4)\n" +
1955
		"2. ERROR in X.java (at line 2)\n" +
1956
		"	ONE, TWO, THREE;\n" +
1957
		"	     ^^^\n" +
1958
		"The enum constant TWO must define the abstract method getSquare()\n" +
1959
		"----------\n" +
1960
		"3. ERROR in X.java (at line 2)\n" +
1961
		"	ONE, TWO, THREE;\n" +
1962
		"	          ^^^^^\n" +
1963
		"The enum constant THREE must define the abstract method getSquare()\n" +
1964
		"----------\n" +
1965
		"4. ERROR in X.java (at line 4)\n" +
1966
		"	abstract int getSquare();\n" +
1966
		"	abstract int getSquare();\n" +
1967
		"	             ^^^^^^^^^^^\n" +
1967
		"	             ^^^^^^^^^^^\n" +
1968
		"Duplicate method getSquare() in type X\n" +
1968
		"Duplicate method getSquare() in type X\n" +
1969
		"----------\n");
1969
		"----------\n"
1970
	);
1970
}
1971
}
1971
1972
1972
/**
1973
/**
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-56 / +16 lines)
Lines 867-878 Link Here
867
				"}\n" ,
867
				"}\n" ,
868
			},
868
			},
869
			"----------\n" +
869
			"----------\n" +
870
			"1. ERROR in X.java (at line 2)\n" +
870
			"1. ERROR in X.java (at line 3)\n" +
871
			"	void foo(E e){}\n" +
872
			"	     ^^^^^^^^\n" +
873
			"Method foo(E) has the same erasure foo(Object) as another method in type X<E,T>\n" +
874
			"----------\n" +
875
			"2. ERROR in X.java (at line 3)\n" +
876
			"	void foo(T t){}\n" +
871
			"	void foo(T t){}\n" +
877
			"	     ^^^^^^^^\n" +
872
			"	     ^^^^^^^^\n" +
878
			"Method foo(T) has the same erasure foo(Object) as another method in type X<E,T>\n" +
873
			"Method foo(T) has the same erasure foo(Object) as another method in type X<E,T>\n" +
Lines 889-900 Link Here
889
				"}\n" ,
884
				"}\n" ,
890
			},
885
			},
891
			"----------\n" +
886
			"----------\n" +
892
			"1. ERROR in X.java (at line 2)\n" +
887
			"1. ERROR in X.java (at line 3)\n" +
893
			"	void foo(E e){}\n" +
894
			"	     ^^^^^^^^\n" +
895
			"Method foo(E) has the same erasure foo(Exception) as another method in type X<E,T>\n" +
896
			"----------\n" +
897
			"2. ERROR in X.java (at line 3)\n" +
898
			"	void foo(T t){}\n" +
888
			"	void foo(T t){}\n" +
899
			"	     ^^^^^^^^\n" +
889
			"	     ^^^^^^^^\n" +
900
			"Method foo(T) has the same erasure foo(Exception) as another method in type X<E,T>\n" +
890
			"Method foo(T) has the same erasure foo(Exception) as another method in type X<E,T>\n" +
Lines 911-922 Link Here
911
				"}\n" ,
901
				"}\n" ,
912
			},
902
			},
913
			"----------\n" +
903
			"----------\n" +
914
			"1. ERROR in X.java (at line 2)\n" +
904
			"1. ERROR in X.java (at line 3)\n" +
915
			"	void foo(E e, Thread t){}\n" +
916
			"	     ^^^^^^^^^^^^^^^^^^\n" +
917
			"Method foo(E, Thread) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" +
918
			"----------\n" +
919
			"2. ERROR in X.java (at line 3)\n" +
920
			"	void foo(Exception e, T t){}\n" +
905
			"	void foo(Exception e, T t){}\n" +
921
			"	     ^^^^^^^^^^^^^^^^^^^^^\n" +
906
			"	     ^^^^^^^^^^^^^^^^^^^^^\n" +
922
			"Method foo(Exception, T) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" +
907
			"Method foo(Exception, T) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" +
Lines 989-1010 Link Here
989
				"}\n",
974
				"}\n",
990
			},
975
			},
991
			"----------\n" +
976
			"----------\n" +
992
			"1. ERROR in X.java (at line 2)\n" +
977
			"1. ERROR in X.java (at line 3)\n" +
993
			"	void foo(L<E> l1){}\n" +
994
			"	     ^^^^^^^^^^^^\n" +
995
			"Method foo(L<E>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
996
			"----------\n" +
997
			"2. ERROR in X.java (at line 3)\n" +
998
			"	void foo(L<T> l2){}\n" +
978
			"	void foo(L<T> l2){}\n" +
999
			"	     ^^^^^^^^^^^^\n" +
979
			"	     ^^^^^^^^^^^^\n" +
1000
			"Method foo(L<T>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
980
			"Method foo(L<T>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
1001
			"----------\n" +
981
			"----------\n" +
1002
			"3. ERROR in X.java (at line 4)\n" +
982
			"2. ERROR in X.java (at line 4)\n" +
1003
			"	void foo(L l){}\n" +
983
			"	void foo(L l){}\n" +
1004
			"	     ^^^^^^^^\n" +
984
			"	     ^^^^^^^^\n" +
1005
			"Method foo(L) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
985
			"Method foo(L) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
1006
			"----------\n" +
986
			"----------\n" +
1007
			"4. WARNING in X.java (at line 4)\n" +
987
			"3. WARNING in X.java (at line 4)\n" +
1008
			"	void foo(L l){}\n" +
988
			"	void foo(L l){}\n" +
1009
			"	         ^\n" +
989
			"	         ^\n" +
1010
			"L is a raw type. References to generic type L<E> should be parameterized\n" +
990
			"L is a raw type. References to generic type L<E> should be parameterized\n" +
Lines 7313-7329 Link Here
7313
				"}\n"
7293
				"}\n"
7314
			},
7294
			},
7315
			"----------\n" +
7295
			"----------\n" +
7316
			"1. ERROR in SubTypes.java (at line 5)\n" +
7296
			"1. ERROR in SubTypes.java (at line 6)\n" +
7317
			"	@Override public X foo() { return new X(); }\n" +
7318
			"	                   ^^^^^\n" +
7319
			"Duplicate method foo() in type B\n" +
7320
			"----------\n" +
7321
			"2. ERROR in SubTypes.java (at line 6)\n" +
7322
			"	@Override public B foo() { return this; }\n" +
7297
			"	@Override public B foo() { return this; }\n" +
7323
			"	                   ^^^^^\n" +
7298
			"	                   ^^^^^\n" +
7324
			"Duplicate method foo() in type B\n" +
7299
			"Duplicate method foo() in type B\n" +
7325
			"----------\n" +
7300
			"----------\n" +
7326
			"3. ERROR in SubTypes.java (at line 9)\n" +
7301
			"2. ERROR in SubTypes.java (at line 9)\n" +
7327
			"	@Override public X foo() { return new X(); }\n" +
7302
			"	@Override public X foo() { return new X(); }\n" +
7328
			"	                 ^\n" +
7303
			"	                 ^\n" +
7329
			"The return type is incompatible with A.foo()\n" +
7304
			"The return type is incompatible with A.foo()\n" +
Lines 39784-39815 Link Here
39784
		"	                                                         ^\n" +
39759
		"	                                                         ^\n" +
39785
		"Cannot specify any additional bound T when first bound is a type parameter\n" +
39760
		"Cannot specify any additional bound T when first bound is a type parameter\n" +
39786
		"----------\n" +
39761
		"----------\n" +
39787
		"2. ERROR in X.java (at line 2)\n" +
39762
		"2. WARNING in X.java (at line 3)\n" +
39788
		"	public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" +
39789
		"	                                                              ^^^^^^^^^^^^^^^^^^^\n" +
39790
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" +
39791
		"----------\n" +
39792
		"3. WARNING in X.java (at line 3)\n" +
39793
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39763
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39794
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39764
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39795
		"Type safety: Unchecked cast from Object to R\n" +
39765
		"Type safety: Unchecked cast from Object to R\n" +
39796
		"----------\n" +
39766
		"----------\n" +
39797
		"4. ERROR in X.java (at line 6)\n" +
39767
		"3. ERROR in X.java (at line 6)\n" +
39798
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39768
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39799
		"	                                                         ^^^^^^^^^^\n" +
39769
		"	                                                         ^^^^^^^^^^\n" +
39800
		"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" +
39770
		"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" +
39801
		"----------\n" +
39771
		"----------\n" +
39802
		"5. ERROR in X.java (at line 6)\n" +
39772
		"4. ERROR in X.java (at line 6)\n" +
39803
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39773
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39804
		"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" +
39774
		"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" +
39805
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" +
39775
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" +
39806
		"----------\n" +
39776
		"----------\n" +
39807
		"6. WARNING in X.java (at line 7)\n" +
39777
		"5. WARNING in X.java (at line 7)\n" +
39808
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39778
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39809
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39779
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39810
		"Type safety: Unchecked cast from Object to R\n" +
39780
		"Type safety: Unchecked cast from Object to R\n" +
39811
		"----------\n" +
39781
		"----------\n" +
39812
		"7. WARNING in X.java (at line 11)\n" +
39782
		"6. WARNING in X.java (at line 11)\n" +
39813
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39783
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39814
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39784
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39815
		"Type safety: Unchecked cast from Object to R\n" +
39785
		"Type safety: Unchecked cast from Object to R\n" +
Lines 39903-39929 Link Here
39903
			"}"
39873
			"}"
39904
		},
39874
		},
39905
		"----------\n" +
39875
		"----------\n" +
39906
		"1. ERROR in X.java (at line 2)\n" +
39876
		"1. WARNING in X.java (at line 2)\n" +
39907
		"	<T> void foo(Class<X> c) {};\n" +
39908
		"	         ^^^^^^^^^^^^^^^\n" +
39909
		"Method foo(Class<X>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" +
39910
		"----------\n" +
39911
		"2. WARNING in X.java (at line 2)\n" +
39912
		"	<T> void foo(Class<X> c) {};\n" +
39877
		"	<T> void foo(Class<X> c) {};\n" +
39913
		"	                   ^\n" +
39878
		"	                   ^\n" +
39914
		"X is a raw type. References to generic type X<U,V> should be parameterized\n" +
39879
		"X is a raw type. References to generic type X<U,V> should be parameterized\n" +
39915
		"----------\n" +
39880
		"----------\n" +
39916
		"3. ERROR in X.java (at line 3)\n" +
39881
		"2. ERROR in X.java (at line 3)\n" +
39917
		"	<A, B> void foo(Class<X<A, B>> c) {}\n" +
39882
		"	<A, B> void foo(Class<X<A, B>> c) {}\n" +
39918
		"	            ^^^^^^^^^^^^^^^^^^^^^\n" +
39883
		"	            ^^^^^^^^^^^^^^^^^^^^^\n" +
39919
		"Method foo(Class<X<A,B>>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" +
39884
		"Method foo(Class<X<A,B>>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" +
39920
		"----------\n" +
39885
		"----------\n" +
39921
		"4. ERROR in X.java (at line 4)\n" +
39886
		"3. ERROR in X.java (at line 5)\n" +
39922
		"	void foo2(Class<X<U, V>> c) {};\n" +
39923
		"	     ^^^^^^^^^^^^^^^^^^^^^^\n" +
39924
		"Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" +
39925
		"----------\n" +
39926
		"5. ERROR in X.java (at line 5)\n" +
39927
		"	<A, B> void foo2(Class<X<U, V>> c) {}\n" +
39887
		"	<A, B> void foo2(Class<X<U, V>> c) {}\n" +
39928
		"	            ^^^^^^^^^^^^^^^^^^^^^^\n" +
39888
		"	            ^^^^^^^^^^^^^^^^^^^^^^\n" +
39929
		"Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" +
39889
		"Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-17 / +2 lines)
Lines 391-410 Link Here
391
			"}"
391
			"}"
392
		},
392
		},
393
		"----------\n" +
393
		"----------\n" +
394
		"1. ERROR in X.java (at line 4)\r\n" +
394
		"1. ERROR in X.java (at line 5)\r\n" +
395
		"	static <L1 extends Listener & ErrorListener> Object createParser(L1 l) { return null; }\r\n" +
396
		"	                                                    ^^^^^^^^^^^^^^^^^^\n" +
397
		"Method createParser(L1) has the same erasure createParser(X.Listener) as another method in type X\n" +
398
		"----------\n" +
399
		"2. ERROR in X.java (at line 5)\r\n" +
400
		"	static <L2 extends ErrorListener & Listener> Object createParser(L2 l) { return null; }\r\n" +
395
		"	static <L2 extends ErrorListener & Listener> Object createParser(L2 l) { return null; }\r\n" +
401
		"	                                                    ^^^^^^^^^^^^^^^^^^\n" +
396
		"	                                                    ^^^^^^^^^^^^^^^^^^\n" +
402
		"Method createParser(L2) has the same erasure createParser(X.ErrorListener) as another method in type X\n" +
397
		"Method createParser(L2) has the same erasure createParser(X.ErrorListener) as another method in type X\n" +
403
		"----------\n" +
404
		"3. ERROR in X.java (at line 8)\r\n" +
405
		"	createParser(new A());\r\n" +
406
		"	^^^^^^^^^^^^\n" +
407
		"The method createParser(A) is undefined for the type X\n" +
408
		"----------\n"
398
		"----------\n"
409
	);
399
	);
410
}
400
}
Lines 1355-1366 Link Here
1355
			"}",
1345
			"}",
1356
		},
1346
		},
1357
		"----------\n" +
1347
		"----------\n" +
1358
		"1. ERROR in J.java (at line 2)\n" +
1348
		"1. ERROR in J.java (at line 3)\n" +
1359
		"	<T extends Number> T foo(final Number p);\n" +
1360
		"	                     ^^^^^^^^^^^^^^^^^^^\n" +
1361
		"Duplicate method foo(Number) in type J\n" +
1362
		"----------\n" +
1363
		"2. ERROR in J.java (at line 3)\n" +
1364
		"	Float foo(final Number p);\n" +
1349
		"	Float foo(final Number p);\n" +
1365
		"	      ^^^^^^^^^^^^^^^^^^^\n" +
1350
		"	      ^^^^^^^^^^^^^^^^^^^\n" +
1366
		"Duplicate method foo(Number) in type J\n" +
1351
		"Duplicate method foo(Number) in type J\n" +

Return to bug 146768