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

Collapse All | Expand All

(-)CastTest.java (-6 / +21 lines)
Lines 346-352 Link Here
346
			"	public static void main(String[] args) {\n" + 
346
			"	public static void main(String[] args) {\n" + 
347
			"		boolean b1 = new XM1() instanceof X; // UNnecessary\n" + 
347
			"		boolean b1 = new XM1() instanceof X; // UNnecessary\n" + 
348
			"		boolean b2 = new X() instanceof XM1; // necessary\n" + 
348
			"		boolean b2 = new X() instanceof XM1; // necessary\n" + 
349
			"		boolean b3 = null instanceof X; // UNnecessary\n" + 
349
			"		boolean b3 = null instanceof X;\n" + 
350
			"	}\n" + 
350
			"	}\n" + 
351
			"	static class XM1 extends X {}\n" + 
351
			"	static class XM1 extends X {}\n" + 
352
			"}\n"
352
			"}\n"
Lines 356-366 Link Here
356
		"	boolean b1 = new XM1() instanceof X; // UNnecessary\n" + 
356
		"	boolean b1 = new XM1() instanceof X; // UNnecessary\n" + 
357
		"	             ^^^^^^^^^^^^^^^^^^^^^^\n" + 
357
		"	             ^^^^^^^^^^^^^^^^^^^^^^\n" + 
358
		"The expression of type X.XM1 is already an instance of type X\n" + 
358
		"The expression of type X.XM1 is already an instance of type X\n" + 
359
		"----------\n" + 
360
		"2. ERROR in X.java (at line 5)\n" + 
361
		"	boolean b3 = null instanceof X; // UNnecessary\n" + 
362
		"	             ^^^^^^^^^^^^^^^^^\n" + 
363
		"The expression of type null is already an instance of type X\n" + 
364
		"----------\n",
359
		"----------\n",
365
		null,
360
		null,
366
		true,
361
		true,
Lines 1428-1433 Link Here
1428
		"Cannot cast from Integer[] to int[]\n" + 
1423
		"Cannot cast from Integer[] to int[]\n" + 
1429
		"----------\n");
1424
		"----------\n");
1430
}
1425
}
1426
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101208
1427
public void test038() {
1428
	this.runNegativeTest(
1429
		new String[] {
1430
			"X.java",
1431
			"public class X {\n" + 
1432
			"	void foo() {\n" + 
1433
			"		System.out.println(null instanceof Object);\n" + 
1434
			"      Zork z;\n" +
1435
			"	}\n" + 
1436
			"}\n"
1437
		},
1438
		"----------\n" + 
1439
		"1. ERROR in X.java (at line 4)\r\n" + 
1440
		"	Zork z;\r\n" + 
1441
		"	^^^^\n" + 
1442
		"Zork cannot be resolved to a type\n" + 
1443
		"----------\n");
1444
}
1445
1431
public static Class testClass() {
1446
public static Class testClass() {
1432
	return CastTest.class;
1447
	return CastTest.class;
1433
}
1448
}

Return to bug 101208