View | Details | Raw Unified | Return to bug 238817
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (+87 lines)
Lines 8676-8679 Link Here
8676
		"----------\n"
8676
		"----------\n"
8677
	);
8677
	);
8678
}
8678
}
8679
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238014
8680
public void test166() {
8681
	this.runNegativeTest(
8682
		new String[] {
8683
			"X.java",
8684
			"class X extends A implements I<String> {}\n" +
8685
			"interface I<T> { void foo(T item); }\n" +
8686
			"class A {\n" +
8687
			"	public void foo(Object item) {}\n" +
8688
			"	public void foo(String item) {}\n" +
8689
			"}\n"
8690
		},
8691
		"----------\n" + 
8692
		"1. ERROR in X.java (at line 1)\n" + 
8693
		"	class X extends A implements I<String> {}\n" + 
8694
		"	      ^\n" + 
8695
		"Name clash: The method foo(Object) of type A has the same erasure as foo(T) of type I<T> but does not override it\n" + 
8696
		"----------\n"
8697
	);
8698
}
8699
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238817
8700
public void test167() {
8701
	this.runConformTest(
8702
		new String[] {
8703
			"X.java",
8704
			"class X implements I<String>, J<String> {\n" +
8705
			"	public <T3> void foo(T3 t, String s) {}\n" +
8706
			"}\n" +
8707
			"interface I<U1> { <T1> void foo(T1 t, U1 u); }\n" +
8708
			"interface J<U2> { <T2> void foo(T2 t, U2 u); }\n"
8709
		},
8710
		""
8711
	);
8712
}
8713
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=236096
8714
public void test168() {
8715
	this.runNegativeTest(
8716
		new String[] {
8717
			"X.java",
8718
			"class X<T> extends Y {\n" +
8719
			"	@Override <V> void foo(M m) { }\n" +
8720
			"	@Override <V> M bar() { return null; }\n" +
8721
			"}\n" +
8722
			"class Y<T> {\n" +
8723
			"	class M<V> {}\n" +
8724
			"	<V> void foo(M<V> m) {}\n" +
8725
			"	<V> M<V> bar() { return null; }\n" +
8726
			"}"
8727
		},
8728
		"----------\n" + 
8729
		"1. WARNING in X.java (at line 1)\n" + 
8730
		"	class X<T> extends Y {\n" + 
8731
		"	                   ^\n" + 
8732
		"Y is a raw type. References to generic type Y<T> should be parameterized\n" + 
8733
		"----------\n" + 
8734
		"2. ERROR in X.java (at line 2)\n" + 
8735
		"	@Override <V> void foo(M m) { }\n" + 
8736
		"	                   ^^^^^^^^\n" + 
8737
		"Name clash: The method foo(Y.M) of type X<T> has the same erasure as foo(Y.M) of type Y but does not override it\n" + 
8738
		"----------\n" + 
8739
		"3. ERROR in X.java (at line 2)\n" + 
8740
		"	@Override <V> void foo(M m) { }\n" + 
8741
		"	                   ^^^^^^^^\n" + 
8742
		mustOverrideMessage("foo(Y.M)", "X<T>") +
8743
		"----------\n" + 
8744
		"4. WARNING in X.java (at line 2)\n" + 
8745
		"	@Override <V> void foo(M m) { }\n" + 
8746
		"	                       ^\n" + 
8747
		"Y.M is a raw type. References to generic type Y<T>.M<V> should be parameterized\n" + 
8748
		"----------\n" + 
8749
		"5. WARNING in X.java (at line 3)\n" + 
8750
		"	@Override <V> M bar() { return null; }\n" + 
8751
		"	              ^\n" + 
8752
		"Y.M is a raw type. References to generic type Y<T>.M<V> should be parameterized\n" + 
8753
		"----------\n" + 
8754
		"6. ERROR in X.java (at line 3)\n" + 
8755
		"	@Override <V> M bar() { return null; }\n" + 
8756
		"	                ^^^^^\n" + 
8757
		"Name clash: The method bar() of type X<T> has the same erasure as bar() of type Y but does not override it\n" + 
8758
		"----------\n" + 
8759
		"7. ERROR in X.java (at line 3)\n" + 
8760
		"	@Override <V> M bar() { return null; }\n" + 
8761
		"	                ^^^^^\n" + 
8762
		mustOverrideMessage("bar()", "X<T>") +
8763
		"----------\n"
8764
	);
8765
}
8679
}
8766
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-48 / +85 lines)
Lines 45167-45173 Link Here
45167
}
45167
}
45168
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921 - variation
45168
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921 - variation
45169
public void test1344() throws Exception {
45169
public void test1344() throws Exception {
45170
	this.runConformTest(
45170
	this.runNegativeTest(
45171
			new String[] {
45171
			new String[] {
45172
				"X.java", // =================
45172
				"X.java", // =================
45173
				"import java.util.*;\n" +
45173
				"import java.util.*;\n" +
Lines 45185-45191 Link Here
45185
				"  }\n" +
45185
				"  }\n" +
45186
				"}\n", // =================
45186
				"}\n", // =================
45187
			},
45187
			},
45188
			"");
45188
			"----------\n" + 
45189
			"1. WARNING in X.java (at line 7)\n" + 
45190
			"	public class X<T> extends Adapter {\n" + 
45191
			"	                          ^^^^^^^\n" + 
45192
			"Adapter is a raw type. References to generic type Adapter<T> should be parameterized\n" + 
45193
			"----------\n" + 
45194
			"2. WARNING in X.java (at line 8)\n" + 
45195
			"	public <V> X.Setter makeSetter() {\n" + 
45196
			"	           ^^^^^^^^\n" + 
45197
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45198
			"----------\n" + 
45199
			"3. ERROR in X.java (at line 8)\n" + 
45200
			"	public <V> X.Setter makeSetter() {\n" + 
45201
			"	                    ^^^^^^^^^^^^\n" + 
45202
			"Name clash: The method makeSetter() of type X<T> has the same erasure as makeSetter() of type Adapter but does not override it\n" + 
45203
			"----------\n" + 
45204
			"4. WARNING in X.java (at line 9)\n" + 
45205
			"	return new X().new Setter() {};\n" + 
45206
			"	           ^\n" + 
45207
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
45208
			"----------\n" + 
45209
			"5. WARNING in X.java (at line 9)\n" + 
45210
			"	return new X().new Setter() {};\n" + 
45211
			"	                   ^^^^^^\n" + 
45212
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45213
			"----------\n" + 
45214
			"6. WARNING in X.java (at line 12)\n" + 
45215
			"	List<Adapter.Setter> l = new ArrayList<X.Setter>();\n" + 
45216
			"	     ^^^^^^^^^^^^^^\n" + 
45217
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45218
			"----------\n" + 
45219
			"7. WARNING in X.java (at line 12)\n" + 
45220
			"	List<Adapter.Setter> l = new ArrayList<X.Setter>();\n" + 
45221
			"	                                       ^^^^^^^^\n" + 
45222
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45223
			"----------\n"
45224
		);
45189
}
45225
}
45190
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921 - variation
45226
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921 - variation
45191
public void test1345() throws Exception {
45227
public void test1345() throws Exception {
Lines 45207-45258 Link Here
45207
				"  }\n" +
45243
				"  }\n" +
45208
				"}\n", // =================
45244
				"}\n", // =================
45209
			},
45245
			},
