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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java (-39 / +66 lines)
Lines 18-24 Link Here
18
	// All specified tests which do not belong to the class are skipped...
18
	// All specified tests which do not belong to the class are skipped...
19
	static {
19
	static {
20
//		TESTS_NAMES = new String[] { "test036" };
20
//		TESTS_NAMES = new String[] { "test036" };
21
//		TESTS_NUMBERS = new int[] { 46 };
21
//		TESTS_NUMBERS = new int[] { 75 };
22
//		TESTS_RANGE = new int[] { 169, 180 };
22
//		TESTS_RANGE = new int[] { 169, 180 };
23
	}
23
	}
24
24
Lines 489-531 Link Here
489
				"}\n",
489
				"}\n",
490
			},
490
			},
491
			"----------\n" +
491
			"----------\n" +
492
			"1. ERROR in X.java (at line 6)\r\n" +
492
			"1. ERROR in X.java (at line 6)\n" +
493
			"	import static p.Y.Zz;\r\n" +
493
			"	import static p.Y.Zz;\n" +
494
			"	              ^^^^^^\n" +
494
			"	              ^^^^^^\n" +
495
			"The import p.Y.Zz cannot be resolved\n" +
495
			"The import p.Y.Zz cannot be resolved\n" +
496
			"----------\n" +
496
			"----------\n" +
497
			"2. ERROR in X.java (at line 7)\r\n" +
497
			"2. ERROR in X.java (at line 7)\n" +
498
			"	import static p.Z.Zz.WW.*;\r\n" +
498
			"	import static p.Z.Zz.WW.*;\n" +
499
			"	              ^^^^^^^^^\n" +
499
			"	              ^^^^^^^^^\n" +
500
			"The import p.Z.Zz.WW cannot be resolved\n" +
500
			"The import p.Z.Zz.WW cannot be resolved\n" +
501
			"----------\n" +
501
			"----------\n" +
502
			"3. ERROR in X.java (at line 8)\r\n" +
502
			"3. ERROR in X.java (at line 8)\n" +
503
			"	import p.Y.ZZ;\r\n" +
503
			"	import p.Y.ZZ;\n" +
504
			"	       ^^^^^^\n" +
504
			"	       ^^^^^^\n" +
505
			"The import p.Y.ZZ cannot be resolved\n" +
505
			"The import p.Y.ZZ cannot be resolved\n" +
506
			"----------\n" +
506
			"----------\n" +
507
			"4. ERROR in X.java (at line 9)\r\n" +
507
			"4. ERROR in X.java (at line 9)\n" +
508
			"	import static p.Y.ZZ.*;\r\n" +
508
			"	import static p.Y.ZZ.*;\n" +
509
			"	              ^^^^^^\n" +
509
			"	              ^^^^^^\n" +
510
			"The import p.Y.ZZ cannot be resolved\n" +
510
			"The import p.Y.ZZ cannot be resolved\n" +
511
			"----------\n" +
511
			"----------\n" +
512
			"5. ERROR in X.java (at line 10)\r\n" +
512
			"5. ERROR in X.java (at line 10)\n" +
513
			"	import static p.Y.ZZ.WW;\r\n" +
513
			"	import static p.Y.ZZ.WW;\n" +
514
			"	              ^^^^^^\n" +
514
			"	              ^^^^^^\n" +
515
			"The import p.Y.ZZ cannot be resolved\n" +
515
			"The import p.Y.ZZ cannot be resolved\n" +
516
			"----------\n" +
516
			"----------\n" +
517
			"6. ERROR in X.java (at line 11)\r\n" +
517
			"6. ERROR in X.java (at line 11)\n" +
518
			"	import static p.Y.ZZ.WW.*;\r\n" +
518
			"	import static p.Y.ZZ.WW.*;\n" +
519
			"	              ^^^^^^\n" +
519
			"	              ^^^^^^\n" +
520
			"The import p.Y.ZZ cannot be resolved\n" +
520
			"The import p.Y.ZZ cannot be resolved\n" +
521
			"----------\n" +
521
			"----------\n" +
522
			"7. ERROR in X.java (at line 12)\r\n" +
522
			"7. ERROR in X.java (at line 12)\n" +
523
			"	import static p.Y.ZZ.ZZZ;\r\n" +
523
			"	import static p.Y.ZZ.ZZZ;\n" +
524
			"	              ^^^^^^\n" +
524
			"	              ^^^^^^\n" +
525
			"The import p.Y.ZZ cannot be resolved\n" +
525
			"The import p.Y.ZZ cannot be resolved\n" +
526
			"----------\n" +
526
			"----------\n" +
527
			"8. ERROR in X.java (at line 13)\r\n" +
527
			"8. ERROR in X.java (at line 13)\n" +
528
			"	import static p.Y.ZZ.WW.WWW;\r\n" +
