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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-1 / +7 lines)
Lines 1063-1071 Link Here
1063
			method.tagBits |= TagBits.HasMissingType;
1063
			method.tagBits |= TagBits.HasMissingType;
1064
		}
1064
		}
1065
	}
1065
	}
1066
	long sourceLevel = this.environment.globalOptions.originalSourceLevel;
1066
	for (int i = method.parameters.length; --i >= 0;) {
1067
	for (int i = method.parameters.length; --i >= 0;) {
1067
		TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, true /* raw conversion */);
1068
		TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, true /* raw conversion */);
1068
		method.parameters[i] = resolvedType;
1069
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446
1070
		if (sourceLevel < ClassFileConstants.JDK1_5) {
1071
			method.parameters[i] = resolvedType.erasure();
1072
		} else {
1073
			method.parameters[i] = resolvedType;
1074
		}
1069
		if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
1075
		if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
1070
			method.tagBits |= TagBits.HasMissingType;
1076
			method.tagBits |= TagBits.HasMissingType;
1071
		}
1077
		}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-68 / +137 lines)
Lines 11417-11424 Link Here
11417
		false,
11417
		false,
11418
		compilerOptions14);
11418
		compilerOptions14);
11419
}
11419
}
11420
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 
11420
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446
11421
public void _test331446() {
11421
public void test331446() {
11422
	Map compilerOptions15 = getCompilerOptions();
11422
	Map compilerOptions15 = getCompilerOptions();
11423
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11423
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11424
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11424
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
Lines 11457-11465 Link Here
11457
		null);
11457
		null);
11458
11458
11459
	Map compilerOptions14 = getCompilerOptions();
11459
	Map compilerOptions14 = getCompilerOptions();
11460
//	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
11461
//	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11462
//	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
11463
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
11460
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
11464
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11461
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11465
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11462
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
Lines 11490-11509 Link Here
11490
		compilerOptions14,
11487
		compilerOptions14,
11491
		null);
11488
		null);
11492
}
11489
}
11493
public void test1415Mix() {
11490
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446
11491
public void test331446a() {
11494
	Map compilerOptions15 = getCompilerOptions();
11492
	Map compilerOptions15 = getCompilerOptions();
11495
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11493
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4);
11496
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11494
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11497
	compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
11495
	compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
11498
	this.runConformTest(
11496
	this.runConformTest(
11499
		new String[] {
11497
		new String[] {
11500
			"Abstract.java",
11498
			"Test.java",
11501
			"abstract class Generic<T> {\n" +
11499
			"import java.util.Comparator;\n" + 
11502
			"	abstract void foo(T t);\n" +
11500
			"import java.util.List;\n" + 
11503
			"}\n" +
11501
			"\n" + 
11504
			"public abstract class Abstract extends Generic<String> {\n" +
11502
			"public class Test {\n" + 
11505
			"}"
11503
			"	public static  void assertEquals(String message,\n" + 
11506
			},
11504
			"			Comparator comparator, List expected, List actual) {\n" + 
11505
			"		if (expected.size() != actual.size()) {\n" + 
11506
			"			//failNotEquals(message, expected, actual);\n" + 
11507
			"		}\n" + 
11508
			"		for (int i = 0, l = expected.size(); i < l; i++) {\n" + 
11509
			"			assertEquals(message, comparator, expected.get(i), actual.get(i));\n" + 
11510
			"		}\n" + 
11511
			"	}\n" + 
11512
			"	public static void assertEquals(String message,\n" + 
11513
			"			Comparator comparator, Object expected, Object actual) {\n" + 
11514
			"		if (comparator.compare(expected, actual) == 0) {\n" + 
11515
			"			return;\n" + 
11516
			"		}\n" + 
11517
			"		//failNotEquals(message, expected, actual);\n" + 
11518
			"	}\n" + 
11519
			"}\n" + 
11520
			""
11521
		},
11507
		"",
11522
		"",
11508
		null,
11523
		null,
11509
		true,
11524
		true,
Lines 11516-11579 Link Here
11516
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11531
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11517
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11532
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11518
	compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
11533
	compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
11519
	this.runNegativeTest(
11520
		new String[] {
11521
			"Concrete.java",
11522
			"public class Concrete extends Abstract {\n" +
11523
			"}",
11524
		},
11525
		"----------\n" + 
11526
		"1. ERROR in Concrete.java (at line 1)\n" + 
11527
		"	public class Concrete extends Abstract {\n" + 
11528
		"	             ^^^^^^^^\n" + 
11529
		"The type Concrete must implement the inherited abstract method Generic<String>.foo(String)\n" + 
11530
		"----------\n",
11531
		null,
11532
		false,
11533
		compilerOptions14);	
11534
}
11535
public void test1415Mix2() {
11536
	Map compilerOptions15 = getCompilerOptions();
11537
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11538
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11539
	compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
11540
	this.runConformTest(
11534
	this.runConformTest(
11541
		new String[] {
11535
		new String[] {
11542
			"Abstract.java",
11536
			"X.java",
11543
			"abstract class Generic<T> {\n" +
11537
			"import java.util.ArrayList;\n" + 
11544
			"	abstract void foo(T t);\n" +
11538
			"import java.util.Comparator;\n" + 
11545
			"}\n" +
11539
			"\n" + 
11546
			"public abstract class Abstract extends Generic<String> {\n" +
11540
			"public class X {\n" + 
11547
			"}"
11541
			"	public static void testAmbiguity() {\n" + 
11548
			},
11542
			"		Comparator comparator = new Comparator() {\n" + 
11543
			"			\n" + 
11544
			"			public int compare(Object o1, Object o2) {\n" + 
11545
			"				return 0;\n" + 
11546
			"			}\n" + 
11547
			"		};\n" + 
11548
			"		Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + 
11549
			"	}\n" + 
11550
			"}\n" + 
11551
			"",
11552
		},
11549
		"",
11553
		"",
11550
		null,
11554
		null,
11551
		true,
11555
		false,
11552
		null,
11556
		null,
11553
		compilerOptions15,
11557
		compilerOptions14,
11554
		null);
11558
		null);
11555
11556
	Map compilerOptions14 = getCompilerOptions();
11557
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
11558
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11559
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11560
	compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
11561
	this.runConformTest(
11562
			new String[] {
11563
					"Concrete.java",
11564
					"public class Concrete extends Abstract {\n" +
11565
					"    void foo(String s) {}\n" +
11566
					"}",
11567
			},
11568
			"",
11569
			null,
11570
			false,
11571
			null,
11572
			compilerOptions14,
11573
			null);	
11574
}
11559
}
11575
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.4)
11560
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.4)
11576
public void test331446a() {
11561
public void test331446b() {
11577
	Map compilerOptions14 = getCompilerOptions();
11562
	Map compilerOptions14 = getCompilerOptions();
11578
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4);
11563
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4);
11579
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11564
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
Lines 11611-11617 Link Here
11611
		null);