45210
			"----------\n" +
45246
			"----------\n" + 
45211
			"1. WARNING in X.java (at line 7)\n" +
45247
			"1. WARNING in X.java (at line 7)\n" + 
45212
			"	public class X<T> extends Adapter {\n" +
45248
			"	public class X<T> extends Adapter {\n" + 
45213
			"	                          ^^^^^^^\n" +
45249
			"	                          ^^^^^^^\n" + 
45214
			"Adapter is a raw type. References to generic type Adapter<T> should be parameterized\n" +
45250
			"Adapter is a raw type. References to generic type Adapter<T> should be parameterized\n" + 
45215
			"----------\n" +
45251
			"----------\n" + 
45216
			"2. WARNING in X.java (at line 8)\n" +
45252
			"2. WARNING in X.java (at line 8)\n" + 
45217
			"	public <V> X.Setter makeSetter() {\n" +
45253
			"	public <V> X.Setter makeSetter() {\n" + 
45218
			"	           ^^^^^^^^\n" +
45254
			"	           ^^^^^^^^\n" + 
45219
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" +
45255
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45220
			"----------\n" +
45256
			"----------\n" + 
45221
			"3. WARNING in X.java (at line 8)\n" +
45257
			"3. ERROR in X.java (at line 8)\n" + 
