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

Collapse All | Expand All

(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-7 / +22 lines)
Lines 2380-2391 Link Here
2380
		"	       ^^^^\n" +
2380
		"	       ^^^^\n" +
2381
		"void[] is an invalid type\n" +
2381
		"void[] is an invalid type\n" +
2382
		"----------\n" +
2382
		"----------\n" +
2383
		"2. ERROR in p\\X.java (at line 5)\n" +
2383
		"2. ERROR in p\\X.java (at line 3)\n" +
2384
		"	public void method1()[] {\n" +
2385
		"	            ^^^^^^^^^^^\n" +
2386
		"Duplicate method method1() in type X\n" +
2387
		"----------\n" +
2388
		"3. ERROR in p\\X.java (at line 5)\n" +
2384
		"	public void[] method1() {\n" +
2389
		"	public void[] method1() {\n" +
2385
		"	       ^^^^^^\n" +
2390
		"	       ^^^^^^\n" +
2386
		"void[] is an invalid type\n" +
2391
		"void[] is an invalid type\n" +
2387
		"----------\n" +
2392
		"----------\n" +
2388
		"3. ERROR in p\\X.java (at line 5)\n" +
2393
		"4. ERROR in p\\X.java (at line 5)\n" +
2389
		"	public void[] method1() {\n" +
2394
		"	public void[] method1() {\n" +
2390
		"	              ^^^^^^^^^\n" +
2395
		"	              ^^^^^^^^^\n" +
2391
		"Duplicate method method1() in type X\n" +
2396
		"Duplicate method method1() in type X\n" +
Lines 3680-3686 Link Here
3680
			"}",
3685
			"}",
3681
		},
3686
		},
3682
		"----------\n" +
3687
		"----------\n" +
3683
		"1. ERROR in p\\Toplevel12.java (at line 17)\n" +
3688
		"1. ERROR in p\\Toplevel12.java (at line 4)\n" +
3689
		"	Object local(){\n" +
3690
		"	       ^^^^^^^\n" +
3691
		"Duplicate method local() in type Toplevel12\n" +
3692
		"----------\n" +
3693
		"2. ERROR in p\\Toplevel12.java (at line 17)\n" +
3684
		"	void local(){\n" +
3694
		"	void local(){\n" +
3685
		"	     ^^^^^^^\n" +
3695
		"	     ^^^^^^^\n" +
3686
		"Duplicate method local() in type Toplevel12\n" +
3696
		"Duplicate method local() in type Toplevel12\n" +
Lines 6668-6677 Link Here
6668
			"}",
6678
			"}",
6669
		},
6679
		},
6670
		"----------\n" +
6680
		"----------\n" +
6671
		"1. ERROR in p\\AX.java (at line 11)\n" +
6681
		"1. ERROR in p\\AX.java (at line 6)\n" + 
6672
		"	public AX() {\n" +
6682
		"	public AX() {\n" + 
6673
		"	       ^^^^\n" +
6683
		"	       ^^^^\n" + 
6674
		"Duplicate method AX() in type AX\n" +
6684
		"Duplicate method AX() in type AX\n" + 
6685
		"----------\n" + 
6686
		"2. ERROR in p\\AX.java (at line 11)\n" + 
6687
		"	public AX() {\n" + 
6688
		"	       ^^^^\n" + 
6689
		"Duplicate method AX() in type AX\n" + 
6675
		"----------\n"
6690
		"----------\n"
6676
	);
6691
	);
6677
}
6692
}
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-1 / +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", 1, unit.getProblems().length); //$NON-NLS-1$<
1319
		assertEquals("Wrong number of problems", 2, 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;
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (-1 / +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", 1, unit.getProblems().length); //$NON-NLS-1$<
1236
		assertEquals("Wrong number of problems", 2, 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;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-3 / +11 lines)
Lines 1165-1177 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
				}
1168
				AbstractMethodDeclaration method2Decl = method2.sourceMethod();
1177
				AbstractMethodDeclaration method2Decl = method2.sourceMethod();
1169
				if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
1178
				if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
1170
					if (isEnumSpecialMethod) {
1179
					if (isEnumSpecialMethod)
1171
						this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
1180
						this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
1172
					} else {
1181
					else
1173
						this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
1182
						this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
1174
					}
1175
					method2Decl.binding = null;
1183
					method2Decl.binding = null;
1176
					// do not alter original method array until resolution is over, due to reentrance (143259)
1184
					// do not alter original method array until resolution is over, due to reentrance (143259)
1177
					if (resolvedMethods == this.methods)
1185
					if (resolvedMethods == this.methods)
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (+13 lines)
Lines 91-96 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;
94
		count = 0;
95
		count = 0;
95
		for (int i = 0; i < size; i++) {
96
		for (int i = 0; i < size; i++) {
96
			FieldDeclaration field = fields[i];
97
			FieldDeclaration field = fields[i];
Lines 104-109 Link Here
104
				checkAndSetModifiersForField(fieldBinding, field);
105
				checkAndSetModifiersForField(fieldBinding, field);
105
106
106
				if (knownFieldNames.containsKey(field.name)) {
107
				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
								break;
116
							}
117
						}
118
					}
119
					knownFieldNames.put(field.name, null); // ensure that the duplicate field is found & removed
107
					problemReporter().duplicateFieldInType(sourceType, field);
120
					problemReporter().duplicateFieldInType(sourceType, field);
108
					field.binding = null;
121
					field.binding = null;
109
				} else {
122
				} else {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-37 / +151 lines)
