### Eclipse Workspace Patch 1.0 #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.212 diff -u -r1.212 MethodVerifyTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 7 Nov 2010 02:30:20 -0000 1.212 +++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 17 Nov 2010 20:18:12 -0000 @@ -27,7 +27,7 @@ public class MethodVerifyTest extends AbstractComparableTest { static { -// TESTS_NAMES = new String[] { "test329584_2", "test329584_3" }; +// TESTS_NAMES = new String[] { "test330435" }; // TESTS_NUMBERS = new int[] { 213 }; // TESTS_RANGE = new int[] { 190, -1}; } @@ -11272,4 +11272,55 @@ compilerOptions14, null); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=330435 +public void _test330435() { + 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[] { + "A.java", + "public class A {\n" + + " public static B asList(T... tab) {\n" + + " return null;\n" + + " }\n" + + "}", + "B.java", + "public interface B {\n" + + " T[] toArray(T[] tab);\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.runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " String[] foo(Object[] args) {\n" + + " String[] a = A.asList(args).toArray(new String[0]);\n" + + " return a;\n" + + " }\n" + + "}", + }, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " String[] a = A.asList(args).toArray(new String[0]);\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Type mismatch: cannot convert from Object[] to String[]\n" + + "----------\n", + null, + false, + compilerOptions14); +} }