45222
			"	public <V> X.Setter makeSetter() {\n" +
45258
			"	public <V> X.Setter makeSetter() {\n" + 
45223
			"	                    ^^^^^^^^^^^^\n" +
45259
			"	                    ^^^^^^^^^^^^\n" + 
45224
			"The method makeSetter() of type X<T> should be tagged with @Override since it actually overrides a superclass method\n" +
45260
			"Name clash: The method makeSetter() of type X<T> has the same erasure as makeSetter() of type Adapter but does not override it\n" + 
45225
			"----------\n" +
45261
			"----------\n" + 
45226
			"4. ERROR in X.java (at line 9)\n" +
45262
			"4. ERROR in X.java (at line 9)\n" + 
45227
			"	return (String) new X().new Setter() {};\n" +
45263
			"	return (String) new X().new Setter() {};\n" + 
45228
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
45264
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
45229
			"Cannot cast from new Adapter.Setter(){} to String\n" +
45265
			"Cannot cast from new Adapter.Setter(){} to String\n" + 
45230
			"----------\n" +
45266
			"----------\n" + 
45231
			"5. ERROR in X.java (at line 9)\n" +
45267
			"5. ERROR in X.java (at line 9)\n" + 
45232
			"	return (String) new X().new Setter() {};\n" +
45268
			"	return (String) new X().new Setter() {};\n" + 
45233
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
45269
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
45234
			"Type mismatch: cannot convert from String to Adapter.Setter\n" +
45270
			"Type mismatch: cannot convert from String to Adapter.Setter\n" + 
45235
			"----------\n" +
45271
			"----------\n" + 
45236
			"6. WARNING in X.java (at line 9)\n" +
45272
			"6. WARNING in X.java (at line 9)\n" + 
45237
			"	return (String) new X().new Setter() {};\n" +
45273
			"	return (String) new X().new Setter() {};\n" + 
45238
			"	                    ^\n" +
45274
			"	                    ^\n" + 
45239
			"X is a raw type. References to generic type X<T> should be parameterized\n" +
45275
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
45240
			"----------\n" +
45276
			"----------\n" + 
45241
			"7. WARNING in X.java (at line 9)\n" +
45277
			"7. WARNING in X.java (at line 9)\n" + 
45242
			"	return (String) new X().new Setter() {};\n" +
45278
			"	return (String) new X().new Setter() {};\n" + 
45243
			"	                            ^^^^^^\n" +
45279
			"	                            ^^^^^^\n" + 
45244
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" +
45280
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45245
			"----------\n" +
45281
			"----------\n" + 
45246
			"8. WARNING in X.java (at line 12)\n" +
45282
			"8. WARNING in X.java (at line 12)\n" + 
45247
			"	List<Adapter.Setter> l = new ArrayList<X.Setter>();\n" +
45283
			"	List<Adapter.Setter> l = new ArrayList<X.Setter>();\n" + 
45248
			"	     ^^^^^^^^^^^^^^\n" +
45284
			"	     ^^^^^^^^^^^^^^\n" + 
45249
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" +
45285
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45250
			"----------\n" +
45286
			"----------\n" + 
45251
			"9. WARNING in X.java (at line 12)\n" +
45287
			"9. WARNING in X.java (at line 12)\n" + 
45252
			"	List<Adapter.Setter> l = new ArrayList<X.Setter>();\n" +
45288
			"	List<Adapter.Setter> l = new ArrayList<X.Setter>();\n" + 
45253
			"	                                       ^^^^^^^^\n" +
45289
			"	                                       ^^^^^^^^\n" + 
45254
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" +
45290
			"Adapter.Setter is a raw type. References to generic type Adapter<T>.Setter<V> should be parameterized\n" + 