Lines 3382-3390 Link Here
3382
			"1. ERROR in X.java (at line 6)\n" +
3382
			"1. ERROR in X.java (at line 6)\n" +
3383
			"	@Override T id(T x) { return x; }\n" +
3383
			"	@Override T id(T x) { return x; }\n" +
3384
			"	            ^^^^^^^\n" +
3384
			"	            ^^^^^^^\n" +
3385
			"Method id(T) has the same erasure id(A) as another method in type Y<T>\n" +
3386
			"----------\n" +
3387
			"2. ERROR in X.java (at line 6)\n" +
3388
			"	@Override T id(T x) { return x; }\n" +
3389
			"	            ^^^^^^^\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" +
3390
			"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" +
3386
			"----------\n" +
3391
			"----------\n" +
3387
			"2. ERROR in X.java (at line 7)\n" +
3392
			"3. ERROR in X.java (at line 7)\n" +
3388
			"	@Override A id(A x) { return x; }\n" +
3393
			"	@Override A id(A x) { return x; }\n" +
3389
			"	            ^^^^^^^\n" +
3394
			"	            ^^^^^^^\n" +
3390
			"Method id(A) has the same erasure id(A) as another method in type Y<T>\n" +
3395
			"Method id(A) has the same erasure id(A) as another method in type Y<T>\n" +
Lines 3495-3511 Link Here
3495
				"class Z {}"
3500
				"class Z {}"
3496
			},
3501
			},
3497
			"----------\n" +
3502
			"----------\n" +
3498
			"1. ERROR in X.java (at line 4)\n" +
3503
			"1. ERROR in X.java (at line 3)\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" +
3499
			"	Z foo(Object o) {  return null; } // duplicate\n" +
3509
			"	Z foo(Object o) {  return null; } // duplicate\n" +
3500
			"	  ^^^^^^^^^^^^^\n" +
3510
			"	  ^^^^^^^^^^^^^\n" +
3501
			"Duplicate method foo(Object) in type X.C1\n" +
3511
			"Duplicate method foo(Object) in type X.C1\n" +
3502
			"----------\n" +
3512
			"----------\n" +
3503
			"2. ERROR in X.java (at line 12)\n" +
3513
			"3. ERROR in X.java (at line 11)\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" +
3504
			"	A<Z> foo(Object o) {  return null; } // duplicate\n" +
3519
			"	A<Z> foo(Object o) {  return null; } // duplicate\n" +
3505
			"	     ^^^^^^^^^^^^^\n" +
3520
			"	     ^^^^^^^^^^^^^\n" +
3506
			"Duplicate method foo(Object) in type X.C3\n" +
3521
			"Duplicate method foo(Object) in type X.C3\n" +
3507
			"----------\n" +
3522
			"----------\n" +
3508
			"3. ERROR in X.java (at line 16)\n" +
3523
			"5. ERROR in X.java (at line 15)\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" +
3509
			"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" +
3529
			"	<T extends Z> T foo(Object o) {  return null; } // duplicate\n" +
3510
			"	                ^^^^^^^^^^^^^\n" +
3530
			"	                ^^^^^^^^^^^^^\n" +
3511
			"Duplicate method foo(Object) in type X.C4\n" +
3531
			"Duplicate method foo(Object) in type X.C4\n" +
Lines 3535-3541 Link Here
3535
				"class Z {}"
3555
				"class Z {}"
3536
			},
3556
			},
3537
			"----------\n" +
3557
			"----------\n" +
3538
			"1. ERROR in X.java (at line 4)\n" +
3558
			"1. ERROR in X.java (at line 3)\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" +
3539
			"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" +
3564
			"	A<Z> foo(A<Z> o) {  return null; } // duplicate\n" +
3540
			"	     ^^^^^^^^^^^\n" +
3565
			"	     ^^^^^^^^^^^\n" +
3541
			"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" +
3566
			"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" +
Lines 3594-3600 Link Here
3594
				"class B {}\n"
3619
				"class B {}\n"
3595
			},
3620
			},
3596
			"----------\n" +
3621
			"----------\n" +
3597
			"1. ERROR in X.java (at line 3)\n" +
3622
			"1. ERROR in X.java (at line 2)\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" +
3598
			"	<N> B a(A<Number> n) { return null; }\n" +
3628
			"	<N> B a(A<Number> n) { return null; }\n" +
3599
			"	      ^^^^^^^^^^^^^^\n" +
3629
			"	      ^^^^^^^^^^^^^^\n" +
3600
			"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" +
3630
			"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" +
Lines 3615-3621 Link Here
3615
				"class B {}\n"
3645
				"class B {}\n"
3616
			},
3646
			},
3617
			"----------\n" +
3647
			"----------\n" +
3618
			"1. ERROR in X.java (at line 3)\n" +
3648
			"1. ERROR in X.java (at line 2)\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" +
3619
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3654
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3620
			"	                ^^^^^^^^^^^^^^\n" +
3655
			"	                ^^^^^^^^^^^^^^\n" +
3621
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" +
3656
			"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" +
Lines 3636-3642 Link Here
3636
				"class B {}\n"
3671
				"class B {}\n"
3637
			},
3672
			},
3638
			"----------\n" +
3673
			"----------\n" +
3639
			"1. ERROR in X.java (at line 3)\n" +
3674
			"1. ERROR in X.java (at line 2)\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" +
3640
			"	B c(A<Number> n) { return null; }\n" +
3680
			"	B c(A<Number> n) { return null; }\n" +
3641
			"	  ^^^^^^^^^^^^^^\n" +