11596
		null);
11612
}
11597
}
11613
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (1.4/1.5 mix)
11598
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (1.4/1.5 mix)
11614
public void _test331446b() {
11599
public void test331446c() {
11615
	Map compilerOptions15 = getCompilerOptions();
11600
	Map compilerOptions15 = getCompilerOptions();
11616
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11601
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11617
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11602
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
Lines 11654-11660 Link Here
11654
		null);
11639
		null);
11655
}
11640
}
11656
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.5)
11641
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.5)
11657
public void test331446c() {
11642
public void test331446d() {
11658
	Map compilerOptions15 = getCompilerOptions();
11643
	Map compilerOptions15 = getCompilerOptions();
11659
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11644
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11660
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11645
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
Lines 11690-11693 Link Here
11690
		compilerOptions15,
11675
		compilerOptions15,
11691
		null);
11676
		null);
11692
}
11677
}
11678
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446
11679
public void test1415Mix() {
11680
	Map compilerOptions15 = getCompilerOptions();
11681
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11682
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11683
	compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
11684
	this.runConformTest(
11685
		new String[] {
11686
			"Abstract.java",
11687
			"abstract class Generic<T> {\n" +
11688
			"	abstract void foo(T t);\n" +
11689
			"}\n" +
11690
			"public abstract class Abstract extends Generic<String> {\n" +
11691
			"}"
11692
			},
11693
		"",
11694
		null,
11695
		true,
11696
		null,
11697
		compilerOptions15,
11698
		null);
11699
11700
	Map compilerOptions14 = getCompilerOptions();
11701
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
11702
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11703
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11704
	compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
11705
	this.runNegativeTest(
11706
		new String[] {
11707
			"Concrete.java",
11708
			"public class Concrete extends Abstract {\n" +
11709
			"}",
11710
		},
11711
		"----------\n" + 
11712
		"1. ERROR in Concrete.java (at line 1)\n" + 
11713
		"	public class Concrete extends Abstract {\n" + 
11714
		"	             ^^^^^^^^\n" + 
11715
		"The type Concrete must implement the inherited abstract method Generic<String>.foo(Object)\n" + 
11716
		"----------\n",
11717
		null,
11718
		false,
11719
		compilerOptions14);	
11720
}
11721
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446
11722
public void test1415Mix2() {
11723
	Map compilerOptions15 = getCompilerOptions();
11724
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11725
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11726
	compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
11727
	this.runConformTest(
11728
		new String[] {
11729
			"Abstract.java",
11730
			"abstract class Generic<T> {\n" +
11731
			"	abstract void foo(T t);\n" +
11732
			"}\n" +
11733
			"public abstract class Abstract extends Generic<String> {\n" +
11734
			"}"
11735
			},
11736
		"",
11737
		null,
11738
		true,
11739
		null,
11740
		compilerOptions15,
11741
		null);
11742
11743
	Map compilerOptions14 = getCompilerOptions();
11744
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
11745
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11746
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11747
	compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
11748
	this.runConformTest(
11749
		new String[] {
11750
				"Concrete.java",
11751
				"public class Concrete extends Abstract {\n" +
11752
				"    void foo(Object s) {}\n" +
11753
				"}",
11754
		},
11755
		"",
11756
		null,
11757
		false,
11758
		null,
11759
		compilerOptions14,
11760
		null);
11761
}
11693
}
11762
}

Return to bug 331446