528
			"	import static p.Y.ZZ.WW.WWW;\n" +
529
			"	              ^^^^^^\n" +
529
			"	              ^^^^^^\n" +
530
			"The import p.Y.ZZ cannot be resolved\n" +
530
			"The import p.Y.ZZ cannot be resolved\n" +
531
			"----------\n"
531
			"----------\n"
Lines 590-597 Link Here
590
				"public class X {}\n"
590
				"public class X {}\n"
591
			},
591
			},
592
			"----------\n" +
592
			"----------\n" +
593
			"1. ERROR in X.java (at line 1)\r\n" +
593
			"1. ERROR in X.java (at line 1)\n" +
594
			"	import static java.lang.*;\r\n" +
594
			"	import static java.lang.*;\n" +
595
			"	              ^^^^^^^^^\n" +
595
			"	              ^^^^^^^^^\n" +
596
			"Only a type can be imported. java.lang resolves to a package\n" +
596
			"Only a type can be imported. java.lang resolves to a package\n" +
597
			"----------\n"
597
			"----------\n"
Lines 887-894 Link Here
887
				"public class C { public static void m() {} }\n"
887
				"public class C { public static void m() {} }\n"
888
			},
888
			},
889
			"----------\n" +
889
			"----------\n" +
890
			"1. ERROR in p\\B.java (at line 5)\r\n" +
890
			"1. ERROR in p\\B.java (at line 5)\n" +
891
			"	public class B { public static void main(String[] args) { m(); } }\r\n" +
891
			"	public class B { public static void main(String[] args) { m(); } }\n" +
892
			"	                                                          ^\n" +
892
			"	                                                          ^\n" +
893
			"The method m() is ambiguous for the type B\n" +
893
			"The method m() is ambiguous for the type B\n" +
894
			"----------\n"
894
			"----------\n"
Lines 1154-1161 Link Here
1154
				"}\n"
1154
				"}\n"
1155
			},
1155
			},
1156
			"----------\n" +
1156
			"----------\n" +
1157
			"1. ERROR in X2.java (at line 3)\r\n" +
1157
			"1. ERROR in X2.java (at line 3)\n" +
1158
			"	public class X2 { void test() {foo();} }\r\n" +
1158
			"	public class X2 { void test() {foo();} }\n" +
1159
			"	                               ^^^\n" +
1159
			"	                               ^^^\n" +
1160
			"The method foo() is ambiguous for the type X2\n" +
1160
			"The method foo() is ambiguous for the type X2\n" +
1161
			"----------\n"
1161
			"----------\n"
Lines 1313-1320 Link Here
1313
				"}\n"
1313
				"}\n"
1314
			},
1314
			},
1315
			"----------\n" +
1315
			"----------\n" +
1316
			"1. ERROR in C.java (at line 6)\r\n" +
1316
			"1. ERROR in C.java (at line 6)\n" +
1317
			"	void test() { foo(1); }\r\n" +
1317
			"	void test() { foo(1); }\n" +
1318
			"	              ^^^\n" +
1318
			"	              ^^^\n" +
1319
			"The method foo(Object, String) in the type A.B is not applicable for the arguments (int)\n" +
1319
			"The method foo(Object, String) in the type A.B is not applicable for the arguments (int)\n" +
1320
			"----------\n");
1320
			"----------\n");
Lines 1464-1481 Link Here
1464
				"class B { public static int foo_B() { return 2;} }",
1464
				"class B { public static int foo_B() { return 2;} }",
1465
			},
1465
			},
1466
			"----------\n" +
1466
			"----------\n" +
1467
			"1. ERROR in X.java (at line 1)\r\n" +
1467
			"1. ERROR in X.java (at line 1)\n" +
1468
			"	import static p.A.foo_I;\r\n" +
1468
			"	import static p.A.foo_I;\n" +
1469
			"	              ^^^^^^^^^\n" +
1469
			"	              ^^^^^^^^^\n" +
1470
			"The import p.A.foo_I cannot be resolved\n" +
1470
			"The import p.A.foo_I cannot be resolved\n" +
1471
			"----------\n" +
1471
			"----------\n" +
1472
			"2. ERROR in X.java (at line 4)\r\n" +
1472
			"2. ERROR in X.java (at line 4)\n" +
1473
			"	static int i = p.A.foo_I();\r\n" +
1473
			"	static int i = p.A.foo_I();\n" +
1474
			"	               ^^^^^^^^^^^\n" +
1474
			"	               ^^^^^^^^^^^\n" +
1475
			"Cannot make a static reference to the non-static method foo_I() from the type I\n" +
1475
			"Cannot make a static reference to the non-static method foo_I() from the type I\n" +
1476
			"----------\n" +
1476
			"----------\n" +
1477
			"3. ERROR in X.java (at line 6)\r\n" +
1477
			"3. ERROR in X.java (at line 6)\n" +