3681
			"	  ^^^^^^^^^^^^^^\n" +
3642
			"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" +
3682
			"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" +
Lines 3677-3688 Link Here
3677
				"class B {}\n"
3717
				"class B {}\n"
3678
			},
3718
			},
3679
			"----------\n" +
3719
			"----------\n" +
3680
			"1. ERROR in X.java (at line 3)\n" +
3720
			"1. ERROR in X.java (at line 2)\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" +
3681
			"	<N> B a(A<Number> n) { return null; }\n" +
3726
			"	<N> B a(A<Number> n) { return null; }\n" +
3682
			"	      ^^^^^^^^^^^^^^\n" +
3727
			"	      ^^^^^^^^^^^^^^\n" +
3683
			"Duplicate method a(A<Number>) in type X\n" +
3728
			"Duplicate method a(A<Number>) in type X\n" +
3684
			"----------\n" +
3729
			"----------\n" +
3685
			"2. ERROR in X.java (at line 5)\n" +
3730
			"3. ERROR in X.java (at line 4)\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" +
3686
			"	<N> B b(A<String> n) { return null; }\n" +
3736
			"	<N> B b(A<String> n) { return null; }\n" +
3687
			"	      ^^^^^^^^^^^^^^\n" +
3737
			"	      ^^^^^^^^^^^^^^\n" +
3688
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" +
3738
			"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" +
Lines 3706-3717 Link Here
3706
				"class B {}\n"
3756
				"class B {}\n"
3707
			},
3757
			},
3708
			"----------\n" +
3758
			"----------\n" +
3709
			"1. ERROR in X.java (at line 3)\n" +
3759
			"1. ERROR in X.java (at line 2)\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" +
3710
			"	<N extends B> B a(A<Number> n) { return null; }\n" +
3765
			"	<N extends B> B a(A<Number> n) { return null; }\n" +
3711
			"	                ^^^^^^^^^^^^^^\n" +
3766
			"	                ^^^^^^^^^^^^^^\n" +
3712
			"Duplicate method a(A<Number>) in type X\n" +
3767
			"Duplicate method a(A<Number>) in type X\n" +
3713
			"----------\n" +
3768
			"----------\n" +
3714
			"2. ERROR in X.java (at line 5)\n" +
3769
			"3. ERROR in X.java (at line 4)\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" +
3715
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3775
			"	<N extends B> B b(A<Number> n) { return null; }\n" +
3716
			"	                ^^^^^^^^^^^^^^\n" +
3776
			"	                ^^^^^^^^^^^^^^\n" +
3717
			"Duplicate method b(A<Number>) in type X\n" +
3777
			"Duplicate method b(A<Number>) in type X\n" +
Lines 3735-3746 Link Here
3735
				"class B {}\n"
3795
				"class B {}\n"
3736
			},
3796
			},
3737
			"----------\n" +
3797
			"----------\n" +
3738
			"1. ERROR in X.java (at line 3)\r\n" +
3798
			"1. ERROR in X.java (at line 2)\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" +
3739
			"	B a(A<Number> n) { return null; }\r\n" +
3804
			"	B a(A<Number> n) { return null; }\r\n" +
3740
			"	  ^^^^^^^^^^^^^^\n" +
3805
			"	  ^^^^^^^^^^^^^^\n" +
3741
			"Duplicate method a(A<Number>) in type X\n" +
3806
			"Duplicate method a(A<Number>) in type X\n" +
3742
			"----------\n" +
3807
			"----------\n" +
3743
			"2. ERROR in X.java (at line 5)\r\n" +
3808
			"3. ERROR in X.java (at line 4)\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" +
3744
			"	B b(A<Number> n) { return null; }\r\n" +
3814
			"	B b(A<Number> n) { return null; }\r\n" +
3745
			"	  ^^^^^^^^^^^^^^\n" +
3815
			"	  ^^^^^^^^^^^^^^\n" +
3746
			"Duplicate method b(A<Number>) in type X\n" +
3816
			"Duplicate method b(A<Number>) in type X\n" +
Lines 3783-3789 Link Here
3783
				"class A<T> {}\n",
3853
				"class A<T> {}\n",
3784
			},
3854
			},
3785
			"----------\n" +
3855
			"----------\n" +
3786
			"1. ERROR in X.java (at line 3)\n" +
3856
			"1. ERROR in X.java (at line 2)\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" +
3787
			"	void foo(A<Integer> a) {}\n" +
3862
			"	void foo(A<Integer> a) {}\n" +
3788
			"	     ^^^^^^^^^^^^^^^^^\n" +
3863
			"	     ^^^^^^^^^^^^^^^^^\n" +
3789
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" +
3864
			"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" +
Lines 3928-3934 Link Here
3928
				"}\n"
4003
				"}\n"
3929
			},
4004
			},
3930
			"----------\n" +
4005
			"----------\n" +
3931
			"1. ERROR in X.java (at line 3)\n" +
4006
			"1. ERROR in X.java (at line 2)\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" +
3932
			"	<T> T a(T x) {  return null; }\n" +
4012
			"	<T> T a(T x) {  return null; }\n" +
3933
			"	      ^^^^^^\n" +
4013
			"	      ^^^^^^\n" +
3934
			"Method a(T) has the same erasure a(Object) as another method in type X\n" +
4014
			"Method a(T) has the same erasure a(Object) as another method in type X\n" +
Lines 3954-3960 Link Here
3954
				"}\n"
4034
				"}\n"
3955
			},
4035
			},
