### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v retrieving revision 1.131 diff -u -r1.131 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 19 Nov 2010 14:22:00 -0000 1.131 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 1 Dec 2010 14:29:12 -0000 @@ -1063,9 +1063,15 @@ method.tagBits |= TagBits.HasMissingType; } } + long sourceLevel = this.environment.globalOptions.originalSourceLevel; for (int i = method.parameters.length; --i >= 0;) { TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, true /* raw conversion */); - method.parameters[i] = resolvedType; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 + if (sourceLevel < ClassFileConstants.JDK1_5) { + method.parameters[i] = resolvedType.erasure(); + } else { + method.parameters[i] = resolvedType; + } if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) { method.tagBits |= TagBits.HasMissingType; } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v retrieving revision 1.219 diff -u -r1.219 MethodVerifyTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 1 Dec 2010 09:32:23 -0000 1.219 +++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 1 Dec 2010 14:29:13 -0000 @@ -11417,8 +11417,8 @@ false, compilerOptions14); } -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 -public void _test331446() { +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 +public void test331446() { Map compilerOptions15 = getCompilerOptions(); compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); @@ -11457,9 +11457,6 @@ null); Map compilerOptions14 = getCompilerOptions(); -// compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); -// compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); -// compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); @@ -11490,20 +11487,38 @@ compilerOptions14, null); } -public void test1415Mix() { +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 +public void test331446a() { Map compilerOptions15 = getCompilerOptions(); - compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); - compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); - compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); + compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4); + compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); + compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4); this.runConformTest( new String[] { - "Abstract.java", - "abstract class Generic {\n" + - " abstract void foo(T t);\n" + - "}\n" + - "public abstract class Abstract extends Generic {\n" + - "}" - }, + "Test.java", + "import java.util.Comparator;\n" + + "import java.util.List;\n" + + "\n" + + "public class Test {\n" + + " public static void assertEquals(String message,\n" + + " Comparator comparator, List expected, List actual) {\n" + + " if (expected.size() != actual.size()) {\n" + + " //failNotEquals(message, expected, actual);\n" + + " }\n" + + " for (int i = 0, l = expected.size(); i < l; i++) {\n" + + " assertEquals(message, comparator, expected.get(i), actual.get(i));\n" + + " }\n" + + " }\n" + + " public static void assertEquals(String message,\n" + + " Comparator comparator, Object expected, Object actual) {\n" + + " if (comparator.compare(expected, actual) == 0) {\n" + + " return;\n" + + " }\n" + + " //failNotEquals(message, expected, actual);\n" + + " }\n" + + "}\n" + + "" + }, "", null, true, @@ -11516,64 +11531,34 @@ compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); - this.runNegativeTest( - new String[] { - "Concrete.java", - "public class Concrete extends Abstract {\n" + - "}", - }, - "----------\n" + - "1. ERROR in Concrete.java (at line 1)\n" + - " public class Concrete extends Abstract {\n" + - " ^^^^^^^^\n" + - "The type Concrete must implement the inherited abstract method Generic.foo(String)\n" + - "----------\n", - null, - false, - compilerOptions14); -} -public void test1415Mix2() { - Map compilerOptions15 = getCompilerOptions(); - compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); - compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); - compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); this.runConformTest( new String[] { - "Abstract.java", - "abstract class Generic {\n" + - " abstract void foo(T t);\n" + - "}\n" + - "public abstract class Abstract extends Generic {\n" + - "}" - }, + "X.java", + "import java.util.ArrayList;\n" + + "import java.util.Comparator;\n" + + "\n" + + "public class X {\n" + + " public static void testAmbiguity() {\n" + + " Comparator comparator = new Comparator() {\n" + + " \n" + + " public int compare(Object o1, Object o2) {\n" + + " return 0;\n" + + " }\n" + + " };\n" + + " Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + + " }\n" + + "}\n" + + "", + }, "", null, - true, + false, null, - compilerOptions15, + compilerOptions14, null); - - Map compilerOptions14 = getCompilerOptions(); - compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); - compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); - compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); - this.runConformTest( - new String[] { - "Concrete.java", - "public class Concrete extends Abstract {\n" + - " void foo(String s) {}\n" + - "}", - }, - "", - null, - false, - null, - compilerOptions14, - null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.4) -public void test331446a() { +public void test331446b() { Map compilerOptions14 = getCompilerOptions(); compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4); compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); @@ -11611,7 +11596,7 @@ null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (1.4/1.5 mix) -public void _test331446b() { +public void test331446c() { Map compilerOptions15 = getCompilerOptions(); compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); @@ -11654,7 +11639,7 @@ null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.5) -public void test331446c() { +public void test331446d() { Map compilerOptions15 = getCompilerOptions(); compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); @@ -11690,4 +11675,88 @@ compilerOptions15, null); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 +public void test1415Mix() { + Map compilerOptions15 = getCompilerOptions(); + compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); + compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); + compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); + this.runConformTest( + new String[] { + "Abstract.java", + "abstract class Generic {\n" + + " abstract void foo(T t);\n" + + "}\n" + + "public abstract class Abstract extends Generic {\n" + + "}" + }, + "", + null, + true, + null, + compilerOptions15, + null); + + Map compilerOptions14 = getCompilerOptions(); + compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); + compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); + compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); + compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); + this.runNegativeTest( + new String[] { + "Concrete.java", + "public class Concrete extends Abstract {\n" + + "}", + }, + "----------\n" + + "1. ERROR in Concrete.java (at line 1)\n" + + " public class Concrete extends Abstract {\n" + + " ^^^^^^^^\n" + + "The type Concrete must implement the inherited abstract method Generic.foo(Object)\n" + + "----------\n", + null, + false, + compilerOptions14); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 +public void test1415Mix2() { + Map compilerOptions15 = getCompilerOptions(); + compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); + compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); + compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); + this.runConformTest( + new String[] { + "Abstract.java", + "abstract class Generic {\n" + + " abstract void foo(T t);\n" + + "}\n" + + "public abstract class Abstract extends Generic {\n" + + "}" + }, + "", + null, + true, + null, + compilerOptions15, + null); + + Map compilerOptions14 = getCompilerOptions(); + compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); + compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); + compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); + compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); + this.runConformTest( + new String[] { + "Concrete.java", + "public class Concrete extends Abstract {\n" + + " void foo(Object s) {}\n" + + "}", + }, + "", + null, + false, + null, + compilerOptions14, + null); +} }