### 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 12:44:57 -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 12:45:00 -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); @@ -11490,6 +11490,76 @@ compilerOptions14, null); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 +public void test331446b() { + Map compilerOptions15 = getCompilerOptions(); + 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[] { + "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, + 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[] { + "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, + false, + null, + compilerOptions14, + null); +} public void test1415Mix() { Map compilerOptions15 = getCompilerOptions(); compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); @@ -11526,7 +11596,7 @@ "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" + + "The type Concrete must implement the inherited abstract method Generic.foo(Object)\n" + "----------\n", null, false, @@ -11562,7 +11632,7 @@ new String[] { "Concrete.java", "public class Concrete extends Abstract {\n" + - " void foo(String s) {}\n" + + " void foo(Object s) {}\n" + "}", }, "",