3956
			"----------\n" +
4036
			"----------\n" +
3957
			"1. ERROR in X.java (at line 7)\n" +
4037
			"1. ERROR in X.java (at line 6)\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" +
3958
			"	<T extends X> T a(T x) {  return null; }\n" +
4043
			"	<T extends X> T a(T x) {  return null; }\n" +
3959
			"	                ^^^^^^\n" +
4044
			"	                ^^^^^^\n" +
3960
			"Method a(T) has the same erasure a(X) as another method in type X\n" +
4045
			"Method a(T) has the same erasure a(X) as another method in type X\n" +
Lines 3986-3992 Link Here
3986
				"}\n"
4071
				"}\n"
3987
			},
4072
			},
3988
			"----------\n" +
4073
			"----------\n" +
3989
			"1. ERROR in X.java (at line 3)\r\n" +
4074
			"1. ERROR in X.java (at line 2)\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" +
3990
			"	<T2 extends X<T2>> Object dupT() {return null;}\r\n" +
4080
			"	<T2 extends X<T2>> Object dupT() {return null;}\r\n" +
3991
			"	                          ^^^^^^\n" +
4081
			"	                          ^^^^^^\n" +
3992
			"Duplicate method dupT() in type X<T>\n" +
4082
			"Duplicate method dupT() in type X<T>\n" +
Lines 4936-4942 Link Here
4936
				"interface J {}\n"
5026
				"interface J {}\n"
4937
			},
5027
			},
4938
			"----------\n" +
5028
			"----------\n" +
4939
			"1. ERROR in A.java (at line 3)\r\n" +
5029
			"1. ERROR in A.java (at line 2)\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" +
4940
			"	<T, S extends I<T> & J> void foo() { }\r\n" +
5035
			"	<T, S extends I<T> & J> void foo() { }\r\n" +
4941
			"	                             ^^^^^\n" +
5036
			"	                             ^^^^^\n" +
4942
			"Duplicate method foo() in type A\n" +
5037
			"Duplicate method foo() in type A\n" +
Lines 4957-4963 Link Here
4957
				"interface K extends J {}"
5052
				"interface K extends J {}"
4958
			},
5053
			},
4959
			"----------\n" +
5054
			"----------\n" +
4960
			"1. ERROR in A.java (at line 3)\r\n" +
5055
			"1. ERROR in A.java (at line 2)\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" +
4961
			"	<T, S extends I<T> & K> void foo() { }\r\n" +
5061
			"	<T, S extends I<T> & K> void foo() { }\r\n" +
4962
			"	                             ^^^^^\n" +
5062
			"	                             ^^^^^\n" +
4963
			"Duplicate method foo() in type A\n" +
5063
			"Duplicate method foo() in type A\n" +
Lines 5878-5936 Link Here
5878
			"5. ERROR in DataSet.java (at line 6)\n" +
5978
			"5. ERROR in DataSet.java (at line 6)\n" +
5879
			"	public <S> S[] toArray(S[] s) {\n" +
5979
			"	public <S> S[] toArray(S[] s) {\n" +
5880
			"	               ^^^^^^^^^^^^^^\n" +
5980
			"	               ^^^^^^^^^^^^^^\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" +
5981
			"Method toArray(S[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" +
5882
			"----------\n" +
5982
			"----------\n" +
5883
			"6. ERROR in DataSet.java (at line 6)\n" +
5983
			"6. ERROR in DataSet.java (at line 6)\n" +
5884
			"	public <S> S[] toArray(S[] s) {\n" +
5984
			"	public <S> S[] toArray(S[] s) {\n" +
5885
			"	               ^^^^^^^^^^^^^^\n" +
5985
			"	               ^^^^^^^^^^^^^^\n" +
5986
			"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" +
5987
			"----------\n" +
5988
			"7. ERROR in DataSet.java (at line 6)\n" +
5989
			"	public <S> S[] toArray(S[] s) {\n" +
5990
			"	               ^^^^^^^^^^^^^^\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" +
5991
			"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" +
5887
			"----------\n" +
5992
			"----------\n" +
5888
			"7. ERROR in DataSet.java (at line 9)\n" +
5993
			"8. ERROR in DataSet.java (at line 9)\n" +
5889
			"	public Object[] toArray(Object[] o) {\n" +
5994
			"	public Object[] toArray(Object[] o) {\n" +
5890
			"	                ^^^^^^^^^^^^^^^^^^^\n" +
5995
			"	                ^^^^^^^^^^^^^^^^^^^\n" +
5891
			"Method toArray(Object[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" +
5996
			"Method toArray(Object[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" +
5892
			"----------\n" +
5997
			"----------\n" +
5893
			"8. WARNING in DataSet.java (at line 14)\n" +
5998
			"9. WARNING in DataSet.java (at line 14)\n" +
5894
			"	public boolean addAll(Collection c) {	return false; }\n" +
5999
			"	public boolean addAll(Collection c) {	return false; }\n" +
5895
			"	                      ^^^^^^^^^^\n" +
6000
			"	                      ^^^^^^^^^^\n" +
5896
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6001
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5897
			"----------\n" +
6002
			"----------\n" +
5898
			"9. WARNING in DataSet.java (at line 15)\n" +
6003
			"10. WARNING in DataSet.java (at line 15)\n" +
5899
			"	public boolean addAll(int index, Collection c) {	return false; }\n" +
6004
			"	public boolean addAll(int index, Collection c) {	return false; }\n" +
5900
			"	                                 ^^^^^^^^^^\n" +