45255
			"----------\n");
45291
			"----------\n"
45292
		);
45256
}
45293
}
45257
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921 - variation
45294
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921 - variation
45258
public void test1346() throws Exception {
45295
public void test1346() throws Exception {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (-33 / +44 lines)
Lines 165-181 Link Here
165
	}
165
	}
166
166
167
	if (this.type.addSyntheticBridgeMethod(originalInherited, currentMethod.original()) != null) {
167
	if (this.type.addSyntheticBridgeMethod(originalInherited, currentMethod.original()) != null) {
168
		for (int i = 0, l = allInheritedMethods.length; i < l; i++) {
168
		for (int i = 0, l = allInheritedMethods == null ? 0 : allInheritedMethods.length; i < l; i++) {
169
			MethodBinding otherInheritedMethod = allInheritedMethods[i];
169
			if (allInheritedMethods[i] != null && detectInheritedNameClash(originalInherited, allInheritedMethods[i].original()))
170
			MethodBinding otherOriginal = otherInheritedMethod.original();
171
			// only check inherited methods that are different & come from separate inheritance paths
172
			if (otherOriginal == originalInherited || otherOriginal == otherInheritedMethod) continue;
173
			if (inheritedMethod.areParametersEqual(otherInheritedMethod)) continue;
174
			// skip it if otherInheritedMethod is defined by a subtype of inheritedMethod's declaringClass
175
			if (otherInheritedMethod.declaringClass.erasure() != inheritedMethod.declaringClass.erasure())
176
				if (otherInheritedMethod.declaringClass.findSuperTypeOriginatingFrom(inheritedMethod.declaringClass) != null)
177
					continue;
178
			if (detectInheritedNameClash(originalInherited, otherOriginal))
179
				return;
170
				return;
180
		}
171
		}
181
	}
172
	}
Lines 295-303 Link Here
295
			problemReporter().duplicateInheritedMethods(this.type, inheritedMethod, otherInheritedMethod);
286
			problemReporter().duplicateInheritedMethods(this.type, inheritedMethod, otherInheritedMethod);
296
			return;
287
			return;
297
		}
288
		}
298
	} else if (inheritedMethod.declaringClass.findSuperTypeOriginatingFrom(otherInheritedMethod.declaringClass) != null) {
299
		// skip it if inheritedMethod is defined by a subtype of otherInheritedMethod declaringClass
300
		return;
301
	}
289
	}
302
290
303
	// the 2 inherited methods clash because of a parameterized type overrides a raw type
291
	// the 2 inherited methods clash because of a parameterized type overrides a raw type
Lines 437-455 Link Here
437
		}
425
		}
438
426
439
		int index = -1;
427
		int index = -1;
428
		int inheritedLength = inherited.length;
440
		MethodBinding[] matchingInherited = new MethodBinding[inherited.length];
429
		MethodBinding[] matchingInherited = new MethodBinding[inherited.length];
441
		byte[] foundMatch = new byte[inherited.length];
430
		MethodBinding[] foundMatch = new MethodBinding[inherited.length]; // null is no match, otherwise value is matching currentMethod
