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

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-18 / +47 lines)
Lines 11239-11262 Link Here
11239
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088
11239
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088
11240
public void test200() {
11240
public void test200() {
11241
	Map options = getCompilerOptions();
11241
	Map options = getCompilerOptions();
11242
	String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE);
11242
	String errorMessage =
11243
	String errorMessage = compliance == JavaCore.VERSION_1_6 ?
11244
			"----------\n" + 
11245
			"1. WARNING in X.java (at line 3)\n" + 
11246
			"	int foo(Collection bar) { return 0; }\n" + 
11247
			"	    ^^^^^^^^^^^^^^^^^^^\n" + 
11248
			"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + 
11249
			"----------\n" + 
11250
			"2. WARNING in X.java (at line 3)\n" + 
11251
			"	int foo(Collection bar) { return 0; }\n" + 
11252
			"	        ^^^^^^^^^^\n" + 
11253
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
11254
			"----------\n" + 
11255
			"3. WARNING in X.java (at line 4)\n" + 
11256
			"	double foo(Collection<String> bar) {return 0; }\n" + 
11257
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11258
			"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + 
11259
			"----------\n" :
11260
				"----------\n" + 
11243
				"----------\n" + 
11261
				"1. ERROR in X.java (at line 3)\n" + 
11244
				"1. ERROR in X.java (at line 3)\n" + 
11262
				"	int foo(Collection bar) { return 0; }\n" + 
11245
				"	int foo(Collection bar) { return 0; }\n" + 
Lines 13512-13515 Link Here
13512
		"Name clash: The method foo(A<Integer>) of type Sub has the same erasure as foo(A<Number>) of type Super but does not hide it\n" + 
13495
		"Name clash: The method foo(A<Integer>) of type Sub has the same erasure as foo(A<Number>) of type Super but does not hide it\n" + 
13513
		"----------\n");
13496
		"----------\n");
13514
}
13497
}
13498
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=355838
13499
public void testBug355838() throws Exception {
13500
	String output = 		
13501
			"----------\n" + 
13502
			"1. ERROR in ErasureBug.java (at line 4)\n" + 
13503
			"	public String output(List<String> integers) {\n" + 
13504
			"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13505
			"Method output(List<String>) has the same erasure output(List<E>) as another method in type ErasureBug\n" + 
13506
			"----------\n" + 
13507
			"2. ERROR in ErasureBug.java (at line 7)\n" + 
13508
			"	public String output(List doubles) {\n" + 
13509
			"	              ^^^^^^^^^^^^^^^^^^^^\n" + 
13510
			"Method output(List) has the same erasure output(List<E>) as another method in type ErasureBug\n" + 
13511
			"----------\n" + 
13512
			"3. WARNING in ErasureBug.java (at line 7)\n" + 
13513
			"	public String output(List doubles) {\n" + 
13514
			"	                     ^^^^\n" + 
13515
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
13516
			"----------\n" + 
13517
			"4. WARNING in ErasureBug.java (at line 10)\n" + 
13518
			"	public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + 
13519
			"	                                                                 ^^^^^^^^^^^^^^^\n" + 
13520
			"Type safety: The expression of type ArrayList needs unchecked conversion to conform to List<String>\n" + 
13521
			"----------\n" + 
13522
			"5. WARNING in ErasureBug.java (at line 10)\n" + 
13523
			"	public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + 
13524
			"	                                                                     ^^^^^^^^^\n" + 
13525
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
13526
			"----------\n";
13527
	this.runNegativeTest(
13528
		new String[] {
13529
			"ErasureBug.java",
13530
			"import java.util.ArrayList;\n" +
13531
			"import java.util.List;\n" +
13532
			"public class ErasureBug {\n" +
13533
			"    public String output(List<String> integers) {\n" +
13534
			"		return \"1\";\n" +
13535
			"	 }\n" +
13536
			"    public String output(List doubles) {\n" +
13537
			"		return \"2\";\n" +
13538
			"	 }\n" +
13539
			"	 public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" +
13540
			"}\n"
13541
		},
13542
		output);
13543
}
13515
}
13544
}
(-)a/org.eclipse.jdt.core/buildnotes_jdt-core.html (-1 / +3 lines)
Lines 52-58 Link Here
52
<h2>What's new in this drop</h2>
52
<h2>What's new in this drop</h2>
53
53
54
<h3>Problem Reports Fixed</h3>
54
<h3>Problem Reports Fixed</h3>
55
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=349326">349326</a>
55
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=355838">355838</a>
56
[compiler] ecj compiles the code that javac6 rejects
57
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=349326">349326</a>
56
[1.7] new warning for missing try-with-resources
58
[1.7] new warning for missing try-with-resources
57
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=354502">354502</a>
59
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=354502">354502</a>
58
Incorrect Compiler Warning: &quot;Method can be declared as static&quot;
60
Incorrect Compiler Warning: &quot;Method can be declared as static&quot;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-4 / +20 lines)
Lines 1240-1247 Link Here
1240
									int index = pLength;
1240
									int index = pLength;
1241
									// is erasure of signature of m2 same as signature of m1?
1241
									// is erasure of signature of m2 same as signature of m1?
1242
									for (; --index >= 0;) {
1242
									for (; --index >= 0;) {
1243
										if (params1[index] != params2[index].erasure())
1243
										if (params1[index] != params2[index].erasure()) {
1244
											break;
1244
											// If one of them is a raw type
1245
											if (params1[index] instanceof RawTypeBinding) {
1246
												if (params2[index].erasure() != ((RawTypeBinding)params1[index]).actualType()) {
1247
													break;
1248
												}
1249
											} else  {
1250
												break;
1251
											}
1252
										}
1245
										if (params1[index] == params2[index]) {
1253
										if (params1[index] == params2[index]) {
1246
											TypeBinding type = params1[index].leafComponentType();
1254
											TypeBinding type = params1[index].leafComponentType();
1247
											if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
1255
											if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
Lines 1253-1260 Link Here
1253
									if (index >= 0 && index < pLength) {
1261
									if (index >= 0 && index < pLength) {
1254
										// is erasure of signature of m1 same as signature of m2?
1262
										// is erasure of signature of m1 same as signature of m2?
1255
										for (index = pLength; --index >= 0;)
1263
										for (index = pLength; --index >= 0;)
1256
											if (params1[index].erasure() != params2[index])
1264
											if (params1[index].erasure() != params2[index]) {
1257
												break;
1265
												// If one of them is a raw type
1266
												if (params2[index] instanceof RawTypeBinding) {
1267
													if (params1[index].erasure() != ((RawTypeBinding)params2[index]).actualType()) {
1268
														break;
1269
													}
1270
												} else  {
1271
													break;
1272
												}
1273
											}
1258
										
1274
										
1259
									}
1275
									}
1260
									if (index >= 0) {
1276
									if (index >= 0) {

Return to bug 355838