6005
			"	                                 ^^^^^^^^^^\n" +
5901
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6006
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5902
			"----------\n" +
6007
			"----------\n" +
5903
			"10. WARNING in DataSet.java (at line 18)\n" +
6008
			"11. WARNING in DataSet.java (at line 18)\n" +
5904
			"	public boolean containsAll(Collection c) { return false; }\n" +
6009
			"	public boolean containsAll(Collection c) { return false; }\n" +
5905
			"	                           ^^^^^^^^^^\n" +
6010
			"	                           ^^^^^^^^^^\n" +
5906
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6011
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5907
			"----------\n" +
6012
			"----------\n" +
5908
			"11. WARNING in DataSet.java (at line 22)\n" +
6013
			"12. WARNING in DataSet.java (at line 22)\n" +
5909
			"	public Iterator iterator() {	return null; }\n" +
6014
			"	public Iterator iterator() {	return null; }\n" +
5910
			"	       ^^^^^^^^\n" +
6015
			"	       ^^^^^^^^\n" +
5911
			"Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" +
6016
			"Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" +
5912
			"----------\n" +
6017
			"----------\n" +
5913
			"12. WARNING in DataSet.java (at line 24)\n" +
6018
			"13. WARNING in DataSet.java (at line 24)\n" +
5914
			"	public ListIterator listIterator() {	return null; }\n" +
6019
			"	public ListIterator listIterator() {	return null; }\n" +
5915
			"	       ^^^^^^^^^^^^\n" +
6020
			"	       ^^^^^^^^^^^^\n" +
5916
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
6021
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
5917
			"----------\n" +
6022
			"----------\n" +
5918
			"13. WARNING in DataSet.java (at line 25)\n" +
6023
			"14. WARNING in DataSet.java (at line 25)\n" +
5919
			"	public ListIterator listIterator(int index) {	return null; }\n" +
6024
			"	public ListIterator listIterator(int index) {	return null; }\n" +
5920
			"	       ^^^^^^^^^^^^\n" +
6025
			"	       ^^^^^^^^^^^^\n" +
5921
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
6026
			"ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" +
5922
			"----------\n" +
6027
			"----------\n" +
5923
			"14. WARNING in DataSet.java (at line 28)\n" +
6028
			"15. WARNING in DataSet.java (at line 28)\n" +
5924
			"	public boolean removeAll(Collection c) {	return false; }\n" +
6029
			"	public boolean removeAll(Collection c) {	return false; }\n" +
5925
			"	                         ^^^^^^^^^^\n" +
6030
			"	                         ^^^^^^^^^^\n" +
5926
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6031
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5927
			"----------\n" +
6032
			"----------\n" +
5928
			"15. WARNING in DataSet.java (at line 29)\n" +
6033
			"16. WARNING in DataSet.java (at line 29)\n" +
5929
			"	public boolean retainAll(Collection c) {	return false; }\n" +
6034
			"	public boolean retainAll(Collection c) {	return false; }\n" +
5930
			"	                         ^^^^^^^^^^\n" +
6035
			"	                         ^^^^^^^^^^\n" +
5931
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
6036
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" +
5932
			"----------\n" +
6037
			"----------\n" +
5933
			"16. WARNING in DataSet.java (at line 32)\n" +
6038
			"17. WARNING in DataSet.java (at line 32)\n" +
5934
			"	public List subList(int fromIndex, int toIndex) {	return null; }\n" +
6039
			"	public List subList(int fromIndex, int toIndex) {	return null; }\n" +
5935
			"	       ^^^^\n" +
6040
			"	       ^^^^\n" +
5936
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
6041
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
Lines 6124-6130 Link Here
6124
			"}"
6229
			"}"
6125
		},
6230
		},
6126
		"----------\n" +
6231
		"----------\n" +
6127
		"1. ERROR in X.java (at line 14)\n" +
6232
		"1. ERROR in X.java (at line 11)\n" +
6233
		"	Integer getX(List<Integer> l) {\n" +
6234
		"	        ^^^^^^^^^^^^^^^^^^^^^\n" +
6235
		"Duplicate method getX(List<Integer>) in type Y\n" +
6236
		"----------\n" +
6237
		"2. ERROR in X.java (at line 14)\n" +
6128
		"	String getX(List<Integer> l) {\n" +
6238
		"	String getX(List<Integer> l) {\n" +
6129
		"	       ^^^^^^^^^^^^^^^^^^^^^\n" +
6239
		"	       ^^^^^^^^^^^^^^^^^^^^^\n" +
6130
		"Duplicate method getX(List<Integer>) in type Y\n" +
6240
		"Duplicate method getX(List<Integer>) in type Y\n" +
Lines 8076-8097 Link Here
8076
			"}\n"
8186
			"}\n"
8077
		},
8187
		},
8078
		"----------\n" +
8188
		"----------\n" +
8079
		"1. ERROR in X.java (at line 7)\n" +
8189
		"1. ERROR in X.java (at line 3)\n" +