442
		if (current != null) {
431
		if (current != null) {
443
			for (int i = 0, length1 = current.length; i < length1; i++) {
432
			for (int i = 0, length1 = current.length; i < length1; i++) {
444
				MethodBinding currentMethod = current[i];
433
				MethodBinding currentMethod = current[i];
445
				for (int j = 0, length2 = inherited.length; j < length2; j++) {
434
				MethodBinding[] nonMatchingInherited = null;
435
				for (int j = 0; j < inheritedLength; j++) {
446
					MethodBinding inheritedMethod = computeSubstituteMethod(inherited[j], currentMethod);
436
					MethodBinding inheritedMethod = computeSubstituteMethod(inherited[j], currentMethod);
447
					if (inheritedMethod != null) {
437
					if (inheritedMethod != null) {
448
						if (foundMatch[j] == 0 && isSubstituteParameterSubsignature(currentMethod, inheritedMethod)) {
438
						if (foundMatch[j] == null && isSubstituteParameterSubsignature(currentMethod, inheritedMethod)) {
449
							matchingInherited[++index] = inheritedMethod;
439
							matchingInherited[++index] = inheritedMethod;
450
							foundMatch[j] = 1; // cannot null out inherited methods
440
							foundMatch[j] = currentMethod;
451
						} else {
441
						} else {
442
							// best place to check each currentMethod against each non-matching inheritedMethod
452
							checkForNameClash(currentMethod, inheritedMethod);
443
							checkForNameClash(currentMethod, inheritedMethod);
444
							if (inheritedLength > 1) {
445
								if (nonMatchingInherited == null)
446
									nonMatchingInherited = new MethodBinding[inheritedLength];
447
								nonMatchingInherited[j] = inheritedMethod;
448
							}
453
						}
449
						}
454
					}
450
					}
455
				}
451
				}
Lines 457-484 Link Here
457
					// see addtional comments in https://bugs.eclipse.org/bugs/show_bug.cgi?id=122881
453
					// see addtional comments in https://bugs.eclipse.org/bugs/show_bug.cgi?id=122881
458
					// if (index > 0 && currentMethod.declaringClass.isInterface()) // only check when inherited methods are from interfaces
454
					// if (index > 0 && currentMethod.declaringClass.isInterface()) // only check when inherited methods are from interfaces
459
					//	checkInheritedReturnTypes(matchingInherited, index + 1);
455
					//	checkInheritedReturnTypes(matchingInherited, index + 1);
460
					checkAgainstInheritedMethods(currentMethod, matchingInherited, index + 1, inherited); // pass in the length of matching
456
					checkAgainstInheritedMethods(currentMethod, matchingInherited, index + 1, nonMatchingInherited); // pass in the length of matching
461
					while (index >= 0) matchingInherited[index--] = null; // clear the contents of the matching methods
457
					while (index >= 0) matchingInherited[index--] = null; // clear the contents of the matching methods
462
				}
458
				}
463
			}
459
			}
464
		}
460
		}
465
461
466
		for (int i = 0, length = inherited.length; i < length; i++) {
462
		// skip tracks which inherited methods have matched other inherited methods
467
			if (foundMatch[i] == 1) continue;
463
		// either because they match the same currentMethod or match each other
468
464
		boolean[] skip = new boolean[inheritedLength];
465
		for (int i = 0; i < inheritedLength; i++) {
466
			if (skip[i]) continue;
469
			MethodBinding inheritedMethod = inherited[i];
467
			MethodBinding inheritedMethod = inherited[i];
470
			matchingInherited[++index] = inheritedMethod;
468
			MethodBinding matchMethod = foundMatch[i];
471
			for (int j = i + 1; j < length; j++) {
469
			if (matchMethod == null)
470
				matchingInherited[++index] = inheritedMethod;
471
			for (int j = i + 1; j < inheritedLength; j++) {
472
				MethodBinding otherInheritedMethod = inherited[j];
472
				MethodBinding otherInheritedMethod = inherited[j];
473
				if (foundMatch[j] == 1 || canSkipInheritedMethods(inheritedMethod, otherInheritedMethod))
473
				if (matchMethod == foundMatch[j] && matchMethod != null)
474
					continue; // both inherited methods matched the same currentMethod
475
				if (canSkipInheritedMethods(inheritedMethod, otherInheritedMethod))
474
					continue;
476
					continue;
475
				otherInheritedMethod = computeSubstituteMethod(otherInheritedMethod, inheritedMethod);
477
				otherInheritedMethod = computeSubstituteMethod(otherInheritedMethod, inheritedMethod);
476
				if (otherInheritedMethod != null) {
478
				if (otherInheritedMethod != null) {
477
					if (inheritedMethod.declaringClass != otherInheritedMethod.declaringClass
479
					if (inheritedMethod.declaringClass != otherInheritedMethod.declaringClass
478
						&& isSubstituteParameterSubsignature(inheritedMethod, otherInheritedMethod)) {
480
						&& isSubstituteParameterSubsignature(inheritedMethod, otherInheritedMethod)) {
481
							if (index == -1)
482
								matchingInherited[++index] = inheritedMethod;
479
							matchingInherited[++index] = otherInheritedMethod;
483
							matchingInherited[++index] = otherInheritedMethod;
480
							foundMatch[j] = 1; // cannot null out inherited methods
484
							skip[j] = true;
481
					} else {
485
					} else if (matchMethod == null && foundMatch[j] == null) {
482
						checkInheritedMethods(inheritedMethod, otherInheritedMethod);
486
						checkInheritedMethods(inheritedMethod, otherInheritedMethod);
483
					}
487
					}
484
				}
488
				}
Lines 487-493 Link Here
487
491
488
			if (index > 0)
492
			if (index > 0)
489
				checkInheritedMethods(matchingInherited, index + 1); // pass in the length of matching
493
				checkInheritedMethods(matchingInherited, index + 1); // pass in the length of matching
490
			else if (mustImplementAbstractMethods && index == 0 && matchingInherited[0].isAbstract())
494
			else if (mustImplementAbstractMethods && matchingInherited[0].isAbstract())
491
				checkAbstractMethod(matchingInherited[0]);
495
				checkAbstractMethod(matchingInherited[0]);
492
			while (index >= 0) matchingInherited[index--] = null; // clear the previous contents of the matching methods
496
			while (index >= 0) matchingInherited[index--] = null; // clear the previous contents of the matching methods
493
		}
497
		}
Lines 593-609 Link Here
593
   return substitute;
597
   return substitute;
594
}
598
}
595
boolean detectInheritedNameClash(MethodBinding inherited, MethodBinding otherInherited) {
599
boolean detectInheritedNameClash(MethodBinding inherited, MethodBinding otherInherited) {
596
	if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure()) return false;
600
	if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure())
