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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-1 / +52 lines)
Lines 27-33 Link Here
27
27
28
public class MethodVerifyTest extends AbstractComparableTest {
28
public class MethodVerifyTest extends AbstractComparableTest {
29
	static {
29
	static {
30
//		TESTS_NAMES = new String[] { "test329584_2", "test329584_3" };
30
//		TESTS_NAMES = new String[] { "test330435" };
31
//		TESTS_NUMBERS = new int[] { 213 };
31
//		TESTS_NUMBERS = new int[] { 213 };
32
//		TESTS_RANGE = new int[] { 190, -1};
32
//		TESTS_RANGE = new int[] { 190, -1};
33
	}
33
	}
Lines 11272-11275 Link Here
11272
		compilerOptions14,
11272
		compilerOptions14,
11273
		null);
11273
		null);
11274
}
11274
}
11275
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=330435 
11276
public void _test330435() {
11277
	Map compilerOptions15 = getCompilerOptions();
11278
	compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5);
11279
	compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
11280
	compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
11281
	this.runConformTest(
11282
		new String[] {
11283
			"A.java",
11284
			"public class A {\n" +
11285
			"	public static <T> B<T> asList(T... tab) {\n" + 
11286
			"		return null;\n" + 
11287
			"	}\n" +
11288
			"}",
11289
			"B.java",
11290
			"public interface B<V> {\n" +
11291
			"	<T> T[] toArray(T[] tab);\n" + 
11292
			"}\n",
11293
		},
11294
		"",
11295
		null,
11296
		true,
11297
		null,
11298
		compilerOptions15,
11299
		null);
11300
	//    
11301
	Map compilerOptions14 = getCompilerOptions();
11302
	compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
11303
	compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
11304
	compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
11305
	compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
11306
	this.runNegativeTest(
11307
		new String[] {
11308
			"X.java",
11309
			"public class X {\n" + 
11310
			"	String[] foo(Object[] args) {\n" + 
11311
			"		String[] a = A.asList(args).toArray(new String[0]);\n" + 
11312
			"		return a;\n" + 
11313
			"	}\n" + 
11314
			"}",
11315
		},
11316
		"----------\n" + 
11317
		"1. ERROR in X.java (at line 3)\n" + 
11318
		"	String[] a = A.asList(args).toArray(new String[0]);\n" + 
11319
		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11320
		"Type mismatch: cannot convert from Object[] to String[]\n" + 
11321
		"----------\n",
11322
		null,
11323
		false,
11324
		compilerOptions14);
11325
}
11275
}
11326
}

Return to bug 330435