8190
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date){\n" +
8191
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
8192
		"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" +
8193
		"----------\n" +
8194
		"2. ERROR in X.java (at line 7)\n" +
8080
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date){\n" +
8195
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date){\n" +
8081
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
8196
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\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" +
8197
		"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" +
8083
		"----------\n" +
8198
		"----------\n" +
8084
		"2. WARNING in X.java (at line 11)\n" +
8199
		"3. WARNING in X.java (at line 11)\n" +
8085
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date, D1 ... notUsed){\n" +
8200
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date, D1 ... notUsed){\n" +
8086
		"	                                                                                    ^^\n" +
8201
		"	                                                                                    ^^\n" +
8087
		"X.D1 is a raw type. References to generic type X.D1<T> should be parameterized\n" +
8202
		"X.D1 is a raw type. References to generic type X.D1<T> should be parameterized\n" +
8088
		"----------\n" +
8203
		"----------\n" +
8089
		"3. WARNING in X.java (at line 15)\n" +
8204
		"4. WARNING in X.java (at line 15)\n" +
8090
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date, D2 ... notUsed){\n" +
8205
		"	public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date, D2 ... notUsed){\n" +
8091
		"	                                                                            ^^\n" +
8206
		"	                                                                            ^^\n" +
8092
		"X.D2 is a raw type. References to generic type X.D2<T> should be parameterized\n" +
8207
		"X.D2 is a raw type. References to generic type X.D2<T> should be parameterized\n" +
8093
		"----------\n"
8208
		"----------\n");
8094
	);
8095
}
8209
}
8096
public void test151() {
8210
public void test151() {
8097
	this.runConformTest(
8211
	this.runConformTest(
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-9 / +23 lines)
Lines 176-182 Link Here
176
			"}"
176
			"}"
177
		},
177
		},
178
		"----------\n" +
178
		"----------\n" +
179
		"1. ERROR in X.java (at line 6)\n" +
179
		"1. ERROR in X.java (at line 3)\n" +
180
		"	BLEU, \n" +
181
		"	^^^^\n" +
182
		"Duplicate field X.BLEU\n" +
183
		"----------\n" +
184
		"2. ERROR in X.java (at line 6)\n" +
180
		"	BLEU;\n" +
185
		"	BLEU;\n" +
181
		"	^^^^\n" +
186
		"	^^^^\n" +
182
		"Duplicate field X.BLEU\n" +
187
		"Duplicate field X.BLEU\n" +
Lines 323-349 Link Here
323
			"}\n"
328
			"}\n"
324
		},
329
		},
325
		"----------\n" +
330
		"----------\n" +
326
		"1. ERROR in X.java (at line 8)\n" +
331
		"1. ERROR in X.java (at line 7)\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" +
327
		"	void values() {} \n" +
337
		"	void values() {} \n" +
328
		"	     ^^^^^^^^\n" +
338
		"	     ^^^^^^^^\n" +
329
		"The enum X already defines the method values() implicitly\n" +
339
		"The enum X already defines the method values() implicitly\n" +
330
		"----------\n" +
340
		"----------\n" +
331
		"2. ERROR in X.java (at line 9)\n" +
341
		"3. ERROR in X.java (at line 9)\n" +
332
		"	void dup() {} \n" +
342
		"	void dup() {} \n" +
333
		"	     ^^^^^\n" +
343
		"	     ^^^^^\n" +
334
		"Duplicate method dup() in type X\n" +
344
		"Duplicate method dup() in type X\n" +
335
		"----------\n" +
345
		"----------\n" +
336
		"3. ERROR in X.java (at line 10)\n" +
346
		"4. ERROR in X.java (at line 10)\n" +
337
		"	void values() {} \n" +
347
		"	void values() {} \n" +
338
		"	     ^^^^^^^^\n" +
348
		"	     ^^^^^^^^\n" +
339
		"The enum X already defines the method values() implicitly\n" +
349
		"The enum X already defines the method values() implicitly\n" +
340
		"----------\n" +
350
		"----------\n" +
341
		"4. ERROR in X.java (at line 11)\n" +
351
		"5. ERROR in X.java (at line 11)\n" +
342
		"	Missing dup() {} \n" +
352
		"	Missing dup() {} \n" +
343
		"	^^^^^^^\n" +
353
		"	^^^^^^^\n" +
344
		"Missing cannot be resolved to a type\n" +
354
		"Missing cannot be resolved to a type\n" +
345
		"----------\n" +
355
		"----------\n" +
346
		"5. ERROR in X.java (at line 11)\n" +
356
		"6. ERROR in X.java (at line 11)\n" +
347
		"	Missing dup() {} \n" +
357
		"	Missing dup() {} \n" +
348
		"	        ^^^^^\n" +
358
		"	        ^^^^^\n" +
349
		"Duplicate method dup() in type X\n" +
359
		"Duplicate method dup() in type X\n" +
Lines 1962-1973 Link Here
1962
		"	          ^^^^^\n" +
1972
		"	          ^^^^^\n" +
1963
		"The enum constant THREE must define the abstract method getSquare()\n" +
1973
		"The enum constant THREE must define the abstract method getSquare()\n" +
1964
		"----------\n" +
1974
		"----------\n" +
1965
		"4. ERROR in X.java (at line 4)\n" +
1975
		"4. ERROR in X.java (at line 3)\n" +
1966
		"	abstract int getSquare();\n" +
1976
		"	abstract int getSquare();\n" +
1967
		"	             ^^^^^^^^^^^\n" +
1977
		"	             ^^^^^^^^^^^\n" +
1968
		"Duplicate method getSquare() in type X\n" +
1978
		"Duplicate method getSquare() in type X\n" +
1969
		"----------\n"
1979
		"----------\n" +
1970
	);
1980
		"5. ERROR in X.java (at line 4)\n" +
1981
		"	abstract int getSquare();\n" +
1982
		"	             ^^^^^^^^^^^\n" +
1983
		"Duplicate method getSquare() in type X\n" +
1984
		"----------\n");