601
		return false;
602
	// skip it if otherInherited is defined by a subtype of inherited's declaringClass
603
	if (inherited.declaringClass.erasure() != otherInherited.declaringClass.erasure())
604
		if (inherited.declaringClass.findSuperTypeOriginatingFrom(otherInherited.declaringClass) != null)
605
			return false;
597
606
598
	problemReporter().inheritedMethodsHaveNameClash(this.type, inherited, otherInherited);
607
	problemReporter().inheritedMethodsHaveNameClash(this.type, inherited, otherInherited);
599
	return true;
608
	return true;
600
}
609
}
601
boolean detectNameClash(MethodBinding current, MethodBinding inherited) {
610
boolean detectNameClash(MethodBinding current, MethodBinding inherited) {
602
	MethodBinding original = inherited.original(); // can be the same as inherited
611
	MethodBinding original = inherited.original(); // can be the same as inherited
603
	if (!current.areParameterErasuresEqual(original) || current.returnType.erasure() != original.returnType.erasure()) return false;
612
	if (!current.areParameterErasuresEqual(original) || current.returnType.erasure() != original.returnType.erasure())
613
		return false;
604
614
605
	problemReporter(current).methodNameClash(current,
615
	problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original);
606
			inherited.declaringClass.isRawType() ? inherited : original);
607
	return true;
616
	return true;
608
}
617
}
609
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
618
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
Lines 744-751 Link Here
744
	}
753
	}
745
754
746
	if (substituteMethod instanceof ParameterizedGenericMethodBinding) {
755
	if (substituteMethod instanceof ParameterizedGenericMethodBinding) {
756
		if (method.typeVariables != Binding.NO_TYPE_VARIABLES)
757
			return !((ParameterizedGenericMethodBinding) substituteMethod).isRaw;
747
		// since substituteMethod has substituted type variables, method cannot have a generic signature AND no variables -> its a name clash if it does
758
		// since substituteMethod has substituted type variables, method cannot have a generic signature AND no variables -> its a name clash if it does
748
		return ! (hasGenericParameter(method) && method.typeVariables == Binding.NO_TYPE_VARIABLES);
759
		return !hasGenericParameter(method);
749
	}
760
	}
750
761
751
	// if method has its own variables, then substituteMethod failed bounds check in computeSubstituteMethod()
762
	// if method has its own variables, then substituteMethod failed bounds check in computeSubstituteMethod()

Return to bug 238817