1478
			"	static int m = foo_I();\r\n" +
1478
			"	static int m = foo_I();\n" +
1479
			"	               ^^^^^\n" +
1479
			"	               ^^^^^\n" +
1480
			"The method foo_I() is undefined for the type X\n" +
1480
			"The method foo_I() is undefined for the type X\n" +
1481
			"----------\n");
1481
			"----------\n");
Lines 1567-1574 Link Here
1567
				"}\n",
1567
				"}\n",
1568
			},
1568
			},
1569
			"----------\n" +
1569
			"----------\n" +
1570
			"1. ERROR in ImportTest.java (at line 4)\r\n" +
1570
			"1. ERROR in ImportTest.java (at line 4)\n" +
1571
			"	static void printArgs(Object... args) { toString2(args); }\r\n" +
1571
			"	static void printArgs(Object... args) { toString2(args); }\n" +
1572
			"	                                        ^^^^^^^^^\n" +
1572
			"	                                        ^^^^^^^^^\n" +
1573
			"The method toString2() in the type SuperTest is not applicable for the arguments (Object[])\n" +
1573
			"The method toString2() in the type SuperTest is not applicable for the arguments (Object[])\n" +
1574
			"----------\n"
1574
			"----------\n"
Lines 1715-1722 Link Here
1715
				"public class Three extends Two { public static void test(String s) { arrayList(s); } }\n",
1715
				"public class Three extends Two { public static void test(String s) { arrayList(s); } }\n",
1716
			},
1716
			},
1717
			"----------\n" +
1717
			"----------\n" +
1718
			"1. ERROR in test\\Three.java (at line 3)\r\n" +
1718
			"1. ERROR in test\\Three.java (at line 3)\n" +
1719
			"	public class Three extends Two { public static void test(String s) { arrayList(s); } }\r\n" +
1719
			"	public class Three extends Two { public static void test(String s) { arrayList(s); } }\n" +
1720
			"	                                                                     ^^^^^^^^^\n" +
1720
			"	                                                                     ^^^^^^^^^\n" +
1721
			"The method arrayList(int) in the type Two is not applicable for the arguments (String)\n" +
1721
			"The method arrayList(int) in the type Two is not applicable for the arguments (String)\n" +
1722
			"----------\n"
1722
			"----------\n"
Lines 2221-2228 Link Here
2221
				"}\n",
2221
				"}\n",
2222
			},
2222
			},
2223
			"----------\n" +
2223
			"----------\n" +
2224
			"1. ERROR in p\\X.java (at line 2)\r\n" +
2224
			"1. ERROR in p\\X.java (at line 2)\n" +
2225
			"	import static q.A.a;\r\n" +
2225
			"	import static q.A.a;\n" +
2226
			"	              ^^^^^\n" +
2226
			"	              ^^^^^\n" +
2227
			"The import q.A.a cannot be resolved\n" +
2227
			"The import q.A.a cannot be resolved\n" +
2228
			"----------\n");
2228
			"----------\n");
Lines 2358-2365 Link Here
2358
				"}",
2358
				"}",
2359
			},
2359
			},
2360
			"----------\n" +
2360
			"----------\n" +
2361
			"1. ERROR in X.java (at line 1)\r\n" +
2361
			"1. ERROR in X.java (at line 1)\n" +
2362
			"	import static p.I.E.C;\r\n" +
2362
			"	import static p.I.E.C;\n" +
2363
			"	              ^^^^^^^\n" +
2363
			"	              ^^^^^^^\n" +
2364
			"The import p.I.E.C cannot be resolved\n" +
2364
			"The import p.I.E.C cannot be resolved\n" +
2365
			"----------\n");
2365
			"----------\n");
Lines 2533-2537 Link Here
2533
			},
2533
			},
2534
			"");
2534
			"");
2535
	}		
2535
	}		
2536
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
2537
	public void test075() {
2538
		this.runConformTest(
2539
			new String[] {
2540
				"p/A.java",
2541
				"package p;\n" + 
2542
				"import p2.B.C1;\n" + 
2543
				"import static p2.B.C1;\n" + 
2544
				"public abstract class A {\n" + 
2545
				"	protected void A1(Object task) {\n" + 
2546
				"		C1 c = C1(task);\n" + 
2547
				"	}\n" + 
2548
				"}\n" + 
2549
				"",
2550
				"p2/B.java",
2551
				"package p2;\n" + 
2552
				"final public class B {\n" + 
2553
				"	private B() {}\n" + 
2554
				"	public static class C1  {\n" + 
2555
				"	}\n" + 
2556
				"	public static C1 C1(Object v0) {\n" + 
2557
				"		return new C1();\n" + 
2558
				"	}\n" + 
2559
				"}"
2560
			},
2561
			"");
2562
	}
2536
}
2563
}
2537
2564

Return to bug 302865