1971
}
1985
}
1972
1986
1973
/**
1987
/**
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-16 / +56 lines)
Lines 867-873 Link Here
867
				"}\n" ,
867
				"}\n" ,
868
			},
868
			},
869
			"----------\n" +
869
			"----------\n" +
870
			"1. ERROR in X.java (at line 3)\n" +
870
			"1. ERROR in X.java (at line 2)\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" +
871
			"	void foo(T t){}\n" +
876
			"	void foo(T t){}\n" +
872
			"	     ^^^^^^^^\n" +
877
			"	     ^^^^^^^^\n" +
873
			"Method foo(T) has the same erasure foo(Object) as another method in type X<E,T>\n" +
878
			"Method foo(T) has the same erasure foo(Object) as another method in type X<E,T>\n" +
Lines 884-890 Link Here
884
				"}\n" ,
889
				"}\n" ,
885
			},
890
			},
886
			"----------\n" +
891
			"----------\n" +
887
			"1. ERROR in X.java (at line 3)\n" +
892
			"1. ERROR in X.java (at line 2)\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" +
888
			"	void foo(T t){}\n" +
898
			"	void foo(T t){}\n" +
889
			"	     ^^^^^^^^\n" +
899
			"	     ^^^^^^^^\n" +
890
			"Method foo(T) has the same erasure foo(Exception) as another method in type X<E,T>\n" +
900
			"Method foo(T) has the same erasure foo(Exception) as another method in type X<E,T>\n" +
Lines 901-907 Link Here
901
				"}\n" ,
911
				"}\n" ,
902
			},
912
			},
903
			"----------\n" +
913
			"----------\n" +
904
			"1. ERROR in X.java (at line 3)\n" +
914
			"1. ERROR in X.java (at line 2)\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" +
905
			"	void foo(Exception e, T t){}\n" +
920
			"	void foo(Exception e, T t){}\n" +
906
			"	     ^^^^^^^^^^^^^^^^^^^^^\n" +
921
			"	     ^^^^^^^^^^^^^^^^^^^^^\n" +
907
			"Method foo(Exception, T) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" +
922
			"Method foo(Exception, T) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" +
Lines 974-990 Link Here
974
				"}\n",
989
				"}\n",
975
			},
990
			},
976
			"----------\n" +
991
			"----------\n" +
977
			"1. ERROR in X.java (at line 3)\n" +
992
			"1. ERROR in X.java (at line 2)\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" +
978
			"	void foo(L<T> l2){}\n" +
998
			"	void foo(L<T> l2){}\n" +
979
			"	     ^^^^^^^^^^^^\n" +
999
			"	     ^^^^^^^^^^^^\n" +
980
			"Method foo(L<T>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
1000
			"Method foo(L<T>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
981
			"----------\n" +
1001
			"----------\n" +
982
			"2. ERROR in X.java (at line 4)\n" +
1002
			"3. ERROR in X.java (at line 4)\n" +
983
			"	void foo(L l){}\n" +
1003
			"	void foo(L l){}\n" +
984
			"	     ^^^^^^^^\n" +
1004
			"	     ^^^^^^^^\n" +
985
			"Method foo(L) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
1005
			"Method foo(L) has the same erasure foo(L<E>) as another method in type X<E,T>\n" +
986
			"----------\n" +
1006
			"----------\n" +
987
			"3. WARNING in X.java (at line 4)\n" +
1007
			"4. WARNING in X.java (at line 4)\n" +
988
			"	void foo(L l){}\n" +
1008
			"	void foo(L l){}\n" +
989
			"	         ^\n" +
1009
			"	         ^\n" +
990
			"L is a raw type. References to generic type L<E> should be parameterized\n" +
1010
			"L is a raw type. References to generic type L<E> should be parameterized\n" +
Lines 7293-7304 Link Here
7293
				"}\n"
7313
				"}\n"
7294
			},
7314
			},
7295
			"----------\n" +
7315
			"----------\n" +
7296
			"1. ERROR in SubTypes.java (at line 6)\n" +
7316
			"1. ERROR in SubTypes.java (at line 5)\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" +
7297
			"	@Override public B foo() { return this; }\n" +
7322
			"	@Override public B foo() { return this; }\n" +
7298
			"	                   ^^^^^\n" +
7323
			"	                   ^^^^^\n" +
7299
			"Duplicate method foo() in type B\n" +
7324
			"Duplicate method foo() in type B\n" +
7300
			"----------\n" +
7325
			"----------\n" +
7301
			"2. ERROR in SubTypes.java (at line 9)\n" +
7326
			"3. ERROR in SubTypes.java (at line 9)\n" +
7302
			"	@Override public X foo() { return new X(); }\n" +
7327
			"	@Override public X foo() { return new X(); }\n" +
7303
			"	                 ^\n" +
7328
			"	                 ^\n" +
7304
			"The return type is incompatible with A.foo()\n" +
7329
			"The return type is incompatible with A.foo()\n" +
Lines 39759-39785 Link Here
39759
		"	                                                         ^\n" +
39784
		"	                                                         ^\n" +
39760
		"Cannot specify any additional bound T when first bound is a type parameter\n" +
39785
		"Cannot specify any additional bound T when first bound is a type parameter\n" +
39761
		"----------\n" +
39786
		"----------\n" +
39762
		"2. WARNING in X.java (at line 3)\n" +
39787
		"2. ERROR in X.java (at line 2)\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" +
39763
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39793
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39764
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39794
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39765
		"Type safety: Unchecked cast from Object to R\n" +
39795
		"Type safety: Unchecked cast from Object to R\n" +
39766
		"----------\n" +
39796
		"----------\n" +
39767
		"3. ERROR in X.java (at line 6)\n" +
39797
		"4. ERROR in X.java (at line 6)\n" +
39768
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39798
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39769
		"	                                                         ^^^^^^^^^^\n" +
39799
		"	                                                         ^^^^^^^^^^\n" +
39770
		"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" +
39800
		"Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" +
39771
		"----------\n" +
39801
		"----------\n" +
39772
		"4. ERROR in X.java (at line 6)\n" +
39802
		"5. ERROR in X.java (at line 6)\n" +
39773
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39803
		"	public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" +
39774
		"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" +
39804
		"	                                                                          ^^^^^^^^^^^^^^^^^^^\n" +
39775
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" +
39805
		"Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" +
39776
		"----------\n" +
39806
		"----------\n" +
39777
		"5. WARNING in X.java (at line 7)\n" +
39807
		"6. WARNING in X.java (at line 7)\n" +
39778
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39808
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39779
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39809
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39780
		"Type safety: Unchecked cast from Object to R\n" +
39810
		"Type safety: Unchecked cast from Object to R\n" +
39781
		"----------\n" +
39811
		"----------\n" +
39782
		"6. WARNING in X.java (at line 11)\n" +
39812
		"7. WARNING in X.java (at line 11)\n" +
39783
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39813
		"	return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" +
39784
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39814
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
39785
		"Type safety: Unchecked cast from Object to R\n" +
39815
		"Type safety: Unchecked cast from Object to R\n" +
Lines 39873-39889 Link Here
39873
			"}"
39903
			"}"
39874
		},
39904
		},
39875
		"----------\n" +
39905
		"----------\n" +
39876
		"1. WARNING in X.java (at line 2)\n" +
39906
		"1. ERROR 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" +
39877
		"	<T> void foo(Class<X> c) {};\n" +
39912
		"	<T> void foo(Class<X> c) {};\n" +
39878
		"	                   ^\n" +
39913
		"	                   ^\n" +
39879
		"X is a raw type. References to generic type X<U,V> should be parameterized\n" +
39914
		"X is a raw type. References to generic type X<U,V> should be parameterized\n" +
39880
		"----------\n" +
39915
		"----------\n" +
39881
		"2. ERROR in X.java (at line 3)\n" +
39916
		"3. ERROR in X.java (at line 3)\n" +
39882
		"	<A, B> void foo(Class<X<A, B>> c) {}\n" +
39917
		"	<A, B> void foo(Class<X<A, B>> c) {}\n" +
39883
		"	            ^^^^^^^^^^^^^^^^^^^^^\n" +
39918
		"	            ^^^^^^^^^^^^^^^^^^^^^\n" +
39884
		"Method foo(Class<X<A,B>>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" +
39919
		"Method foo(Class<X<A,B>>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" +
39885
		"----------\n" +
39920
		"----------\n" +
39886
		"3. ERROR in X.java (at line 5)\n" +
39921
		"4. ERROR in X.java (at line 4)\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" +
39887
		"	<A, B> void foo2(Class<X<U, V>> c) {}\n" +
39927
		"	<A, B> void foo2(Class<X<U, V>> c) {}\n" +
39888
		"	            ^^^^^^^^^^^^^^^^^^^^^^\n" +
39928
		"	            ^^^^^^^^^^^^^^^^^^^^^^\n" +
39889
		"Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" +
39929
		"Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-3 / +13 lines)
Lines 391-398 Link Here
391
			"}"
391
			"}"
392
		},
392
		},
393
		"----------\n" +
393
		"----------\n" +
394
		"1. ERROR in X.java (at line 5)\r\n" +
394
		"1. ERROR in X.java (at line 4)\n" +
395
		"	static <L2 extends ErrorListener & Listener> Object createParser(L2 l) { return null; }\r\n" +
395
		"	static <L1 extends Listener & ErrorListener> Object createParser(L1 l) { return null; }\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)\n" +
400
		"	static <L2 extends ErrorListener & Listener> Object createParser(L2 l) { return null; }\n" +
396
		"	                                                    ^^^^^^^^^^^^^^^^^^\n" +
401
		"	                                                    ^^^^^^^^^^^^^^^^^^\n" +
397
		"Method createParser(L2) has the same erasure createParser(X.ErrorListener) as another method in type X\n" +
402
		"Method createParser(L2) has the same erasure createParser(X.ErrorListener) as another method in type X\n" +
398
		"----------\n"
403
		"----------\n"
Lines 1345-1351 Link Here
1345
			"}",
1350
			"}",
1346
		},
1351
		},
1347
		"----------\n" +
1352
		"----------\n" +
1348
		"1. ERROR in J.java (at line 3)\n" +
1353
		"1. ERROR in J.java (at line 2)\n" +
1354
		"	<T extends Number> T foo(final Number p);\n" +
1355
		"	                     ^^^^^^^^^^^^^^^^^^^\n" +
1356
		"Duplicate method foo(Number) in type J\n" +
1357
		"----------\n" +
1358
		"2. ERROR in J.java (at line 3)\n" +
1349
		"	Float foo(final Number p);\n" +
1359
		"	Float foo(final Number p);\n" +
1350
		"	      ^^^^^^^^^^^^^^^^^^^\n" +
1360
		"	      ^^^^^^^^^^^^^^^^^^^\n" +
1351
		"Duplicate method foo(Number) in type J\n" +
1361
		"Duplicate method foo(Number) in type J\n" +

Return to bug 146768