1 /*******************************************************************************
2  * Copyright (c) 2000, 2019 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *     Stephan Herrmann - Contributions for
14  *								bug 185682 - Increment/decrement operators mark local variables as read
15  *								bug 401271 - StackOverflowError when searching for a methods references
16  *******************************************************************************/
17 package org.eclipse.jdt.core.tests.compiler.regression;
18 
19 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
20 
21 import junit.framework.Test;
22 
23 @SuppressWarnings({ "rawtypes" })
24 public class StaticImportTest extends AbstractComparableTest {
25 
26 	// Static initializer to specify tests subset using TESTS_* static variables
27 	// All specified tests which do not belong to the class are skipped...
28 	static {
29 //		TESTS_NAMES = new String[] { "test075" };
30 //		TESTS_NAMES = new String[] { "test085c" };
31 //		TESTS_NUMBERS = new int[] { 80 };
32 //		TESTS_RANGE = new int[] { 75, -1 };
33 	}
34 
StaticImportTest(String name)35 	public StaticImportTest(String name) {
36 		super(name);
37 	}
38 
suite()39 	public static Test suite() {
40 		return buildComparableTestSuite(testClass());
41 	}
42 
testClass()43 	public static Class testClass() {
44 		return StaticImportTest.class;
45 	}
46 
47 
test001()48 	public void test001() {
49 		this.runConformTest(
50 			new String[] {
51 				"X.java",
52 				"import static java.lang.Math.*;\n" +
53 				"import static java.lang.Math.PI;\n" +
54 				"public class X { double pi = abs(PI); }\n",
55 			},
56 			"");
57 	}
58 
test002()59 	public void test002() {
60 		this.runConformTest(
61 			new String[] {
62 				"p/X.java",
63 				"package p;\n" +
64 				"import static p2.Y.*;\n" +
65 				"import static p2.Z.Zint;\n" +
66 				"import static p2.Z.ZMember;\n" +
67 				"public class X {\n" +
68 				"	int x = y(1);\n" +
69 				"	int y = Yint;\n" +
70 				"	int z = Zint;\n" +
71 				"	void m1(YMember m) {}\n" +
72 				"	void m2(ZMember m) {}\n" +
73 				"}\n",
74 				"p2/Y.java",
75 				"package p2;\n" +
76 				"public class Y {\n" +
77 				"	public static int Yint = 1;\n" +
78 				"	public static int y(int y) { return y; }\n" +
79 				"	public static class YMember {}\n" +
80 				"}\n",
81 				"p2/Z.java",
82 				"package p2;\n" +
83 				"public class Z {\n" +
84 				"	public static int Zint = 1;\n" +
85 				"	public static class ZMember {}\n" +
86 				"}\n",
87 			},
88 			"");
89 	}
90 
test003()91 	public void test003() { // test inheritance
92 		this.runConformTest(
93 			new String[] {
94 				"p/X.java",
95 				"package p;\n" +
96 				"import static p2.Y.*;\n" +
97 				"import static p2.Z.Zint;\n" +
98 				"import static p2.Z.ZMember;\n" +
99 				"public class X {\n" +
100 				"	int x = y(1);\n" +
101 				"	int y = Yint;\n" +
102 				"	int z = Zint;\n" +
103 				"	void m1(YMember m) {}\n" +
104 				"	void m2(ZMember m) {}\n" +
105 				"}\n",
106 				"p2/YY.java",
107 				"package p2;\n" +
108 				"public class YY {\n" +
109 				"	public static int Yint = 1;\n" +
110 				"	public static int y(int y) { return y; }\n" +
111 				"	public static class YMember {}\n" +
112 				"}\n",
113 				"p2/Y.java",
114 				"package p2;\n" +
115 				"public class Y extends YY {}\n",
116 				"p2/ZZ.java",
117 				"package p2;\n" +
118 				"public class ZZ {\n" +
119 				"	public static int Zint = 1;\n" +
120 				"	public static class ZMember {}\n" +
121 				"}\n",
122 				"p2/Z.java",
123 				"package p2;\n" +
124 				"public class Z extends ZZ {}\n",
125 			},
126 			"");
127 		this.runConformTest(
128 			new String[] {
129 				"X.java",
130 				"import static p.A.C;\n" +
131 				"public class X { int i = C; }\n",
132 				"p/A.java",
133 				"package p;\n" +
134 				"public class A extends B implements I {}\n" +
135 				"class B implements I {}\n",
136 				"p/I.java",
137 				"package p;\n" +
138 				"public interface I { public static int C = 1; }\n"
139 			},
140 			""
141 		);
142 		this.runConformTest(
143 			new String[] {
144 				"X.java",
145 				"import static p.A.C;\n" +
146 				"public class X { \n" +
147 				"	int i = C; \n" +
148 				"	int j = p.A.C; \n" +
149 				"}\n",
150 				"p/A.java",
151 				"package p;\n" +
152 				"public class A implements I {}\n" +
153 				"interface I { public static int C = 1; }\n"
154 			},
155 			JavacTestOptions.JavacHasABug.JavacBugFixed_6_10);
156 	}
157 
test004()158 	public void test004() { // test static vs. instance
159 		this.runNegativeTest(
160 			new String[] {
161 				"p/X.java",
162 				"package p;\n" +
163 				"import static p2.Y.*;\n" +
164 				"import static p2.Z.Zint;\n" +
165 				"import static p2.Z.ZMember;\n" +
166 				"public class X {\n" +
167 				"	int x = y(1);\n" +
168 				"	int y = Yint;\n" +
169 				"	int z = Zint;\n" +
170 				"	void m1(YMember m) {}\n" +
171 				"	void m2(ZMember m) {}\n" +
172 				"}\n",
173 				"p2/Y.java",
174 				"package p2;\n" +
175 				"public class Y {\n" +
176 				"	public int Yint = 1;\n" +
177 				"	public int y(int y) { return y; }\n" +
178 				"	public class YMember {}\n" +
179 				"}\n",
180 				"p2/Z.java",
181 				"package p2;\n" +
182 				"public class Z {\n" +
183 				"	public int Zint = 1;\n" +
184 				"	public class ZMember {}\n" +
185 				"}\n",
186 			},
187 			"----------\n" +
188 			"1. ERROR in p\\X.java (at line 3)\n" +
189 			"	import static p2.Z.Zint;\n" +
190 			"	              ^^^^^^^^^\n" +
191 			"The import p2.Z.Zint cannot be resolved\n" +
192 			"----------\n" +
193 			"2. ERROR in p\\X.java (at line 4)\n" +
194 			"	import static p2.Z.ZMember;\n" +
195 			"	              ^^^^^^^^^^^^\n" +
196 			"The import p2.Z.ZMember cannot be resolved\n" +
197 			"----------\n" +
198 			"3. ERROR in p\\X.java (at line 6)\n" +
199 			"	int x = y(1);\n" +
200 			"	        ^\n" +
201 			"The method y(int) is undefined for the type X\n" +
202 			"----------\n" +
203 			"4. ERROR in p\\X.java (at line 7)\n" +
204 			"	int y = Yint;\n" +
205 			"	        ^^^^\n" +
206 			"Yint cannot be resolved to a variable\n" +
207 			"----------\n" +
208 			"5. ERROR in p\\X.java (at line 8)\n" +
209 			"	int z = Zint;\n" +
210 			"	        ^^^^\n" +
211 			"Zint cannot be resolved to a variable\n" +
212 			"----------\n" +
213 			"6. ERROR in p\\X.java (at line 9)\n" +
214 			"	void m1(YMember m) {}\n" +
215 			"	        ^^^^^^^\n" +
216 			"YMember cannot be resolved to a type\n" +
217 			"----------\n" +
218 			"7. ERROR in p\\X.java (at line 10)\n" +
219 			"	void m2(ZMember m) {}\n" +
220 			"	        ^^^^^^^\n" +
221 			"ZMember cannot be resolved to a type\n" +
222 			"----------\n");
223 	}
224 
test005()225 	public void test005() { // test visibility
226 		this.runNegativeTest(
227 			new String[] {
228 				"p/X.java",
229 				"package p;\n" +
230 				"import static p2.Y.*;\n" +
231 				"import static p2.Z.Zint;\n" +
232 				"import static p2.Z.ZMember;\n" +
233 				"public class X {\n" +
234 				"	int x = y(1);\n" +
235 				"	int y = Yint;\n" +
236 				"	int z = Zint;\n" +
237 				"	void m1(YMember m) {}\n" +
238 				"	void m2(ZMember m) {}\n" +
239 				"}\n",
240 				"p2/Y.java",
241 				"package p2;\n" +
242 				"public class Y {\n" +
243 				"	static int Yint = 1;\n" +
244 				"	static int y(int y) { return y; }\n" +
245 				"	static class YMember {}\n" +
246 				"}\n",
247 				"p2/Z.java",
248 				"package p2;\n" +
249 				"public class Z {\n" +
250 				"	static int Zint = 1;\n" +
251 				"	static class ZMember {}\n" +
252 				"}\n",
253 			},
254 		"----------\n" +
255 		"1. ERROR in p\\X.java (at line 3)\n" +
256 		"	import static p2.Z.Zint;\n" +
257 		"	              ^^^^^^^^^\n" +
258 		"The field Z.p2.Z.Zint is not visible\n" +
259 		"----------\n" +
260 		"2. ERROR in p\\X.java (at line 4)\n" +
261 		"	import static p2.Z.ZMember;\n" +
262 		"	              ^^^^^^^^^^^^\n" +
263 		"The type p2.Z.ZMember is not visible\n" +
264 		"----------\n" +
265 		"3. ERROR in p\\X.java (at line 6)\n" +
266 		"	int x = y(1);\n" +
267 		"	        ^\n" +
268 		"The method y(int) from the type Y is not visible\n" +
269 		"----------\n" +
270 		"4. ERROR in p\\X.java (at line 7)\n" +
271 		"	int y = Yint;\n" +
272 		"	        ^^^^\n" +
273 		"The field Y.Yint is not visible\n" +
274 		"----------\n" +
275 		"5. ERROR in p\\X.java (at line 8)\n" +
276 		"	int z = Zint;\n" +
277 		"	        ^^^^\n" +
278 		"Zint cannot be resolved to a variable\n" +
279 		"----------\n" +
280 		"6. ERROR in p\\X.java (at line 9)\n" +
281 		"	void m1(YMember m) {}\n" +
282 		"	        ^^^^^^^\n" +
283 		"The type YMember is not visible\n" +
284 		"----------\n" +
285 		"7. ERROR in p\\X.java (at line 10)\n" +
286 		"	void m2(ZMember m) {}\n" +
287 		"	        ^^^^^^^\n" +
288 		"ZMember cannot be resolved to a type\n" +
289 		"----------\n");
290 	}
291 
test006()292 	public void test006() { // test non static member types
293 		this.runNegativeTest(
294 			new String[] {
295 				"p/X.java",
296 				"package p;\n" +
297 				"import static p2.Z.ZStatic;\n" +
298 				"import static p2.Z.ZNonStatic;\n" +
299 				"import p2.Z.ZNonStatic;\n" +
300 				"public class X {\n" +
301 				"	void m2(ZStatic m) {}\n" +
302 				"	void m3(ZNonStatic m) {}\n" +
303 				"}\n",
304 				"p2/Z.java",
305 				"package p2;\n" +
306 				"public class Z {\n" +
307 				"	public static class ZStatic {}\n" +
308 				"	public class ZNonStatic {}\n" +
309 				"}\n",
310 			},
311 			"----------\n" +
312 			"1. ERROR in p\\X.java (at line 3)\n" +
313 			"	import static p2.Z.ZNonStatic;\n" +
314 			"	              ^^^^^^^^^^^^^^^\n" +
315 			"The import p2.Z.ZNonStatic cannot be resolved\n" +
316 			"----------\n");
317 	}
318 
test007()319 	public void test007() { // test non static member types vs. static field
320 		this.runConformTest(
321 			new String[] {
322 				"p/X.java",
323 				"package p;\n" +
324 				"import static p2.Z.ZFieldOverMember;\n" +
325 				"public class X {\n" +
326 				"	int z = ZFieldOverMember;\n" +
327 				"}\n",
328 				"p2/Z.java",
329 				"package p2;\n" +
330 				"public class Z {\n" +
331 				"	public static int ZFieldOverMember = 1;\n" +
332 				"	public class ZFieldOverMember {}\n" +
333 				"}\n",
334 			},
335 			"");
336 	}
337 
test008()338 	public void test008() { // test static top level types
339 		this.runNegativeTest(
340 			new String[] {
341 				"p/X.java",
342 				"package p;\n" +
343 				"import static java.lang.System;\n" +
344 				"public class X {}\n",
345 			},
346 			"----------\n" +
347 			"1. ERROR in p\\X.java (at line 2)\n" +
348 			"	import static java.lang.System;\n" +
349 			"	              ^^^^^^^^^^^^^^^^\n" +
350 			"The static import java.lang.System must be a field or member type\n" +
351 			"----------\n");
352 	}
353 
test009()354 	public void test009() { // test static top level types
355 		this.runNegativeTest(
356 			new String[] {
357 				"p/X.java",
358 				"package p;\n" +
359 				"import static java.lang.reflect.Method.*;\n" +
360 				"public class X {Method m;}\n",
361 			},
362 			"----------\n" +
363 			"1. ERROR in p\\X.java (at line 3)\n" +
364 			"	public class X {Method m;}\n" +
365 			"	                ^^^^^^\n" +
366 			"Method cannot be resolved to a type\n" +
367 			"----------\n");
368 	}
369 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76174
test010()370 	public void test010() {
371 		this.runNegativeTest(
372 			new String[] {
373 				"X.java",
374 				"import static java.lang.System.*;\n" +
375 				"public class X {\n" +
376 				"	void foo() { arraycopy(); }\n" +
377 				"}\n"
378 			},
379 			"----------\n" +
380 			"1. ERROR in X.java (at line 3)\n" +
381 			"	void foo() { arraycopy(); }\n" +
382 			"	             ^^^^^^^^^\n" +
383 			"The method arraycopy(Object, int, Object, int, int) in the type System is not applicable for the arguments ()\n" +
384 			"----------\n");
385 	}
386 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76360
test011()387 	public void test011() {
388 		this.runNegativeTest(
389 			new String[] {
390 				"X.java",
391 				"import static p.Y.*;\n" +
392 				"public class X extends p.Z {}\n" +
393 				"class XX extends M.N {}\n" +
394 				"class XXX extends M.Missing {}\n",
395 				"p/YY.java",
396 				"package p;\n" +
397 				"public class YY {\n" +
398 				"	public static class M {\n" +
399 				"		public static class N {}\n" +
400 				"	}\n" +
401 				"}\n",
402 				"p/Y.java",
403 				"package p;\n" +
404 				"public class Y extends YY {}\n",
405 				"p/Z.java",
406 				"package p;\n" +
407 				"public class Z {}\n"
408 			},
409 			"----------\n" +
410 			"1. ERROR in X.java (at line 4)\n" +
411 			"	class XXX extends M.Missing {}\n" +
412 			"	                  ^^^^^^^^^\n" +
413 			"M.Missing cannot be resolved to a type\n" +
414 			"----------\n");
415 	}
416 
test012()417 	public void test012() {
418 		this.runConformTest(
419 			new String[] {
420 				"X.java",
421 				"import static java.lang.Math.*;\n" +
422 				"public class X {\n" +
423 				"	public static void main(String[] s) {\n" +
424 				"		System.out.println(max(1, 2));\n" +
425 				"	}\n" +
426 				"}\n",
427 			},
428 			"2");
429 		this.runConformTest(
430 			new String[] {
431 				"X.java",
432 				"import static java.lang.Math.max;\n" +
433 				"public class X {\n" +
434 				"	public static void main(String[] s) {\n" +
435 				"		System.out.println(max(1, 3));\n" +
436 				"	}\n" +
437 				"}\n",
438 			},
439 			"3");
440 		this.runConformTest(
441 			new String[] {
442 				"X.java",
443 				"import static p1.C.F;\n" +
444 				"import p2.*;\n" +
445 				"public class X implements F {" +
446 				"	int i = F();" +
447 				"}\n",
448 				"p1/C.java",
449 				"package p1;\n" +
450 				"public class C {\n" +
451 				"	public static int F() { return 0; }\n" +
452 				"}\n",
453 				"p2/F.java",
454 				"package p2;\n" +
455 				"public interface F {}\n"
456 			},
457 			""
458 		);
459 	}
460 
461 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77955
test013()462 	public void test013() {
463 		this.runNegativeTest(
464 			new String[] {
465 				"X.java",
466 				"import static p.Y.ZZ;\n" + // found if ZZ is static
467 				"import static p.Z.ZZ.WW;\n" + // found if WW is static
468 				"import static p.Z.Zz.WW;\n" + // found if WW is static
469 				"import static p.Z.Zz.*;\n" + // legal
470 				"import static p.Z.Zz.Zzz;\n" + // legal
471 
472 				"import static p.Y.Zz;\n" + // Zz is not static
473 				"import static p.Z.Zz.WW.*;\n" + // import requires canonical name for p.W.WW
474 
475 				"import p.Y.ZZ;\n" + // import requires canonical name for p.Z.ZZ
476 				"import static p.Y.ZZ.*;\n" + // import requires canonical name for p.Z.ZZ
477 				"import static p.Y.ZZ.WW;\n" + // import requires canonical name for p.Z.ZZ
478 				"import static p.Y.ZZ.WW.*;\n" + // import requires canonical name for p.W.WW
479 				"import static p.Y.ZZ.ZZZ;\n" + // import requires canonical name for p.Z.ZZ
480 				"import static p.Y.ZZ.WW.WWW;\n" + // import requires canonical name for p.W.WW
481 				"public class X {\n" +
482 				"	int i = Zzz + Zzzz;\n" +
483 				"	ZZ z;\n" +
484 				"	WW w;\n" +
485 				"}\n",
486 				"p/Y.java",
487 				"package p;\n" +
488 				"public class Y extends Z {}\n",
489 				"p/Z.java",
490 				"package p;\n" +
491 				"public class Z {\n" +
492 				"	public class Zz extends W { public static final int Zzz = 0; public static final int Zzzz = 1; }\n" +
493 				"	public static class ZZ extends W { public static final int ZZZ = 0; }\n" +
494 				"}\n",
495 				"p/W.java",
496 				"package p;\n" +
497 				"public class W {\n" +
498 				"	public static class WW { public static final int WWW = 0; }\n" +
499 				"}\n",
500 			},
501 			"----------\n" +
502 			"1. ERROR in X.java (at line 6)\n" +
503 			"	import static p.Y.Zz;\n" +
504 			"	              ^^^^^^\n" +
505 			"The import p.Y.Zz cannot be resolved\n" +
506 			"----------\n" +
507 			"2. ERROR in X.java (at line 7)\n" +
508 			"	import static p.Z.Zz.WW.*;\n" +
509 			"	              ^^^^^^^^^\n" +
510 			"The import p.Z.Zz.WW cannot be resolved\n" +
511 			"----------\n" +
512 			"3. ERROR in X.java (at line 8)\n" +
513 			"	import p.Y.ZZ;\n" +
514 			"	       ^^^^^^\n" +
515 			"The import p.Y.ZZ cannot be resolved\n" +
516 			"----------\n" +
517 			"4. ERROR in X.java (at line 9)\n" +
518 			"	import static p.Y.ZZ.*;\n" +
519 			"	              ^^^^^^\n" +
520 			"The import p.Y.ZZ cannot be resolved\n" +
521 			"----------\n" +
522 			"5. ERROR in X.java (at line 10)\n" +
523 			"	import static p.Y.ZZ.WW;\n" +
524 			"	              ^^^^^^\n" +
525 			"The import p.Y.ZZ cannot be resolved\n" +
526 			"----------\n" +
527 			"6. ERROR in X.java (at line 11)\n" +
528 			"	import static p.Y.ZZ.WW.*;\n" +
529 			"	              ^^^^^^\n" +
530 			"The import p.Y.ZZ cannot be resolved\n" +
531 			"----------\n" +
532 			"7. ERROR in X.java (at line 12)\n" +
533 			"	import static p.Y.ZZ.ZZZ;\n" +
534 			"	              ^^^^^^\n" +
535 			"The import p.Y.ZZ cannot be resolved\n" +
536 			"----------\n" +
537 			"8. ERROR in X.java (at line 13)\n" +
538 			"	import static p.Y.ZZ.WW.WWW;\n" +
539 			"	              ^^^^^^\n" +
540 			"The import p.Y.ZZ cannot be resolved\n" +
541 			"----------\n"
542 		);
543 	}
544 
545 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78056
test014()546 	public void test014() {
547 		this.runConformTest(
548 			new String[] {
549 				"X.java",
550 				"import static p.Z.ZZ.ZZZ;\n" +
551 				"public class X {}\n",
552 				"p/Z.java",
553 				"package p;\n" +
554 				"public class Z {\n" +
555 				"	public class ZZ { public static final  int ZZZ = 0; }\n" +
556 				"}\n",
557 			},
558 			""
559 		);
560 	}
561 
562 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78075
test015()563 	public void test015() {
564 		this.runConformTest(
565 			new String[] {
566 				"X.java",
567 				"import p.Z.*;\n" +
568 				"import static p.Z.*;\n" +
569 				"public class X { int i = COUNT; }\n",
570 				"p/Z.java",
571 				"package p;\n" +
572 				"public class Z {\n" +
573 				"	public static final  int COUNT = 0;\n" +
574 				"}\n",
575 			},
576 			""
577 		);
578 		this.runConformTest(
579 			new String[] {
580 				"X.java",
581 				"import static p.Z.*;\n" +
582 				"import p.Z.*;\n" +
583 				"public class X { int i = COUNT; }\n",
584 				"p/Z.java",
585 				"package p;\n" +
586 				"public class Z {\n" +
587 				"	public static final  int COUNT = 0;\n" +
588 				"}\n",
589 			},
590 			""
591 		);
592 	}
593 
594 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77630
test016()595 	public void test016() {
596 		this.runNegativeTest(
597 			new String[] {
598 				"X.java",
599 				"import static java.lang.*;\n" +
600 				"public class X {}\n"
601 			},
602 			"----------\n" +
603 			"1. ERROR in X.java (at line 1)\n" +
604 			"	import static java.lang.*;\n" +
605 			"	              ^^^^^^^^^\n" +
606 			"Only a type can be imported. java.lang resolves to a package\n" +
607 			"----------\n"
608 		);
609 	}
610 
611 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81724
test017()612 	public void test017() {
613 		this.runConformTest(
614 			new String[] {
615 				"bug/A.java",
616 				"package bug;\n" +
617 				"import static bug.C.*;\n" +
618 				"public class A {\n" +
619 				"   private B b;\n" +
620 				"}\n",
621 				"bug/B.java",
622 				"package bug;\n" +
623 				"import static bug.C.*;\n" +
624 				"public class B {\n" +
625 				"}\n",
626 				"bug/C.java",
627 				"package bug;\n" +
628 				"public class C {\n" +
629 				"   private B b;\n" +
630 				"}\n",
631 			},
632 			""
633 		);
634 	}
635 
636 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81724 - variation
test018()637 	public void test018() {
638 		this.runNegativeTest(
639 			new String[] {
640 				"bug/A.java",
641 				"package bug;\n" +
642 				"import static bug.C.*;\n" +
643 				"public class A {\n" +
644 				"   private B b2 = b;\n" +
645 				"}\n",
646 				"bug/B.java",
647 				"package bug;\n" +
648 				"import static bug.C.*;\n" +
649 				"public class B {\n" +
650 				"}\n",
651 				"bug/C.java",
652 				"package bug;\n" +
653 				"public class C {\n" +
654 				"   private static B b;\n" +
655 				"}\n",
656 			},
657 			"----------\n" +
658 			"1. ERROR in bug\\A.java (at line 4)\n" +
659 			"	private B b2 = b;\n" +
660 			"	               ^\n" +
661 			"The field C.b is not visible\n" +
662 			"----------\n" +
663 			"----------\n" +
664 			"1. WARNING in bug\\B.java (at line 2)\n" +
665 			"	import static bug.C.*;\n" +
666 			"	              ^^^^^\n" +
667 			"The import bug.C is never used\n" +
668 			"----------\n" +
669 			"----------\n" +
670 			"1. WARNING in bug\\C.java (at line 3)\n" +
671 			"	private static B b;\n" +
672 			"	                 ^\n" +
673 			"The value of the field C.b is not used\n" +
674 			"----------\n");
675 	}
676 
677 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81718
test019()678 	public void test019() {
679 		this.runNegativeTest(
680 			new String[] {
681 				"X.java",
682 				"import static java.lang.Math.PI;\n" +
683 				"\n" +
684 				"public class X {\n" +
685 				"  boolean PI;\n" +
686 				"  Zork z;\n" +
687 				"}\n",
688 			},
689 			"----------\n" +
690 			"1. ERROR in X.java (at line 5)\n" +
691 			"	Zork z;\n" +
692 			"	^^^^\n" +
693 			"Zork cannot be resolved to a type\n" +
694 			"----------\n");
695 	}
696 
697 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82754
test020()698 	public void test020() {
699 		this.runNegativeTest(
700 			new String[] {
701 				"X.java",
702 				"import static java.lang.Math.round;\n" +
703 				"public class X {\n" +
704 				"  void foo() { cos(0); }\n" +
705 				"}\n"
706 			},
707 			"----------\n" +
708 			"1. ERROR in X.java (at line 3)\n" +
709 			"	void foo() { cos(0); }\n" +
710 			"	             ^^^\n" +
711 			"The method cos(int) is undefined for the type X\n" +
712 			"----------\n"	);
713 	}
714 
test021()715 	public void test021() {
716 		this.runConformTest(
717 			new String[] {
718 				"X.java",
719 				"import static p.B.foo;\n" +
720 				"public class X {\n" +
721 				"  void test() { foo(); }\n" +
722 				"}\n",
723 				"p/A.java",
724 				"package p;\n" +
725 				"public class A { public static void foo() {} }\n",
726 				"p/B.java",
727 				"package p;\n" +
728 				"public class B extends A { }\n"
729 			},
730 			""
731 		);
732 		this.runNegativeTest(
733 			new String[] {
734 				"X.java",
735 				"import static p.B.foo;\n" +
736 				"public class X {\n" +
737 				"  void test() { foo(); }\n" +
738 				"}\n",
739 				"p/A.java",
740 				"package p;\n" +
741 				"public class A { public void foo() {} }\n",
742 				"p/B.java",
743 				"package p;\n" +
744 				"public class B extends A { static void foo(int i) {} }\n"
745 			},
746 			"----------\n" +
747 			"1. ERROR in X.java (at line 1)\n" +
748 			"	import static p.B.foo;\n" +
749 			"	              ^^^^^^^\n" +
750 			"The import p.B.foo cannot be resolved\n" +
751 			"----------\n" +
752 			"2. ERROR in X.java (at line 3)\n" +
753 			"	void test() { foo(); }\n" +
754 			"	              ^^^\n" +
755 			"The method foo() is undefined for the type X\n" +
756 			"----------\n"
757 		);
758 	}
759 
test022()760 	public void test022() { // test field/method collisions
761 		this.runConformTest(
762 			new String[] {
763 				"X.java",
764 				"import static p.A.F;\n" +
765 				"import static p.B.F;\n" +
766 				"public class X {\n" +
767 				"	int i = F;\n" +
768 				"}\n",
769 				"p/A.java",
770 				"package p;\n" +
771 				"public class A { public static class F {} }\n",
772 				"p/B.java",
773 				"package p;\n" +
774 				"public class B { public static int F = 2; }\n",
775 			},
776 			""
777 			// no collision between field and member type
778 		);
779 		this.runConformTest(
780 			new String[] {
781 				"X.java",
782 				"import static p.A.F;\n" +
783 				"import static p.B.F;\n" +
784 				"public class X {\n" +
785 				"	int i = F + F();\n" +
786 				"}\n",
787 				"p/A.java",
788 				"package p;\n" +
789 				"public class A { public static int F() { return 1; } }\n",
790 				"p/B.java",
791 				"package p;\n" +
792 				"public class B { public static int F = 2; }\n",
793 			},
794 			""
795 			// no collision between field and method
796 		);
797 		this.runConformTest(
798 			new String[] {
799 				"X.java",
800 				"import static p.A.F;\n" +
801 				"import static p.B.F;\n" +
802 				"public class X {\n" +
803 				"	int i = F;\n" +
804 				"}\n",
805 				"p/A.java",
806 				"package p;\n" +
807 				"public class A { public static int F = 1; }\n",
808 				"p/B.java",
809 				"package p;\n" +
810 				"public class B extends A {}\n",
811 			},
812 			""
813 			// no collision between 2 fields that are the same
814 		);
815 		this.runNegativeTest(
816 			new String[] {
817 				"X.java",
818 				"import static p.A.F;\n" +
819 				"import static p.B.F;\n" +
820 				"public class X {\n" +
821 				"	int i = F;\n" +
822 				"}\n",
823 				"p/A.java",
824 				"package p;\n" +
825 				"public class A { public static int F = 1; }\n",
826 				"p/B.java",
827 				"package p;\n" +
828 				"public class B { public static int F = 2; }\n",
829 			},
830 			this.complianceLevel < ClassFileConstants.JDK1_8 ?
831 					"----------\n" +
832 					"1. ERROR in X.java (at line 2)\n" +
833 					"	import static p.B.F;\n" +
834 					"	              ^^^^^\n" +
835 					"The import p.B.F collides with another import statement\n" +
836 					"----------\n" :
837 						"----------\n" +
838 						"1. ERROR in X.java (at line 4)\n" +
839 						"	int i = F;\n" +
840 						"	        ^\n" +
841 						"The field F is ambiguous\n" +
842 						"----------\n"
843 			// F is already defined in a single-type import
844 		);
845 	}
846 
test023()847 	public void test023() {
848 		this.runConformTest(
849 			new String[] {
850 				"X.java",
851 				"import static p.A.C;\n" +
852 				"public class X {\n" +
853 				"	public static void main(String[] args) {\n" +
854 				"		System.out.print(C);\n" +
855 				"		System.out.print(C());\n" +
856 				"	}\n" +
857 				"}\n",
858 				"p/A.java",
859 				"package p;\n" +
860 				"public class A {\n" +
861 				"	public static int C = 1;\n" +
862 				"	public static int C() { return C + 3; }\n" +
863 				"}\n"
864 			},
865 			"14"
866 		);
867 		this.runConformTest( // extra inheritance hiccup for method lookup
868 			new String[] {
869 				"X.java",
870 				"import static p.A.C;\n" +
871 				"public class X {\n" +
872 				"	public static void main(String[] args) {\n" +
873 				"		System.out.print(C);\n" +
874 				"		System.out.print(C());\n" +
875 				"	}\n" +
876 				"}\n",
877 				"p/A.java",
878 				"package p;\n" +
879 				"public class A extends B {\n" +
880 				"	public static int C() { return C + 3; }\n" +
881 				"}\n",
882 				"p/B.java",
883 				"package p;\n" +
884 				"public class B {\n" +
885 				"	public static int C = 1;\n" +
886 				"}\n"
887 			},
888 			"14"
889 		);
890 	}
891 
892 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=83376
test024()893 	public void test024() {
894 		this.runNegativeTest(
895 			new String[] {
896 				"p/B.java",
897 				"package p;\n" +
898 				"import static p.A.m;\n" +
899 				"import static p2.C.m;\n" +
900 				"class A { static void m() {} }\n" +
901 				"public class B { public static void main(String[] args) { m(); } }\n",
902 				"p2/C.java",
903 				"package p2;\n" +
904 				"public class C { public static void m() {} }\n"
905 			},
906 			"----------\n" +
907 			"1. ERROR in p\\B.java (at line 5)\n" +
908 			"	public class B { public static void main(String[] args) { m(); } }\n" +
909 			"	                                                          ^\n" +
910 			"The method m() is ambiguous for the type B\n" +
911 			"----------\n"
912 		);
913 		this.runConformTest(
914 			new String[] {
915 				"p/X.java",
916 				"package p;\n" +
917 				"import static p.A.m;\n" +
918 				"import static p.B.m;\n" +
919 				"public class X { void test() { m(); } }\n" +
920 				"class B extends A {}\n",
921 				"p/A.java",
922 				"package p;\n" +
923 				"public class A { public static int m() { return 0; } }\n"
924 			},
925 			""
926 		);
927 	}
928 
test025()929 	public void test025() {
930 		this.runConformTest(
931 			new String[] {
932 				"X.java",
933 				"import static java.lang.Math.*;\n" +
934 				"public class X {\n" +
935 				"	public static void main(String[] s) {\n" +
936 				"		System.out.print(max(PI, 4));\n" +
937 				"		new Runnable() {\n" +
938 				"			public void run() {\n" +
939 				"				System.out.println(max(PI, 5));\n" +
940 				"			}\n" +
941 				"		}.run();\n" +
942 				"	}\n" +
943 				"}\n"
944 			},
945 			"4.05.0"
946 		);
947 	}
948 
test026()949 	public void test026() { // ensure inherited problem fields do not stop package resolution
950 		this.runConformTest(
951 			new String[] {
952 				"X.java",
953 				"public class X extends Y { static void test() { java.lang.String.valueOf(0); } }\n" +
954 				"class Y { private String java; }\n"
955 			},
956 			""
957 		);
958 	}
959 
test027()960 	public void test027() {
961 		this.runNegativeTest(
962 			new String[] {
963 				"X.java",
964 				"import static p.ST.foo;\n" +
965 				"public class X {\n" +
966 				"	\n" +
967 				"	foo bar;\n" +
968 				"}\n",
969 				"p/ST.java",
970 				"package p; \n" +
971 				"public class ST {\n" +
972 				"	public static int foo;\n" +
973 				"}\n"	,
974 			},
975 			"----------\n" +
976 			"1. ERROR in X.java (at line 4)\n" +
977 			"	foo bar;\n" +
978 			"	^^^\n" +
979 			"foo cannot be resolved to a type\n" +
980 			"----------\n");
981 	}
982 
983 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87490
test028()984 	public void test028() {
985 		this.runConformTest(
986 			new String[] {
987 				"p1/Z.java",//====================
988 				"package p1;\n" +
989 				"public class Z {\n" +
990 				"	public interface I {\n" +
991 				"	}\n" +
992 				"}\n",
993 				"q/Y.java",//====================
994 				"package q;\n" +
995 				"import static p.X.I;\n" +
996 				"import static p1.Z.I;\n" +
997 				"public class Y implements I {\n" +
998 				"}\n",
999 				"p/X.java",//====================
1000 				"package p;\n" +
1001 				"public enum X {\n" +
1002 				"	I, J, K\n" +
1003 				"}\n"	,
1004 			},
1005 			"");
1006 		// recompile Y against binaries
1007 		this.runConformTest(
1008 			new String[] {
1009 				"q/Y.java",//====================
1010 				"package q;\n" +
1011 				"import static p.X.I;\n" +
1012 				"import static p1.Z.I;\n" +
1013 				"public class Y implements I {\n" +
1014 				"}\n",
1015 			},
1016 			"",
1017 			null,
1018 			false,
1019 			null);
1020 	}
1021 
1022 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=93913
test029()1023 	public void test029() {
1024 		this.runNegativeTest(
1025 			new String[] {
1026 				"p1/A.java",
1027 				"package p1;\n" +
1028 				"import static p2.C.B;\n" +
1029 				"public class A extends B {\n" +
1030 				"	void test() {" +
1031 				"		int i = B();\n" +
1032 				"		B b = null;\n" +
1033 				"		b.fooB();\n" +
1034 				"		b.fooC();\n" +
1035 				"		fooC();\n" +
1036 				"	}\n" +
1037 				"}\n",
1038 				"p1/B.java",
1039 				"package p1;\n" +
1040 				"public class B {\n" +
1041 				"	public void fooB() {}\n" +
1042 				"}\n",
1043 				"p2/C.java",
1044 				"package p2;\n" +
1045 				"public class C {\n" +
1046 				"	public static class B { public void fooC() {} }\n" +
1047 				"	public static int B() { return 0; }\n" +
1048 				"}\n",
1049 			},
1050 			"----------\n" +
1051 			"1. ERROR in p1\\A.java (at line 6)\n" +
1052 			"	b.fooB();\n" +
1053 			"	  ^^^^\n" +
1054 			"The method fooB() is undefined for the type C.B\n" +
1055 			"----------\n"
1056 		);
1057 	}
1058 
1059 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=94262
test030()1060 	public void test030() {
1061 		this.runNegativeTest(
1062 			new String[] {
1063 				"p2/Test.java",
1064 				"package p2;\n" +
1065 				"import static p1.A.*;\n" +
1066 				"public class Test {\n" +
1067 				"	Inner1 i; // not found\n" +
1068 				"	Inner2 j;\n" +
1069 				"}\n",
1070 				"p1/A.java",
1071 				"package p1;\n" +
1072 				"public class A {\n" +
1073 				"	public class Inner1 {}\n" +
1074 				"	public static class Inner2 {}\n" +
1075 				"}\n",
1076 			},
1077 			"----------\n" +
1078 			"1. ERROR in p2\\Test.java (at line 4)\n" +
1079 			"	Inner1 i; // not found\n" +
1080 			"	^^^^^^\n" +
1081 			"Inner1 cannot be resolved to a type\n" +
1082 			"----------\n"
1083 		);
1084 		this.runConformTest(
1085 			new String[] {
1086 				"p2/Test.java",
1087 				"package p2;\n" +
1088 				"import p1.A.*;\n" +
1089 				"import static p1.A.*;\n" +
1090 				"import static p1.A.*;\n" +
1091 				"public class Test {\n" +
1092 				"	Inner1 i;\n" +
1093 				"	Inner2 j;\n" +
1094 				"}\n",
1095 				"p1/A.java",
1096 				"package p1;\n" +
1097 				"public class A {\n" +
1098 				"	public class Inner1 {}\n" +
1099 				"	public static class Inner2 {}\n" +
1100 				"}\n",
1101 			},
1102 			""
1103 		);
1104 	}
1105 
1106 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95909
test031()1107 	public void test031() {
1108 		this.runNegativeTest(
1109 			new String[] {
1110 				"PointRadius.java",
1111 				"import static java.lang.Math.sqrt;\n" +
1112 				"\n" +
1113 				"public class PointRadius {\n" +
1114 				"\n" +
1115 				"	public static void main(String[] args) {\n" +
1116 				"		double radius = 0;\n" +
1117 				"		radius = sqrt(pondArea / Math.PI);\n" +
1118 				"\n" +
1119 				"	}\n" +
1120 				"}\n",
1121 			},
1122 			"----------\n" +
1123 			"1. ERROR in PointRadius.java (at line 7)\n" +
1124 			"	radius = sqrt(pondArea / Math.PI);\n" +
1125 			"	              ^^^^^^^^\n" +
1126 			"pondArea cannot be resolved to a variable\n" +
1127 			"----------\n");
1128 	}
1129 
1130 	//http://bugs.eclipse.org/bugs/show_bug.cgi?id=97809
test032()1131 	public void test032() {
1132 		this.runConformTest(
1133 			new String[] {
1134 				"X.java",
1135 				"import static p.A.*;\n" +
1136 				"import static p.B.*;\n" +
1137 				"public class X {\n" +
1138 				"	public static void main(String[] args) {foo();}\n" +
1139 				"}\n",
1140 				"p/A.java",
1141 				"package p;" +
1142 				"public class A {\n" +
1143 				"	public static void foo() {System.out.print(false);}\n" +
1144 				"}\n",
1145 				"p/B.java",
1146 				"package p;" +
1147 				"public class B extends A {\n" +
1148 				"	public static void foo() {System.out.print(true);}\n" +
1149 				"}\n"
1150 			},
1151 			"true");
1152 	}
1153 
1154 	//http://bugs.eclipse.org/bugs/show_bug.cgi?id=97809
test032b()1155 	public void test032b() {
1156 		this.runNegativeTest(
1157 			new String[] {
1158 				"X2.java",
1159 				"import static p2.A.*;\n" +
1160 				"import static p2.B.*;\n" +
1161 				"public class X2 { void test() {foo();} }\n",
1162 				"p2/A.java",
1163 				"package p2;" +
1164 				"public class A {\n" +
1165 				"	public static void foo() {}\n" +
1166 				"}\n",
1167 				"p2/B.java",
1168 				"package p2;" +
1169 				"public class B {\n" +
1170 				"	public static void foo() {}\n" +
1171 				"}\n"
1172 			},
1173 			"----------\n" +
1174 			"1. ERROR in X2.java (at line 3)\n" +
1175 			"	public class X2 { void test() {foo();} }\n" +
1176 			"	                               ^^^\n" +
1177 			"The method foo() is ambiguous for the type X2\n" +
1178 			"----------\n"
1179 			// reference to foo is ambiguous, both method foo() in p.B and method foo() in p.A match
1180 		);
1181 	}
1182 
1183 	//http://bugs.eclipse.org/bugs/show_bug.cgi?id=97809
test032c()1184 	public void test032c() {
1185 		this.runConformTest(
1186 			new String[] {
1187 				"X3.java",
1188 				"import static p3.A.*;\n" +
1189 				"import static p3.B.foo;\n" +
1190 				"public class X3 {\n" +
1191 				"	public static void main(String[] args) {foo();}\n" +
1192 				"}\n",
1193 				"p3/A.java",
1194 				"package p3;" +
1195 				"public class A {\n" +
1196 				"	public static void foo() {System.out.print(false);}\n" +
1197 				"}\n",
1198 				"p3/B.java",
1199 				"package p3;" +
1200 				"public class B {\n" +
1201 				"	public static void foo() {System.out.print(true);}\n" +
1202 				"}\n"
1203 			},
1204 			"true");
1205 	}
1206 
1207 	//http://bugs.eclipse.org/bugs/show_bug.cgi?id=97809
test032d()1208 	public void test032d() {
1209 		this.runConformTest(
1210 			new String[] {
1211 				"X4.java",
1212 				"import static p4.A.foo;\n" +
1213 				"import static p4.B.*;\n" +
1214 				"public class X4 {\n" +
1215 				"	public static void main(String[] args) {foo();}\n" +
1216 				"}\n",
1217 				"p4/A.java",
1218 				"package p4;" +
1219 				"public class A {\n" +
1220 				"	public static void foo() {System.out.print(true);}\n" +
1221 				"}\n",
1222 				"p4/B.java",
1223 				"package p4;" +
1224 				"public class B extends A {\n" +
1225 				"	public static void foo() {System.out.print(false);}\n" +
1226 				"}\n"
1227 			},
1228 			"true");
1229 	}
1230 
test033()1231 	public void test033() {
1232 		this.runConformTest(
1233 			new String[] {
1234 				"X.java",
1235 				"import static p.A.*;\n" +
1236 				"import static p.B.*;\n" +
1237 				"public class X {\n" +
1238 				"	public static void main(String[] args) {foo(\"aa\");}\n" +
1239 				"}\n",
1240 				"p/A.java",
1241 				"package p;" +
1242 				"public class A {\n" +
1243 				"	public static <U> void foo(U u) {System.out.print(false);}\n" +
1244 				"}\n",
1245 				"p/B.java",
1246 				"package p;" +
1247 				"public class B extends A {\n" +
1248 				"	public static <V> void foo(String s) {System.out.print(true);}\n" +
1249 				"}\n"
1250 			},
1251 			"true");
1252 	}
1253 
test033b()1254 	public void test033b() {
1255 		this.runConformTest(
1256 			new String[] {
1257 				"X2.java",
1258 				"import static p2.A.*;\n" +
1259 				"import static p2.B.*;\n" +
1260 				"public class X2 {\n" +
1261 				"	public static void main(String[] args) {foo(\"aa\");}\n" +
1262 				"}\n",
1263 				"p2/A.java",
1264 				"package p2;" +
1265 				"public class A {\n" +
1266 				"	public static <U> void foo(String s) {System.out.print(true);}\n" +
1267 				"}\n",
1268 				"p2/B.java",
1269 				"package p2;" +
1270 				"public class B extends A {\n" +
1271 				"	public static <V> void foo(V v) {System.out.print(false);}\n" +
1272 				"}\n"
1273 			},
1274 			"true");
1275 	}
1276 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104198
test034()1277 	public void test034() {
1278 		this.runConformTest(
1279 			new String[] {
1280 				"test/AbstractTest.java",
1281 				"package test;\n" +
1282 				"public abstract class AbstractTest<Z> {\n" +
1283 				"  \n" +
1284 				"  public abstract MyEnum m(Z z);\n" +
1285 				"  \n" +
1286 				"  public enum MyEnum {\n" +
1287 				"    A,B\n" +
1288 				"  }\n" +
1289 				"}\n",
1290 				"test/X.java",
1291 				"package test;\n" +
1292 				"import static test.AbstractTest.MyEnum.*;\n" +
1293 				"public class X extends AbstractTest<String> {\n" +
1294 				"  @Override public MyEnum m(String s) {\n" +
1295 				"    return A;\n" +
1296 				"  }\n" +
1297 				"}\n"
1298 			},
1299 			"");
1300 	}
1301 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117861
test035()1302 	public void test035() {
1303 		this.runConformTest(
1304 			new String[] {
1305 				"Bug.java",
1306 				"import static java.lang.String.format;\n" +
1307 				"public class Bug extends p.TestCase {\n" +
1308 				"	public static void main(String[] args) {\n" +
1309 				"		String msg = \"test\";\n" +
1310 				"		System.out.print(format(msg));\n" +
1311 				"		System.out.print(format(msg, 1, 2));\n" +
1312 				"	}\n" +
1313 				"}\n",
1314 				"p/TestCase.java",
1315 				"package p;\n" +
1316 				"public class TestCase {\n" +
1317 				"	static String format(String message, Object expected, Object actual) {return null;}\n" +
1318 				"}\n"
1319 			},
1320 			"testtest");
1321 		this.runNegativeTest(
1322 			new String[] {
1323 				"C.java",
1324 				"class A {\n" +
1325 				"	static class B { void foo(Object o, String s) {} }\n" +
1326 				"	void foo(int i) {}\n" +
1327 				"}\n" +
1328 				"class C extends A.B {\n" +
1329 				"	void test() { foo(1); }\n" +
1330 				"}\n"
1331 			},
1332 			"----------\n" +
1333 			"1. ERROR in C.java (at line 6)\n" +
1334 			"	void test() { foo(1); }\n" +
1335 			"	              ^^^\n" +
1336 			"The method foo(Object, String) in the type A.B is not applicable for the arguments (int)\n" +
1337 			"----------\n");
1338 		this.runNegativeTest(
1339 			new String[] {
1340 				"A.java",
1341 				"public class A {\n" +
1342 				"  void foo(int i, long j) {}\n" +
1343 				"  class B {\n" +
1344 				"    void foo() { foo(1, 1); }\n" +
1345 				"  }\n" +
1346 				"}",
1347 			},
1348 			"----------\n" +
1349 			"1. ERROR in A.java (at line 4)\n" +
1350 			"	void foo() { foo(1, 1); }\n" +
1351 			"	             ^^^\n" +
1352 			"The method foo() in the type A.B is not applicable for the arguments (int, int)\n" +
1353 			"----------\n"
1354 		);
1355 	}
1356 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126564
test036()1357 	public void test036() {
1358 		this.runNegativeTest(
1359 			new String[] {
1360 				"X.java",
1361 				"import static p.A.CONSTANT_I;\n" +
1362 				"import static p.A.CONSTANT_B;\n" +
1363 				"public class X {\n" +
1364 				"  static int i = p.A.CONSTANT_I;\n" +
1365 				"  static int j = p.A.CONSTANT_B;\n" +
1366 				"  static int m = CONSTANT_I;\n" +
1367 				"  static int n = CONSTANT_B;\n" +
1368 				"}",
1369 				"p/A.java",
1370 				"package p;\n" +
1371 				"public class A extends B implements I {}\n" +
1372 				"interface I { int CONSTANT_I = 1; }\n" +
1373 				"class B { int CONSTANT_B = 1; }",
1374 			},
1375 			"----------\n" +
1376 			"1. ERROR in X.java (at line 2)\n" +
1377 			"	import static p.A.CONSTANT_B;\n" +
1378 			"	              ^^^^^^^^^^^^^^\n" +
1379 			"The field B.p.A.CONSTANT_B is not visible\n" +
1380 			"----------\n" +
1381 			"2. ERROR in X.java (at line 5)\n" +
1382 			"	static int j = p.A.CONSTANT_B;\n" +
1383 			"	                   ^^^^^^^^^^\n" +
1384 			"The field B.CONSTANT_B is not visible\n" +
1385 			"----------\n" +
1386 			"3. ERROR in X.java (at line 7)\n" +
1387 			"	static int n = CONSTANT_B;\n" +
1388 			"	               ^^^^^^^^^^\n" +
1389 			"CONSTANT_B cannot be resolved to a variable\n" +
1390 			"----------\n");
1391 	}
1392 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126564 - variation
test037()1393 	public void test037() {
1394 		this.runConformTest(
1395 			new String[] {
1396 				"X.java",
1397 				"import static p.A.CONSTANT_I;\n" +
1398 				"import static p.A.CONSTANT_B;\n" +
1399 				"public class X {\n" +
1400 				"  static int i = p.A.CONSTANT_I;\n" +
1401 				"  static int j = p.A.CONSTANT_B;\n" +
1402 				"  static int m = CONSTANT_I;\n" +
1403 				"  static int n = CONSTANT_B;\n" +
1404 				"}",
1405 				"p/A.java",
1406 				"package p;\n" +
1407 				"public class A extends B implements I {}\n" +
1408 				"interface I { int CONSTANT_I = 1; }\n" +
1409 				"class B { public static int CONSTANT_B = 1; }",
1410 			},
1411 			JavacTestOptions.JavacHasABug.JavacBugFixed_6_10);
1412 	}
1413 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126564 - variation
test038()1414 	public void test038() {
1415 		this.runNegativeTest(
1416 			new String[] {
1417 				"X.java",
1418 				"import static p.A.foo_I;\n" +
1419 				"import static p.A.foo_B;\n" +
1420 				"public class X {\n" +
1421 				"  static int i = p.A.foo_I();\n" +
1422 				"  static int j = p.A.foo_B();\n" +
1423 				"  static int m = foo_I();\n" +
1424 				"  static int n = foo_B();\n" +
1425 				"}",
1426 				"p/A.java",
1427 				"package p;\n" +
1428 				"public abstract class A extends B implements I {}\n" +
1429 				"interface I { int foo_I(); }\n" +
1430 				"class B { int foo_B() { return 2;} }",
1431 			},
1432 			"----------\n" +
1433 			"1. ERROR in X.java (at line 1)\n" +
1434 			"	import static p.A.foo_I;\n" +
1435 			"	              ^^^^^^^^^\n" +
1436 			"The import p.A.foo_I cannot be resolved\n" +
1437 			"----------\n" +
1438 			"2. ERROR in X.java (at line 2)\n" +
1439 			"	import static p.A.foo_B;\n" +
1440 			"	              ^^^^^^^^^\n" +
1441 			"The import p.A.foo_B cannot be resolved\n" +
1442 			"----------\n" +
1443 			"3. ERROR in X.java (at line 4)\n" +
1444 			"	static int i = p.A.foo_I();\n" +
1445 			"	               ^^^^^^^^^^^\n" +
1446 			"Cannot make a static reference to the non-static method foo_I() from the type I\n" +
1447 			"----------\n" +
1448 			"4. ERROR in X.java (at line 5)\n" +
1449 			"	static int j = p.A.foo_B();\n" +
1450 			"	                   ^^^^^\n" +
1451 			"The method foo_B() from the type B is not visible\n" +
1452 			"----------\n" +
1453 			"5. ERROR in X.java (at line 6)\n" +
1454 			"	static int m = foo_I();\n" +
1455 			"	               ^^^^^\n" +
1456 			"The method foo_I() is undefined for the type X\n" +
1457 			"----------\n" +
1458 			"6. ERROR in X.java (at line 7)\n" +
1459 			"	static int n = foo_B();\n" +
1460 			"	               ^^^^^\n" +
1461 			"The method foo_B() is undefined for the type X\n" +
1462 			"----------\n");
1463 	}
1464 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126564 - variation
test039()1465 	public void test039() {
1466 		this.runNegativeTest(
1467 			new String[] {
1468 				"X.java",
1469 				"import static p.A.foo_I;\n" +
1470 				"import static p.A.foo_B;\n" +
1471 				"public class X {\n" +
1472 				"  static int i = p.A.foo_I();\n" +
1473 				"  static int j = p.A.foo_B();\n" +
1474 				"  static int m = foo_I();\n" +
1475 				"  static int n = foo_B();\n" +
1476 				"}",
1477 				"p/A.java",
1478 				"package p;\n" +
1479 				"public abstract class A extends B implements I {}\n" +
1480 				"interface I { int foo_I(); }\n" +
1481 				"class B { public static int foo_B() { return 2;} }",
1482 			},
1483 			"----------\n" +
1484 			"1. ERROR in X.java (at line 1)\n" +
1485 			"	import static p.A.foo_I;\n" +
1486 			"	              ^^^^^^^^^\n" +
1487 			"The import p.A.foo_I cannot be resolved\n" +
1488 			"----------\n" +
1489 			"2. ERROR in X.java (at line 4)\n" +
1490 			"	static int i = p.A.foo_I();\n" +
1491 			"	               ^^^^^^^^^^^\n" +
1492 			"Cannot make a static reference to the non-static method foo_I() from the type I\n" +
1493 			"----------\n" +
1494 			"3. ERROR in X.java (at line 6)\n" +
1495 			"	static int m = foo_I();\n" +
1496 			"	               ^^^^^\n" +
1497 			"The method foo_I() is undefined for the type X\n" +
1498 			"----------\n");
1499 	}
1500 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87490 - variation
test040()1501 	public void test040() {
1502 		this.runConformTest(
1503 			new String[] {
1504 				"p1/Z.java",//====================
1505 				"package p1;\n" +
1506 				"public class Z {\n" +
1507 				"	public interface I {\n" +
1508 				"	}\n" +
1509 				"}\n",
1510 				"q/Y.java",//====================
1511 				"package q;\n" +
1512 				"import static p.X.foo;\n" +
1513 				"import static p1.Z.I;\n" +
1514 				"public class Y implements I {\n" +
1515 				"}\n",
1516 				"p/X.java",//====================
1517 				"package p;\n" +
1518 				"public class X {\n" +
1519 				"	public static void foo() {}\n" +
1520 				"}\n"	,
1521 			},
1522 			"");
1523 		// recompile Y against binaries
1524 		this.runConformTest(
1525 			new String[] {
1526 				"q/Y.java",//====================
1527 				"package q;\n" +
1528 				"import static p.X.foo;\n" +
1529 				"import static p1.Z.I;\n" +
1530 				"public class Y implements I {\n" +
1531 				"}\n",
1532 			},
1533 			"",
1534 			null,
1535 			false,
1536 			null);
1537 	}
1538 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=134118
test041()1539 	public void test041() {
1540 		this.runConformTest(
1541 			true,
1542 			new String[] {
1543 				"Test.java",
1544 				"import static p.I.*;\n" +
1545 				"import static p.J.*;\n" +
1546 				"public class Test {\n" +
1547 				"	int i = Constant;\n" +
1548 				"}\n",
1549 				"p/I.java",
1550 				"package p;\n" +
1551 				"public interface I { static int Constant = 1; }\n",
1552 				"p/J.java",
1553 				"package p;\n" +
1554 				"public interface J extends I {}\n"	,
1555 			},
1556 			"----------\n" +
1557 			"1. WARNING in Test.java (at line 2)\n" +
1558 			"	import static p.J.*;\n" +
1559 			"	              ^^^\n" +
1560 			"The import p.J is never used\n" +
1561 			"----------\n",
1562 			null,
1563 			null,
1564 			JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings
1565 		);
1566 	}
1567 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=133737
test042()1568 	public void test042() {
1569 		this.runNegativeTest(
1570 			new String[] {
1571 				"ImportTest.java",
1572 				"import static p.ArrayTest.toString2;\n" +
1573 				"public class ImportTest extends SuperTest {\n" +
1574 				"	public static void main(String[] args) { printArgs(1, 2, 3, 4, 5); }\n" +
1575 				"	static void printArgs(Object... args) { toString2(args); }\n" +
1576 				"}\n" +
1577 				"class SuperTest {\n" +
1578 				"	static void toString2() {}\n" +
1579 				"}\n",
1580 				"p/ArrayTest.java",
1581 				"package p;\n" +
1582 				"public class ArrayTest {\n" +
1583 				"	public static void toString2(String[] args) {}\n" +
1584 				"}\n",
1585 			},
1586 			"----------\n" +
1587 			"1. ERROR in ImportTest.java (at line 4)\n" +
1588 			"	static void printArgs(Object... args) { toString2(args); }\n" +
1589 			"	                                        ^^^^^^^^^\n" +
1590 			"The method toString2() in the type SuperTest is not applicable for the arguments (Object[])\n" +
1591 			"----------\n"
1592 			// toString2() in SuperTest cannot be applied to (java.lang.Object[])
1593 		);
1594 		this.runNegativeTest(
1595 			new String[] {
1596 				"ImportTest.java",
1597 				"import static java.util.Arrays.toString;\n" +
1598 				"public class ImportTest {\n" +
1599 				"	public static void main(String[] args) { printArgs(1, 2, 3, 4, 5); }\n" +
1600 				"	static void printArgs(Object... args) { toString(args); }\n" +
1601 				"}\n"
1602 			},
1603 			"----------\n" +
1604 			"1. ERROR in ImportTest.java (at line 4)\n" +
1605 			"	static void printArgs(Object... args) { toString(args); }\n" +
1606 			"	                                        ^^^^^^^^\n" +
1607 			"The method toString() in the type Object is not applicable for the arguments (Object[])\n" +
1608 			"----------\n"
1609 			// toString() in java.lang.Object cannot be applied to (java.lang.Object[])
1610 		);
1611 	}
test042b()1612 	public void test042b() {
1613 		this.runConformTest(
1614 			new String[] {
1615 				"ImportTest.java",
1616 				"import static p.DefinesFoo.foo;\n" +
1617 				"public class ImportTest extends SuperImportTest {\n" +
1618 				"	void test() { foo(\"fails?\"); }\n" +
1619 				"}\n" +
1620 				"class SuperImportTest {\n" +
1621 				"	private void foo() {}\n" +
1622 				"}\n",
1623 				"p/DefinesFoo.java",
1624 				"package p;\n" +
1625 				"public class DefinesFoo {\n" +
1626 				"	public static void foo(String s) {}\n" +
1627 				"}\n",
1628 			},
1629 			""
1630 		);
1631 	}
1632 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129388
test043()1633 	public void test043() {
1634 		this.runConformTest(
1635 			new String[] {
1636 				"B.java",
1637 				"import static java.lang.String.format;\n" +
1638 				"public class B extends p.A {\n" +
1639 				"	void test() { format(\"fails?\"); }\n" +
1640 				"	void test2() { format(\"fails?\", null); }\n" +
1641 				"	void test3() { format(\"fails?\", null, null); }\n" +
1642 				"	void test4() { format(\"fails?\", null, null, null); }\n" +
1643 				"}\n",
1644 				"p/A.java",
1645 				"package p;\n" +
1646 				"public class A {\n" +
1647 				"	static String format(String message, Object expected, Object actual) { return null; }\n" +
1648 				"}\n",
1649 			},
1650 			""
1651 		);
1652 	}
1653 	// names potential confusion
test044()1654 	public void test044() {
1655 		this.runConformTest(
1656 			new String[] {
1657 				"p/X.java",
1658 				"package p;\n" +
1659 				"import static p.X.B.E;\n" +
1660 				"import static p.X.B.*;\n" +
1661 				"\n" +
1662 				"public class X {\n" +
1663 				"  public static class Y {\n" +
1664 				"    public enum E { FOO; }\n" +
1665 				"    public static Object E() { return null; }\n" +
1666 				"    public enum F { FOO; }\n" +
1667 				"    public static Object F() { return null; }\n" +
1668 				"  }\n" +
1669 				"  public static class B extends Y {}\n" +
1670 				"  Object f1 = E.FOO;\n" +
1671 				"  Object f2 = E();\n" +
1672 				"  Object f3 = F.FOO;\n" +
1673 				"  Object f4 = F();\n" +
1674 				"}\n",
1675 			},
1676 			""
1677 		);
1678 	}
1679 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142772
test045()1680 	public void test045() {
1681 		this.runNegativeTest(
1682 			new String[] {
1683 				"X.java",
1684 				"import static test.Y.arrayList;\n" +
1685 				"public class X { static void arrayList(int x) { arrayList(); } }\n",
1686 				"test/Y.java",
1687 				"package test;\n" +
1688 				"public class Y { public static void arrayList() {} }\n",
1689 			},
1690 			"----------\n" +
1691 			"1. ERROR in X.java (at line 2)\n" +
1692 			"	public class X { static void arrayList(int x) { arrayList(); } }\n" +
1693 			"	                                                ^^^^^^^^^\n" +
1694 			"The method arrayList(int) in the type X is not applicable for the arguments ()\n" +
1695 			"----------\n"
1696 			// arrayList(int) in X cannot be applied to ()
1697 		);
1698 	}
test045b()1699 	public void test045b() {
1700 		this.runNegativeTest(
1701 			new String[] {
1702 				"test/One.java",
1703 				"package test;\n" +
1704 				"public class One { public static void arrayList(String s) {} }\n",
1705 				"test/Two.java",
1706 				"package test;\n" +
1707 				"public class Two { public void arrayList(int i) {} }\n",
1708 				"test/Three.java",
1709 				"package test;\n" +
1710 				"import static test.One.arrayList;\n" +
1711 				"public class Three extends Two { public static void test(String s) { arrayList(s); } }\n",
1712 			},
1713 			"----------\n" +
1714 			"1. ERROR in test\\Three.java (at line 3)\n" +
1715 			"	public class Three extends Two { public static void test(String s) { arrayList(s); } }\n" +
1716 			"	                                                                     ^^^^^^^^^\n" +
1717 			"The method arrayList(int) in the type Two is not applicable for the arguments (String)\n" +
1718 			"----------\n"
1719 			// arrayList(int) in test.Two cannot be applied to (java.lang.String)
1720 		);
1721 		this.runNegativeTest(
1722 			new String[] {
1723 				"test/One.java",
1724 				"package test;\n" +
1725 				"public class One { public static void arrayList(String s) {} }\n",
1726 				"test/Two.java",
1727 				"package test;\n" +
1728 				"public class Two { public static void arrayList(int i) {} }\n",
1729 				"test/Three.java",
1730 				"package test;\n" +
1731 				"import static test.One.arrayList;\n" +
1732 				"public class Three extends Two { public static void test(String s) { arrayList(s); } }\n",
1733 			},
1734 			"----------\n" +
1735 			"1. ERROR in test\\Three.java (at line 3)\n" +
1736 			"	public class Three extends Two { public static void test(String s) { arrayList(s); } }\n" +
1737 			"	                                                                     ^^^^^^^^^\n" +
1738 			"The method arrayList(int) in the type Two is not applicable for the arguments (String)\n" +
1739 			"----------\n"
1740 			// arrayList(int) in test.Two cannot be applied to (java.lang.String)
1741 		);
1742 	}
1743 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=133737
test046()1744 	public void test046() {
1745 		this.runNegativeTest(
1746 			new String[] {
1747 				"error/Exporter.java",
1748 				"package error;\n" +
1749 				"public class Exporter {\n" +
1750 				"  public static String getName(Class<?> c) {\n" +
1751 				"    return null;\n" +
1752 				"  }\n" +
1753 				"}",
1754 				"error/Importer.java",
1755 				"package error;\n" +
1756 				"import static error.Exporter.getName;\n" +
1757 				"public class Importer extends Base {\n" +
1758 				"  public void testSomething() {\n" +
1759 				"    getName();\n" +
1760 				"    getName(Importer.class);\n" +
1761 				"  }\n" +
1762 				"}",
1763 				"error/Base.java",
1764 				"package error;\n" +
1765 				"public class Base {\n" +
1766 				"  public String getName() {\n" +
1767 				"    return \"name\";\n" +
1768 				"  }\n" +
1769 				"}"
1770 			},
1771 			"----------\n" +
1772 			"1. ERROR in error\\Importer.java (at line 6)\n" +
1773 			"	getName(Importer.class);\n" +
1774 			"	^^^^^^^\n" +
1775 			"The method getName() in the type Base is not applicable for the arguments (Class<Importer>)\n" +
1776 			"----------\n"
1777 		);
1778 	}
1779 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165069
1780 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165081
test047()1781 	public void test047() {
1782 		this.runNegativeTest(
1783 			new String[] {
1784 				"sample/X.java",
1785 				"package sample;\n" +
1786 				"import static sample.X.TestEnum.V1;\n" +
1787 				"import static sample.X.TestEnum.V2;\n" +
1788 				"\n" +
1789 				"public class X<T> {\n" +
1790 				"        public static enum TestEnum {\n" +
1791 				"                V1,\n" +
1792 				"                V2\n" +
1793 				"        }\n" +
1794 				"\n" +
1795 				"        public void test(final TestEnum value) {\n" +
1796 				"                switch (value) {\n" +
1797 				"                        case V1:\n" +
1798 				"                        case V2:\n" +
1799 				"                }\n" +
1800 				"        }\n" +
1801 				"\n" +
1802 				"        public void ref() {\n" +
1803 				"               final TestEnum v1 = TestEnum.V1;\n" +
1804 				"               final TestEnum v2 = TestEnum.V2;\n" +
1805 				"				int i;\n" +
1806 				"				i++;\n" +
1807 				"        }\n" +
1808 				"}", // =================
1809 			},
1810 			"----------\n" +
1811 			"1. WARNING in sample\\X.java (at line 2)\n" +
1812 			"	import static sample.X.TestEnum.V1;\n" +
1813 			"	              ^^^^^^^^^^^^^^^^^^^^\n" +
1814 			"The import sample.X.TestEnum.V1 is never used\n" +
1815 			"----------\n" +
1816 			"2. WARNING in sample\\X.java (at line 3)\n" +
1817 			"	import static sample.X.TestEnum.V2;\n" +
1818 			"	              ^^^^^^^^^^^^^^^^^^^^\n" +
1819 			"The import sample.X.TestEnum.V2 is never used\n" +
1820 			"----------\n" +
1821 			"3. ERROR in sample\\X.java (at line 22)\n" +
1822 			"	i++;\n" +
1823 			"	^\n" +
1824 			"The local variable i may not have been initialized\n" +
1825 			"----------\n");
1826 	}
1827 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165069 - variation
1828 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165081 - variation
test048()1829 	public void test048() {
1830 		this.runNegativeTest(
1831 			new String[] {
1832 				"sample/X.java",
1833 				"package sample;\n" +
1834 				"import static sample.X.TestEnum.*;\n" +
1835 				"\n" +
1836 				"public class X<T> {\n" +
1837 				"        public static enum TestEnum {\n" +
1838 				"                V1,\n" +
1839 				"                V2\n" +
1840 				"        }\n" +
1841 				"\n" +
1842 				"        public void test(final TestEnum value) {\n" +
1843 				"                switch (value) {\n" +
1844 				"                        case V1:\n" +
1845 				"                        case V2:\n" +
1846 				"                }\n" +
1847 				"        }\n" +
1848 				"\n" +
1849 				"        public void ref() {\n" +
1850 				"               final TestEnum v1 = TestEnum.V1;\n" +
1851 				"               final TestEnum v2 = TestEnum.V2;\n" +
1852 				"				int i;\n" +
1853 				"				i++;\n" +
1854 				"        }\n" +
1855 				"}", // =================
1856 			},
1857 			"----------\n" +
1858 			"1. WARNING in sample\\X.java (at line 2)\n" +
1859 			"	import static sample.X.TestEnum.*;\n" +
1860 			"	              ^^^^^^^^^^^^^^^^^\n" +
1861 			"The import sample.X.TestEnum is never used\n" +
1862 			"----------\n" +
1863 			"2. ERROR in sample\\X.java (at line 21)\n" +
1864 			"	i++;\n" +
1865 			"	^\n" +
1866 			"The local variable i may not have been initialized\n" +
1867 			"----------\n");
1868 	}
1869 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165081 - variation
test049()1870 	public void test049() {
1871 		this.runNegativeTest(
1872 			new String[] {
1873 				"sample/X.java",
1874 				"package sample;\n" +
1875 				"import static sample.X.*;\n" +
1876 				"public class X {\n" +
1877 				"	public class Member {}\n" +
1878 				"	public void ref() {\n" +
1879 				"		int i;\n" +
1880 				"		i++;\n" +
1881 				"	}\n" +
1882 				"}", // =================
1883 			},
1884 			"----------\n" +
1885 			"1. WARNING in sample\\X.java (at line 2)\n" +
1886 			"	import static sample.X.*;\n" +
1887 			"	              ^^^^^^^^\n" +
1888 			"The import sample.X is never used\n" +
1889 			"----------\n" +
1890 			"2. ERROR in sample\\X.java (at line 7)\n" +
1891 			"	i++;\n" +
1892 			"	^\n" +
1893 			"The local variable i may not have been initialized\n" +
1894 			"----------\n");
1895 	}
1896 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=187329
test050()1897 	public void test050() {
1898 		this.runConformTest(
1899 			new String[] {
1900 				"p/A.java",
1901 				"package p;\n" +
1902 				"import static p.B.bar3;\n" +
1903 				"public class A { int a = bar3; }" ,
1904 				"p/B.java",
1905 				"package p;\n" +
1906 				"import static p.Util.someStaticMethod;\n" +
1907 				"public class B {\n" +
1908 				"	static final int bar = someStaticMethod();\n" +
1909 				"	static final int bar2 = someStaticMethod();\n" +
1910 				"	static final int bar3 = someStaticMethod();\n" +
1911 				"}" ,
1912 				"p/C.java",
1913 				"package p;\n" +
1914 				"import static p.B.bar;\n" +
1915 				"public class C { int c = bar; }" ,
1916 				"p/Util.java",
1917 				"package p;\n" +
1918 				"class Util { static int someStaticMethod() { return 0; } }"
1919 			},
1920 			"");
1921 	}
1922 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=207433
test051()1923 	public void test051() {
1924 		this.runConformTest(
1925 			new String[] {
1926 				"p/X.java",
1927 				"package p;\n" +
1928 				"import static r.Y.Z;\n" +
1929 				"import q.*;\n" +
1930 				"public class X<T> extends Z<T> {\n" +
1931 				"   Z<T> getZ() { return null; } \n" +
1932 				"	void bar() {\n" +
1933 				"		System.out.println(getZ().value);\n" +
1934 				"	}\n" +
1935 				"}\n",
1936 				"q/Z.java",
1937 				"package q;\n" +
1938 				"import r.Y;\n" +
1939 				"public class Z<T> extends Y<T> {\n" +
1940 				"}\n",
1941 				"r/Y.java",
1942 				"package r;\n" +
1943 				"public class Y<T> {\n" +
1944 				"	public static String foo;\n" +
1945 				"	public String value;\n" +
1946 				"	public static String Z;\n" +
1947 				"}\n" ,
1948 			},
1949 			"");
1950 	}
1951 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=207433 - variation
test052()1952 	public void test052() {
1953 		this.runConformTest(
1954 			new String[] {
1955 				"p/X.java",
1956 				"package p;\n" +
1957 				"import static r.Y.*;\n" +
1958 				"import q.*;\n" +
1959 				"public class X<T> extends Z<T> {\n" +
1960 				"   Z<T> getZ() { return null; } \n" +
1961 				"	void bar() {\n" +
1962 				"		System.out.println(getZ().value);\n" +
1963 				"	}\n" +
1964 				"}\n",
1965 				"q/Z.java",
1966 				"package q;\n" +
1967 				"import r.Y;\n" +
1968 				"public class Z<T> extends Y<T> {\n" +
1969 				"}\n",
1970 				"r/Y.java",
1971 				"package r;\n" +
1972 				"public class Y<T> {\n" +
1973 				"	public static String foo;\n" +
1974 				"	public String value;\n" +
1975 				"	public static String Z;\n" +
1976 				"}\n" ,
1977 			},
1978 			"");
1979 	}
1980 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=207433 - variation
test053()1981 	public void test053() {
1982 		this.runConformTest(
1983 			new String[] {
1984 				"p/X.java",
1985 				"package p;\n" +
1986 				"import static q.Y.foo;\n" +
1987 				"public class X extends Z {\n" +
1988 				"   Z getZ() { return null; } \n" +
1989 				"	void bar() {\n" +
1990 				"		System.out.println(getZ().value);\n" +
1991 				"	}\n" +
1992 				"}\n",
1993 				"p/Z.java",
1994 				"package p;\n" +
1995 				"import q.Y;\n" +
1996 				"public class Z extends Y {\n" +
1997 				"}\n",
1998 				"q/Y.java",
1999 				"package q;\n" +
2000 				"public class Y {\n" +
2001 				"	public static int foo;\n" +
2002 				"	public int value;\n" +
2003 				"}\n" ,
2004 			},
2005 			"");
2006 	}
2007 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=193210
test055()2008 	public void test055() {
2009 		this.runConformTest(
2010 				new String[] {
2011 					"p/X.java",
2012 					"package p;\n" +
2013 					"import static r.Y.Z;\n" +
2014 					"import q.*;\n" +
2015 					"import r.*;\n" +
2016 					"public class X<T> extends Z<T> {\n" +
2017 					"   V<T> getV() { return null; } \n" +
2018 					"	void bar() {\n" +
2019 					"		System.out.println(getV().value);\n" +
2020 					"	}\n" +
2021 					"}\n",
2022 					"q/Z.java",
2023 					"package q;\n" +
2024 					"import r.Y;\n" +
2025 					"public class Z<T> extends Y<T> {\n" +
2026 					"}\n",
2027 					"r/Y.java",
2028 					"package r;\n" +
2029 					"public class Y<T> extends V<T>{\n" +
2030 					"	public static class Z<U> {}\n" +
2031 					"}\n" ,
2032 					"r/V.java",
2033 					"package r;\n" +
2034 					"public class V<T> {\n" +
2035 					"	public Runnable value;\n" +
2036 					"}\n" ,
2037 				},
2038 				"");
2039 		}
2040 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=193210 - variation
test056()2041 	public void test056() {
2042 		this.runNegativeTest(
2043 				new String[] {
2044 					"p/X.java",
2045 					"package p;\n" +
2046 					"import static r.Y.Z;\n" +
2047 					"import q.*;\n" +
2048 					"public class X extends Z {\n" +
2049 					"   Z getZ() { return null; } \n" +
2050 					"	void bar() {\n" +
2051 					"		System.out.println(getZ().value);\n" +
2052 					"	}\n" +
2053 					"}\n",
2054 					"q/Z.java",
2055 					"package q;\n" +
2056 					"import r.Y;\n" +
2057 					"public class Z extends Y {\n" +
2058 					"}\n",
2059 					"r/Y.java",
2060 					"package r;\n" +
2061 					"public class Y extends V{\n" +
2062 					"	public static class Z {}\n" +
2063 					"}\n" ,
2064 					"r/V.java",
2065 					"package r;\n" +
2066 					"public class V {\n" +
2067 					"	public Runnable value;\n" +
2068 					"}\n" ,
2069 				},
2070 				"----------\n" +
2071 				"1. ERROR in p\\X.java (at line 7)\n" +
2072 				"	System.out.println(getZ().value);\n" +
2073 				"	                          ^^^^^\n" +
2074 				"value cannot be resolved or is not a field\n" +
2075 				"----------\n");
2076 		}
2077 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=193210 - variation
test057()2078 	public void test057() {
2079 		this.runNegativeTest(
2080 				new String[] {
2081 					"p/X.java",
2082 					"package p;\n" +
2083 					"import static r.Y.Z;\n" +
2084 					"import q.*;\n" +
2085 					"public class X<T> extends Z<T> {\n" +
2086 					"   Z<T> getZ() { return null; } \n" +
2087 					"	void bar() {\n" +
2088 					"		System.out.println(getZ().value);\n" +
2089 					"	}\n" +
2090 					"}\n",
2091 					"q/Z.java",
2092 					"package q;\n" +
2093 					"import r.Y;\n" +
2094 					"public class Z<T> extends Y<T> {\n" +
2095 					"}\n",
2096 					"r/Y.java",
2097 					"package r;\n" +
2098 					"public class Y<T> extends V<T>{\n" +
2099 					"	public static class Z {}\n" +
2100 					"}\n" ,
2101 					"r/V.java",
2102 					"package r;\n" +
2103 					"public class V<T> {\n" +
2104 					"	public Runnable value;\n" +
2105 					"}\n" ,
2106 				},
2107 				"----------\n" +
2108 				"1. ERROR in p\\X.java (at line 4)\n" +
2109 				"	public class X<T> extends Z<T> {\n" +
2110 				"	                          ^\n" +
2111 				"The type Y.Z is not generic; it cannot be parameterized with arguments <T>\n" +
2112 				"----------\n" +
2113 				"2. ERROR in p\\X.java (at line 5)\n" +
2114 				"	Z<T> getZ() { return null; } \n" +
2115 				"	^\n" +
2116 				"The type Y.Z is not generic; it cannot be parameterized with arguments <T>\n" +
2117 				"----------\n" +
2118 				"3. ERROR in p\\X.java (at line 7)\n" +
2119 				"	System.out.println(getZ().value);\n" +
2120 				"	                   ^^^^\n" +
2121 				"The method getZ() is undefined for the type X<T>\n" +
2122 				"----------\n");
2123 		}
2124 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=216930
test058()2125 	public void test058() {
2126 		this.runConformTest(
2127 			new String[] {
2128 				"p/X.java",
2129 				"package p;\n" +
2130 				"import static p.A.a;\n" +
2131 				"public class X {\n" +
2132 				"   void foo(W w) { a(w).a(w); }\n" +
2133 				"}\n",
2134 				"p/A.java",
2135 				"package p;\n" +
2136 				"public class A {\n" +
2137 				"   public static A a(W... w) { return null; }\n" +
2138 				"   public A a(W w) { return null; }\n" +
2139 				"}\n",
2140 				"p/W.java",
2141 				"package p;\n" +
2142 				"public class W {}\n"
2143 			},
2144 			"");
2145 		}
2146 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211
test059()2147 	public void test059() {
2148 		this.runConformTest(
2149 			new String[] {
2150 				"p/X.java",
2151 				"package p;\n" +
2152 				"import static q.A.a;\n" +
2153 				"public class X {\n" +
2154 				"}\n",
2155 				"q/A.java",
2156 				"package q;\n" +
2157 				"interface I {\n" +
2158 				"	String a = \"\";\n" +
2159 				"}\n" +
2160 				"class B {\n" +
2161 				"	public static String a;\n" +
2162 				"}\n" +
2163 				"public class A extends B implements I{\n" +
2164 				"}\n",
2165 			},
2166 			"");
2167 		}
2168 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211 - variation
test060()2169 	public void test060() {
2170 		this.runConformTest(
2171 			new String[] {
2172 				"p/X.java",
2173 				"package p;\n" +
2174 				"import static q.A.a;\n" +
2175 				"public class X {\n" +
2176 				"}\n",
2177 				"q/A.java",
2178 				"package q;\n" +
2179 				"interface I {\n" +
2180 				"	String a(Object o);\n" +
2181 				"}\n" +
2182 				"class B {\n" +
2183 				"	public static void a(){}\n" +
2184 				"}\n" +
2185 				"public abstract class A extends B implements I{\n" +
2186 				"}\n",
2187 			},
2188 			"");
2189 		}
2190 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211 - variation
test061()2191 	public void test061() {
2192 		runConformTest(
2193 			// test directory preparation
2194 			true /* flush output directory */,
2195 			new String[] { /* test files */
2196 				"p/X.java",
2197 				"package p;\n" +
2198 				"import static q.A.a;\n" +
2199 				"public class X {\n" +
2200 				"}\n",
2201 				"q/A.java",
2202 				"package q;\n" +
2203 				"interface I {\n" +
2204 				"	String a = \"\";\n" +
2205 				"}\n" +
2206 				"interface B {\n" +
2207 				"	String a = \"2\";\n" +
2208 				"}\n" +
2209 				"public class A implements B, I {\n" +
2210 				"}\n",
2211 			},
2212 			// compiler results
2213 			null /* do not check compiler log */,
2214 			// runtime results
2215 			"" /* expected output string */,
2216 			null /* do not check error string */,
2217 			// javac options
2218 			JavacTestOptions.DEFAULT /* javac test options */);
2219 	}
2220 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211 - variation
test062()2221 	public void test062() {
2222 		this.runNegativeTest(
2223 			new String[] {
2224 				"p/X.java",
2225 				"package p;\n" +
2226 				"import static q.A.a;\n" +
2227 				"public class X {\n" +
2228 				"}\n",
2229 				"q/A.java",
2230 				"package q;\n" +
2231 				"interface I {\n" +
2232 				"	String a(Object o);\n" +
2233 				"}\n" +
2234 				"interface B {\n" +
2235 				"	void a();\n" +
2236 				"}\n" +
2237 				"public abstract class A implements B, I{\n" +
2238 				"}\n",
2239 			},
2240 			"----------\n" +
2241 			"1. ERROR in p\\X.java (at line 2)\n" +
2242 			"	import static q.A.a;\n" +
2243 			"	              ^^^^^\n" +
2244 			"The import q.A.a cannot be resolved\n" +
2245 			"----------\n");
2246 	}
2247 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211 - variation
test063()2248 	public void test063() {
2249 		this.runNegativeTest(
2250 			new String[] {
2251 				"p/X.java",
2252 				"package p;\n" +
2253 				"import static q.A.a;\n" +
2254 				"import static q.A.b;\n" +
2255 				"public class X {\n" +
2256 				"	void test() {\n" +
2257 				"		System.out.println(a);\n" +
2258 				"		System.out.println(b);\n" +
2259 				"		System.out.println(b(1));\n" +
2260 				"	}\n" +
2261 				"}\n",
2262 				"q/A.java",
2263 				"package q;\n" +
2264 				"interface I {\n" +
2265 				"	String a = \"1\";\n" +
2266 				"	String b = \"2\";\n" +
2267 				"}\n" +
2268 				"interface J {\n" +
2269 				"	String a = \"3\";\n" +
2270 				"}\n" +
2271 				"class B {\n" +
2272 				"	public static String a = \"4\";\n" +
2273 				"	public static String b = \"5\";\n" +
2274 				"	public static String b(int i) { return \"6\"; }\n" +
2275 				"}\n" +
2276 				"public class A extends B implements J, I {}\n",
2277 			},
2278 			"----------\n" +
2279 			"1. ERROR in p\\X.java (at line 6)\n" +
2280 			"	System.out.println(a);\n" +
2281 			"	                   ^\n" +
2282 			"The field a is ambiguous\n" +
2283 			"----------\n" +
2284 			"2. ERROR in p\\X.java (at line 7)\n" +
2285 			"	System.out.println(b);\n" +
2286 			"	                   ^\n" +
2287 			"The field b is ambiguous\n" +
2288 			"----------\n",
2289 			JavacTestOptions.DEFAULT
2290 		);
2291 	}
2292 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183211 - variation
test064()2293 	public void test064() {
2294 		this.runNegativeTest(
2295 			new String[] {
2296 				"p1/X.java",
2297 				"package p1;\n" +
2298 				"import static p2.A.M;\n" +
2299 				"public class X {\n" +
2300 				"	M m;\n" +
2301 				"}\n",
2302 				"p2/A.java",
2303 				"package p2;\n" +
2304 				"interface I { class M {} }\n" +
2305 				"class B { public static class M {} }\n" +
2306 				"public class A extends B implements I {}\n",
2307 			},
2308 			"----------\n" +
2309 			"1. ERROR in p1\\X.java (at line 4)\n" +
2310 			"	M m;\n" +
2311 			"	^\n" +
2312 			"The type M is ambiguous\n" +
2313 			"----------\n",
2314 			JavacTestOptions.DEFAULT
2315 		);
2316 	}
2317 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=230026
test065()2318 	public void test065() {
2319 		this.runConformTest(
2320 			new String[] {
2321 				"X.java",
2322 				"import static p.I.E.C;\n" +
2323 				"\n" +
2324 				"class C {}\n" +
2325 				"class B<T> {}\n" +
2326 				"public class X extends B<C>{\n" +
2327 				"}",
2328 				"p/I.java",
2329 				"package p;\n" +
2330 				"\n" +
2331 				"public interface I <T extends Object> {\n" +
2332 				"	enum E { C }\n" +
2333 				"}",
2334 			},
2335 			""
2336 		);
2337 	}
2338 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=230026 - variation
test066()2339 	public void test066() {
2340 		this.runConformTest(
2341 			new String[] {
2342 				"X.java",
2343 				"import static p.I.E.C;\n" +
2344 				"\n" +
2345 				"class C {}\n" +
2346 				"class B<T> {}\n" +
2347 				"public class X extends B<C>{\n" +
2348 				"}",
2349 				"p/I.java",
2350 				"package p;\n" +
2351 				"\n" +
2352 				"public interface I <T extends Object> {\n" +
2353 				"	enum E { ; public static void C(){} }\n" +
2354 				"}",
2355 			},
2356 			""
2357 		);
2358 	}
2359 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=230026 - variation
test067()2360 	public void test067() {
2361 		this.runNegativeTest(
2362 			new String[] {
2363 				"X.java",
2364 				"import static p.I.E.C;\n" +
2365 				"\n" +
2366 				"class C {}\n" +
2367 				"class B<T> {}\n" +
2368 				"public class X extends B<C>{\n" +
2369 				"}",
2370 				"p/I.java",
2371 				"package p;\n" +
2372 				"\n" +
2373 				"public interface I <T extends Object> {\n" +
2374 				"	enum E { ; static void C(){} }\n" +
2375 				"}",
2376 			},
2377 			"----------\n" +
2378 			"1. ERROR in X.java (at line 1)\n" +
2379 			"	import static p.I.E.C;\n" +
2380 			"	              ^^^^^^^\n" +
2381 			"The import p.I.E.C cannot be resolved\n" +
2382 			"----------\n");
2383 	}
2384 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=230026 - variation
test068()2385 	public void test068() {
2386 		this.runConformTest(
2387 			new String[] {
2388 				"X.java",
2389 				"import static p.I.E.C;\n" +
2390 				"class C {}\n" +
2391 				"class B<T> {}\n" +
2392 				"public class X extends B<C>{\n" +
2393 				"	static void test() { int i = C; }\n" +
2394 				"}",
2395 				"p/I.java",
2396 				"package p;\n" +
2397 				"public interface I<T extends Object> {\n" +
2398 				"	public static class E extends F {}\n" +
2399 				"	public static class F { public static int C; }\n" +
2400 				"}",
2401 			},
2402 			"");
2403 	}
2404 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=230026 - variation
test069()2405 	public void test069() {
2406 		this.runConformTest(
2407 			new String[] {
2408 				"X.java",
2409 				"import static p.I.E.C;\n" +
2410 				"class C {}\n" +
2411 				"class B<T> {}\n" +
2412 				"public class X extends B<C>{\n" +
2413 				"	static void test() { C(); }\n" +
2414 				"}",
2415 				"p/I.java",
2416 				"package p;\n" +
2417 				"public interface I<T extends Object> {\n" +
2418 				"	public static class E extends F {}\n" +
2419 				"	public static class F { public static void C() {} }\n" +
2420 				"}",
2421 			},
2422 			"");
2423 	}
2424 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211
test070()2425 	public void test070() {
2426 		this.runConformTest(
2427 			new String[] {
2428 				"node/Test.java",//------------------------------
2429 				"package node;\n" +
2430 				"public class Test {\n" +
2431 				"        public static void node() {}\n" +
2432 				"}\n",
2433 				"node2/Test2.java",//------------------------------
2434 				"package node2;\n" +
2435 				"import static node.Test.node;\n" +
2436 				"public class Test2 {\n" +
2437 				"}\n",
2438 			},
2439 			"");
2440 	}
2441 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation
test071()2442 	public void test071() {
2443 		this.runNegativeTest(
2444 			new String[] {
2445 				"node/Test/node.java",//------------------------------
2446 				"package node.Test;\n" +
2447 				"public class node {\n" +
2448 				"}\n",
2449 				"node/Test.java",//------------------------------
2450 				"package node;\n" +
2451 				"public class Test {\n" +
2452 				"        public static void node() {}\n" +
2453 				"}\n",
2454 				"node2/Test2.java",//------------------------------
2455 				"package node2;\n" +
2456 				"import node.Test;\n" +
2457 				"import static Test.node;\n" +
2458 				"public class Test2 {\n" +
2459 				"}\n",
2460 			},
2461 			"----------\n" +
2462 			"1. ERROR in node\\Test.java (at line 2)\n" +
2463 			"	public class Test {\n" +
2464 			"	             ^^^^\n" +
2465 			"The type Test collides with a package\n" +
2466 			"----------\n" +
2467 			"----------\n" +
2468 			"1. ERROR in node2\\Test2.java (at line 3)\n" +
2469 			"	import static Test.node;\n" +
2470 			"	              ^^^^\n" +
2471 			"The import Test cannot be resolved\n" +
2472 			"----------\n");
2473 	}
2474 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=93913 - variation
test072()2475 	public void test072() {
2476 		this.runNegativeTest(
2477 			new String[] {
2478 				"p1/A.java",
2479 				"package p1;\n" +
2480 				"import static p2.C.B;\n" +
2481 				"public class A extends B {\n" +
2482 				"	void test() {" +
2483 				"		int i = B;\n" +
2484 				"		B b = null;\n" +
2485 				"		int v1 = b.fooB;\n" +
2486 				"		int v2 = b.fooC;\n" +
2487 				"		int v3 = fooC;\n" +
2488 				"	}\n" +
2489 				"}\n",
2490 				"p1/B.java",
2491 				"package p1;\n" +
2492 				"public class B {\n" +
2493 				"	public int fooB;\n" +
2494 				"}\n",
2495 				"p2/C.java",
2496 				"package p2;\n" +
2497 				"public class C {\n" +
2498 				"	public static class B { public int fooC; }\n" +
2499 				"	public static int B;\n" +
2500 				"}\n",
2501 			},
2502 			"----------\n" +
2503 			"1. ERROR in p1\\A.java (at line 6)\n" +
2504 			"	int v1 = b.fooB;\n" +
2505 			"	           ^^^^\n" +
2506 			"fooB cannot be resolved or is not a field\n" +
2507 			"----------\n");
2508 	}
2509 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375
test073()2510 	public void test073() {
2511 		this.runNegativeTest(
2512 			new String[] {
2513 				"test/Outer.java",
2514 				"package test;\n" +
2515 				"import static test.Outer.Inner.VALUE;\n" +
2516 				"public class Outer {\n" +
2517 				"    int i = VALUE;\n" +
2518 				"    int i2 = Inner.VALUE;\n" +
2519 				"    static class Inner {\n" +
2520 				"        private static final int VALUE = 0;\n" +
2521 				"    }\n" +
2522 				"}\n",
2523 			},
2524 			"----------\n" +
2525 			"1. ERROR in test\\Outer.java (at line 2)\n" +
2526 			"	import static test.Outer.Inner.VALUE;\n" +
2527 			"	              ^^^^^^^^^^^^^^^^^^^^^^\n" +
2528 			"The field Outer.Inner.test.Outer.Inner.VALUE is not visible\n" +
2529 			"----------\n" +
2530 			"2. ERROR in test\\Outer.java (at line 4)\n" +
2531 			"	int i = VALUE;\n" +
2532 			"	        ^^^^^\n" +
2533 			"VALUE cannot be resolved to a variable\n" +
2534 			"----------\n");
2535 	}
2536 	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375 - variation
test074()2537 	public void test074() {
2538 		this.runConformTest(
2539 			new String[] {
2540 				"test/Outer.java",
2541 				"package test;\n" +
2542 				"import static test.Outer.Inner.*;\n" +
2543 				"public class Outer {\n" +
2544 				"    int i = VALUE;\n" +
2545 				"    int i2 = Inner.VALUE;\n" +
2546 				"    static class Inner {\n" +
2547 				"        private static final int VALUE = 0;\n" +
2548 				"    }\n" +
2549 				"}\n",
2550 			},
2551 			"");
2552 	}
2553 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
2554 	// To verify that a static import importing a type which has already been
2555 	// imported by a single type import is reported as duplicate
2556 	// while the other static members imported by it are not shadowed.
test075()2557 	public void test075() {
2558 		this.runNegativeTest(
2559 			new String[] {
2560 				"A/A.java",
2561 				"package A;\n" +
2562 				"import B.B.C1;\n" +
2563 				"import static B.B.C1;\n" +
2564 				"public abstract class A {\n" +
2565 				"	protected void A1(Object task) {\n" +
2566 				"		C1 c = C1(task);\n" +
2567 				"	}\n" +
2568 				"}\n",
2569 				"B/B.java",
2570 				"package B;\n" +
2571 				"final public class B {\n" +
2572 				"	private B() {}\n" +
2573 				"	public static class C1 {}\n" +
2574 				"	public static C1 C1(Object o) {\n" +
2575 				"		return new C1();\n" +
2576 				"	}\n" +
2577 				"}\n",
2578 			},
2579 			""
2580 		);
2581 	}
2582 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
2583 	// To verify that a static import importing a static method doesn't collide
2584 	// with a single type import importing a non-static type with the same name as the method
test076()2585 	public void test076() {
2586 		this.runConformTest(
2587 			new String[] {
2588 				"A/A.java",
2589 				"package A;\n" +
2590 				"import B.B.C1;\n" +
2591 				"import static B.B.C1;\n" +
2592 				"public class A {\n" +
2593 				"	protected void A1(Object task) {\n" +
2594 				"		C1 c1;\n" +
2595 				"		int c = C1(task);\n" +
2596 				"	}\n" +
2597 				"}\n",
2598 				"B/B.java",
2599 				"package B;\n" +
2600 				"final public class B {\n" +
2601 				"	private B() {}\n" +
2602 				"	public class C1 {}\n" +
2603 				"	public static int C1(Object o) {\n" +
2604 				"		return 1;\n" +
2605 				"	}\n" +
2606 				"}\n",
2607 			},
2608 			"");
2609 	}
2610 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
2611 	// To verify that two static imports importing the same type don't collide
test077()2612 	public void test077() {
2613 		this.runConformTest(
2614 			new String[] {
2615 				"p1/X.java",
2616 				"package p1;\n" +
2617 				"import p2.A;\n" +
2618 				"import static p2.A.C;\n" +
2619 				"import static p1.B.C;\n" +
2620 				"public class X {\n" +
2621 				"	public static void main(String[] args) {\n" +
2622 				"		foo();\n" +
2623 				"	}\n" +
2624 				"	public static void foo() {\n" +
2625 				"		if (C.CONST == 1) {\n" +
2626 				"			System.out.println(\"SUCCESS\");\n" +
2627 				"			return;\n" +
2628 				"		}\n" +
2629 				"		System.out.println(\"FAILED\");\n" +
2630 				"	}\n" +
2631 				"}\n" +
2632 				"class B extends A {}",
2633 				"p2/A.java",
2634 				"package p2;\n" +
2635 				"public class A {\n" +
2636 				"	public static class C {\n" +
2637 				"		public static int CONST = 1;\n" +
2638 				"	}\n" +
2639 				"}"
2640 			},
2641 			"SUCCESS");
2642 	}
2643 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
2644 	// To verify that a static import importing a type which has already been
2645 	// imported by a single type import is reported as duplicate
2646 	// while the other static members imported by it are not shadowed.
test078()2647 	public void test078() {
2648 		this.runNegativeTest(
2649 			new String[] {
2650 				"A/A.java",
2651 				"package A;\n" +
2652 				"import static B.B.C1;\n" +
2653 				"import B.B.C1;\n" +
2654 				"public abstract class A {\n" +
2655 				"	protected void A1(Object task) {\n" +
2656 				"		C1 c = C1(task);\n" +
2657 				"	}\n" +
2658 				"}\n",
2659 				"B/B.java",
2660 				"package B;\n" +
2661 				"final public class B {\n" +
2662 				"	private B() {}\n" +
2663 				"	public static class C1 {}\n" +
2664 				"	public static C1 C1(Object o) {\n" +
2665 				"		return new C1();\n" +
2666 				"	}\n" +
2667 				"}\n",
2668 			},
2669 			"----------\n" +
2670 			"1. ERROR in A\\A.java (at line 3)\n" +
2671 			"	import B.B.C1;\n" +
2672 			"	       ^^^^^^\n" +
2673 			"The import B.B.C1 collides with another import statement\n" +
2674 			"----------\n"
2675 		);
2676 	}
2677 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
2678 	// To verify that a static import importing a type which has already been
2679 	// imported by a single type import is not reported as duplicate
2680 	// if they are just the same type
test079()2681 	public void test079() {
2682 		this.runNegativeTest(
2683 			new String[] {
2684 				"A/A.java",
2685 				"package A;\n" +
2686 				"import static B.B.C1;\n" +
2687 				"import B.B.C1;\n" +
2688 				"public abstract class A {\n" +
2689 				"	protected void A1(C1 c) {\n" +
2690 				"	}\n" +
2691 				"}\n",
2692 				"B/B.java",
2693 				"package B;\n" +
2694 				"final public class B {\n" +
2695 				"	public static class C1 {}\n" +
2696 				"}\n",
2697 			},
2698 			"----------\n" +
2699 			"1. WARNING in A\\A.java (at line 2)\n" +
2700 			"	import static B.B.C1;\n" +
2701 			"	              ^^^^^^\n" +
2702 			"The import B.B.C1 is never used\n" +
2703 			"----------\n"
2704 		);
2705 	}
2706 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=336934
test080()2707 	public void test080() {
2708 		this.runNegativeTest(
2709 			new String[] {
2710 				"a/B.java",
2711 				"package a;\n" +
2712 				"public class B {}",
2713 				"external/Lib.java",
2714 				"package external;\n" +
2715 				"public class Lib {\n" +
2716 				"	public static void m() {}\n" +
2717 				"}",
2718 				"a/B/C.java",
2719 				"package a.B;\n" +
2720 				"import static external.Lib.m;\n" +
2721 				"public class C {\n" +
2722 				"	public void main() {\n" +
2723 				"		m();\n" +
2724 				"	}\n" +
2725 				"}"
2726 			},
2727 			"----------\n" +
2728 			"1. ERROR in a\\B\\C.java (at line 1)\n" +
2729 			"	package a.B;\n" +
2730 			"	        ^^^\n" +
2731 			"The package a.B collides with a type\n" +
2732 			"----------\n"
2733 		);
2734 	}
2735 
2736 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
test081()2737 	public void test081() {
2738 		this.runConformTest(
2739 			new String[] {
2740 				"Test.java",
2741 				"import static p1.Bar.B;\n" +
2742 				"import p3.Foo.*;\n" +
2743 				"public class Test {\n" +
2744 				"	public static void main(String [] args){\n" +
2745 				"		new Test().beginTest();" +
2746 				"	}\n" +
2747 				"	public void beginTest(){\n" +
2748 				"		System.out.print(\"1 + 1 =  \");\n" +
2749 				"		if(alwaysTrue()) System.out.println(\"2\");\n" +
2750 				"		else System.out.println(\"3\"); " +
2751 				"	}\n" +
2752 				"	public boolean alwaysTrue(){\n" +
2753 				"		String myB   =        B.class.getCanonicalName();;\n" +		// refers to p1.Bar.B (class)
2754 				"		String realB = p1.Bar.B.class.getCanonicalName();;\n" +     // refers to p1.Bar.B (class)
2755 				"		B();\n" +				// refers to p1.Bar.B() (method)
2756 				"		return myB.equals(realB);\n" +
2757 				"	}\n" +
2758 				"}\n",
2759 				"p1/Bar.java",
2760 				"package p1;\n" +
2761 				"public class Bar{\n" +
2762 				"	public static class B{}\n" +
2763 				"	final public static String B = new String(\"random\");\n" +
2764 				"	public static void B(){}\n" +
2765 				"}\n",
2766 				"p3/Foo.java",
2767 				"package p3;\n" +
2768 				"public class Foo {\n" +
2769 				"	public class B{\n" +
2770 				"		public int a;\n" +
2771 				"	}\n" +
2772 				"}\n"
2773 			},
2774 			"1 + 1 =  2");
2775 	}
2776 
2777 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
test082()2778 	public void test082() {
2779 		this.runNegativeTest(
2780 			new String[] {
2781 				"p1/Bar.java",
2782 				"package p1;\n" +
2783 				"public class Bar{\n" +
2784 				"	public static class B{}\n" +
2785 				"	final public static String B = new String(\"random\");\n" +
2786 				"	public static void B(){}\n" +
2787 				"}\n",
2788 				"p3/Foo.java",
2789 				"package p3;\n" +
2790 				"public class Foo {\n" +
2791 				"	public class B{\n" +
2792 				"		public int a;\n" +
2793 				"	}\n" +
2794 				"}\n",
2795 				"p2/Test.java",
2796 				"package p2;\n" +
2797 				"import static p1.Bar.B;\n" +
2798 				"import p3.Foo.*;\n" +
2799 				"public class Test {\n" +
2800 				"	public static void main(String [] args){\n" +
2801 				"		new Test().beginTest();" +
2802 				"	}\n" +
2803 				"	public void beginTest(){\n" +
2804 				"		System.out.print(\"1 + 1 =  \");\n" +
2805 				"		if(alwaysTrue()) System.out.println(\"2\");\n" +
2806 				"		else System.out.println(\"3\"); " +
2807 				"	}\n" +
2808 				"	public boolean alwaysTrue(){\n" +
2809 				"		B b = null;\n" +		// refers to p1.Bar.B (class)
2810 				"		String realB = B;\n" +  // refers to p1.Bar.B (field)
2811 				"		B();\n" +				// refers to p1.Bar.B() (method)
2812 				"		int abc = b.a;\n;" +	// static import for Bar.B overshadows on demand import Foo.B
2813 				"	}\n" +
2814 				"}\n",
2815 			},
2816 			"----------\n" +
2817 			"1. ERROR in p2\\Test.java (at line 15)\n" +
2818 			"	int abc = b.a;\n" +
2819 			"	            ^\n" +
2820 			"a cannot be resolved or is not a field\n" +
2821 			"----------\n");
2822 	}
2823 
2824 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
test083()2825 	public void test083() {
2826 		this.runConformTest(
2827 			new String[] {
2828 				"Test.java",
2829 				"import static p1.Bar.B;\n" +
2830 				"import p3.Foo.*;\n" +
2831 				"public class Test {\n" +
2832 				"	public static void main(String [] args){\n" +
2833 				"		new Test().test2();" +
2834 				"	}\n" +
2835 				"	public void test2(){\n" +
2836 				"		System.out.println(B.toString());\n" +		// Field obscures class B
2837 				"		System.out.println(p1.Bar.B.toString());\n" +  // Field obscures the class B
2838 				"		System.out.println(B.class.getCanonicalName().toString());\n" +	// the class B
2839 				"		System.out.println(p1.Bar.B.class.getCanonicalName().toString());" +	// class B
2840 				"	}\n" +
2841 				"}\n",
2842 				"p1/Bar.java",
2843 				"package p1;\n" +
2844 				"public class Bar{\n" +
2845 				"	public static class B{}\n" +
2846 				"	final public static String B = new String(\"random\");\n" +
2847 				"	public static void B(){}\n" +
2848 				"}\n",
2849 				"p3/Foo.java",
2850 				"package p3;\n" +
2851 				"public class Foo {\n" +
2852 				"	public class B{\n" +
2853 				"		public int a;\n" +
2854 				"	}\n" +
2855 				"}\n"
2856 			},
2857 			"random\n" +
2858 			"random\n" +
2859 			"p1.Bar.B\n" +
2860 			"p1.Bar.B");
2861 	}
2862 
2863 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
2864 	// Check if we're able to find the correct static member type being imported,
2865 	// even though the import originally resolved to the static field of the same name,
2866 	// coming from the supertype
test084()2867 	public void test084() {
2868 		this.runConformTest(
2869 			new String[] {
2870 				"Test.java",
2871 				"import static p1.Bar.B;\n" +
2872 				"import p3.Foo.*;\n" +
2873 				"public class Test {\n" +
2874 				"	public static void main(String [] args){\n" +
2875 				"		new Test().test2();" +
2876 				"	}\n" +
2877 				"	public void test2(){\n" +
2878 				"		System.out.println(B.class.getCanonicalName().toString());\n" +	// the class B
2879 				"		System.out.println(p1.Bar.B.class.getCanonicalName().toString());" +	// class B
2880 				"	}\n" +
2881 				"}\n",
2882 				"p1/Bar.java",
2883 				"package p1;\n" +
2884 				"public class Bar extends SuperBar{\n" +
2885 				"	public static class B{}\n" +
2886 				"	public static void B(){}\n" +
2887 				"}\n",
2888 				"p1/SuperBar.java",
2889 				"package p1;\n" +
2890 				"public class SuperBar {\n" +
2891 				"	final public static String B = new String(\"random\");\n" +
2892 				"}\n",
2893 				"p3/Foo.java",
2894 				"package p3;\n" +
2895 				"public class Foo {\n" +
2896 				"	public class B{\n" +
2897 				"		public int a;\n" +
2898 				"	}\n" +
2899 				"}\n"
2900 			},
2901 			"p1.Bar.B\n" +
2902 			"p1.Bar.B");
2903 	}
2904 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
2905 	// To verify that all static members are imported with a single static import statement
test085()2906 	public void test085() {
2907 		this.runNegativeTest(
2908 			new String[] {
2909 				"Test.java",
2910 				"import static p1.Bar.B;\n" +
2911 				"import static p3.Foo.B;\n" +
2912 				"public class Test {\n" +
2913 				"	public static void main(String [] args){\n" +
2914 				"		new Test().test2();" +
2915 				"	}\n" +
2916 				"	public void test2(){\n" +
2917 				"		System.out.println(B.class.getCanonicalName().toString());\n" +
2918 				"		System.out.println(p1.Bar.B.class.getCanonicalName().toString());" +
2919 				"	}\n" +
2920 				"}\n",
2921 				"p1/Bar.java",
2922 				"package p1;\n" +
2923 				"public class Bar{\n" +
2924 				"	public static class B{}\n" +
2925 				"	public static String B = new String(\"random\");\n" +
2926 				"}\n",
2927 				"p3/Foo.java",
2928 				"package p3;\n" +
2929 				"public class Foo {\n" +
2930 				"	public static class B{\n" +
2931 				"	}\n" +
2932 				"}\n"
2933 			},
2934 			this.complianceLevel < ClassFileConstants.JDK1_8 ?
2935 					"----------\n" +
2936 					"1. ERROR in Test.java (at line 2)\n" +
2937 					"	import static p3.Foo.B;\n" +
2938 					"	              ^^^^^^^^\n" +
2939 					"The import p3.Foo.B collides with another import statement\n" +
2940 					"----------\n" :
2941 						"----------\n" +
2942 						"1. ERROR in Test.java (at line 7)\n" +
2943 						"	System.out.println(B.class.getCanonicalName().toString());\n" +
2944 						"	                   ^\n" +
2945 						"The type B is ambiguous\n" +
2946 						"----------\n"
2947 
2948 				);
2949 	}
2950 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
2951 	// To verify that all static members are imported with a single static import statement,
2952 	// even from a supertype
test085a()2953 	public void test085a() {
2954 		this.runNegativeTest(
2955 			new String[] {
2956 				"Test.java",
2957 				"import static p1.Bar.B;\n" +
2958 				"import static p3.Foo.B;\n" +
2959 				"public class Test {\n" +
2960 				"	public static void main(String [] args){\n" +
2961 				"		new Test().test2();" +
2962 				"	}\n" +
2963 				"	public void test2(){\n" +
2964 				"		System.out.println(B.class.getCanonicalName().toString());\n" +
2965 				"		System.out.println(p1.Bar.B.class.getCanonicalName().toString());" +
2966 				"	}\n" +
2967 				"}\n",
2968 				"p1/Bar.java",
2969 				"package p1;\n" +
2970 				"public class Bar extends SuperBar{\n" +
2971 				"	public static void B(){}\n" +
2972 				"}\n",
2973 				"p1/SuperBar.java",
2974 				"package p1;\n" +
2975 				"public class SuperBar {\n" +
2976 				"	public static class B{}\n" +
2977 				"	final public static String B = new String(\"random\");\n" +
2978 				"}\n",
2979 				"p3/Foo.java",
2980 				"package p3;\n" +
2981 				"public class Foo {\n" +
2982 				"	public static class B{\n" +
2983 				"	}\n" +
2984 				"}\n"
2985 			},
2986 			"----------\n" +
2987 			"1. ERROR in Test.java (at line 2)\n" +
2988 			"	import static p3.Foo.B;\n" +
2989 			"	              ^^^^^^^^\n" +
2990 			"The import p3.Foo.B collides with another import statement\n" +
2991 			"----------\n");
2992 	}
2993 
2994 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
2995 	// To verify that all static members are imported with a single static import statement
2996 	// this tests checks collision with single type import
test085b()2997 	public void test085b() {
2998 		this.runNegativeTest(
2999 			new String[] {
3000 				"Test.java",
3001 				"import static p1.Bar.B;\n" +
3002 				"import p3.Foo.B;\n" +
3003 				"public class Test {\n" +
3004 				"	public static void main(String [] args){\n" +
3005 				"		new Test().test2();" +
3006 				"	}\n" +
3007 				"	public void test2(){\n" +
3008 				"		System.out.println(B.class.getCanonicalName().toString());\n" +
3009 				"		System.out.println(p1.Bar.B.class.getCanonicalName().toString());" +
3010 				"	}\n" +
3011 				"}\n",
3012 				"p1/Bar.java",
3013 				"package p1;\n" +
3014 				"public class Bar{\n" +
3015 				"	public static class B{}\n" +
3016 				"	public static String B = new String(\"random\");\n" +
3017 				"}\n",
3018 				"p3/Foo.java",
3019 				"package p3;\n" +
3020 				"public class Foo {\n" +
3021 				"	public class B{\n" +
3022 				"	}\n" +
3023 				"}\n"
3024 			},
3025 			"----------\n" +
3026 			"1. ERROR in Test.java (at line 2)\n" +
3027 			"	import p3.Foo.B;\n" +
3028 			"	       ^^^^^^^^\n" +
3029 			"The import p3.Foo.B collides with another import statement\n" +
3030 			"----------\n");
3031 	}
3032 
3033 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
3034 	// To verify that all static members are imported with a single static import statement
3035 	// this tests checks collision with top level type
test085c()3036 	public void test085c() {
3037 		this.runNegativeTest(
3038 			new String[] {
3039 				"Test.java",
3040 				"import static p1.Bar.B;\n" +
3041 				"public class Test {\n" +
3042 				"	public static void main(String [] args){\n" +
3043 				"		new Test().test2();" +
3044 				"	}\n" +
3045 				"	public void test2(){\n" +
3046 				"		System.out.println(B.class.getCanonicalName().toString());\n" +
3047 				"		System.out.println(p1.Bar.B.class.getCanonicalName().toString());" +
3048 				"	}\n" +
3049 				"}\n" +
3050 				"class B{\n" +
3051 				"}\n",
3052 				"p1/Bar.java",
3053 				"package p1;\n" +
3054 				"public class Bar{\n" +
3055 				"	public static class B{}\n" +
3056 				"	public static String B = new String(\"random\");\n" +
3057 				"}\n",
3058 			},
3059 			"----------\n" +
3060 			"1. ERROR in Test.java (at line 1)\n" +
3061 			"	import static p1.Bar.B;\n" +
3062 			"	              ^^^^^^^^\n" +
3063 			"The import p1.Bar.B conflicts with a type defined in the same file\n" +
3064 			"----------\n");
3065 	}
3066 
3067 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
3068 	// Test obscuring rules defined in JLS 7.5.3
test086()3069 	public void test086() {
3070 		this.runConformTest(
3071 			new String[] {
3072 				"Test.java",
3073 				"import static p1.Bar.B;\n" +
3074 				"import static p3.Foo.*;\n" +
3075 				"public class Test {\n" +
3076 				"	public static void main(String [] args){\n" +
3077 				"		new Test().test2();" +
3078 				"	}\n" +
3079 				"	public void test2(){\n" +
3080 				"       B();\n" + // should be p1.Bar.B() and not p3.Foo.B()
3081 				"		System.out.println(B.toString());\n" + // should be p1.Bar.B
3082 				"	}\n" +
3083 				"}\n",
3084 				"p1/Bar.java",
3085 				"package p1;\n" +
3086 				"public class Bar{\n" +
3087 				"	public static void B(){ System.out.println(\"Bar's method B\");}\n" +
3088 				"	public static String B = new String(\"Bar's field B\");\n" +
3089 				"}\n",
3090 				"p3/Foo.java",
3091 				"package p3;\n" +
3092 				"public class Foo {\n" +
3093 				"	public static void B(){ System.out.println(\"Foo's method B\");}\n" +
3094 				"	public static String B = new String(\"Foo's field B\");\n" +
3095 				"}\n"
3096 			},
3097 			"Bar\'s method B\n" +
3098 			"Bar\'s field B");
3099 	}
3100 
3101 	// https://bugs.eclipse.org/401271 - StackOverflowError when searching for a methods references
testBug401271()3102 	public void testBug401271() {
3103 		runNegativeTest(
3104 			new String[] {
3105 				"a/b/c/a.java",
3106 				"package a.b.c;\n" +
3107 				"public class a {}\n",
3108 				"a/b/c/C.java",
3109 				"package a.b.c;\n" +
3110 				"public class C {\n" +
3111 				"	public static final int a = 3;\n" +
3112 				"}\n",
3113 				"x/y/R.java",
3114 				"package x.y;\n" +
3115 				"import static a.b.c.C.a;\n" +
3116 				"//import a.b.c.a;\n" +
3117 				"\n" +
3118 				"public class R { \n" +
3119 				"	a b; \n" +
3120 				"	char h = a; \n" +
3121 				"}"
3122 			},
3123 			"----------\n" +
3124 			"1. ERROR in x\\y\\R.java (at line 6)\n" +
3125 			"	a b; \n" +
3126 			"	^\n" +
3127 			"a cannot be resolved to a type\n" +
3128 			"----------\n");
3129 	}
3130 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=426544 - [1.8][compiler] Compiler over-eagerly detects collision of single static imports
test426544()3131 	public void test426544() {
3132 		runNegativeTest(
3133 			new String[] {
3134 				"p/X.java",
3135 				"package p;\n" +
3136 				"public class X {\n" +
3137 				"    public static int f;\n" +
3138                 "    public static class C {}\n" +
3139 				"    public static class I {}\n" +
3140 				"}\n",
3141 				"q/X.java",
3142 				"package q;\n" +
3143 				"public class X {\n" +
3144 				"    public static int f;\n" +
3145 				"    public static class C {}\n" +
3146 				"    public static class I {}\n" +
3147 				"}\n",
3148 				"X.java",
3149 				"import static p.X.f;\n" +
3150 				"import static q.X.f;\n" +
3151 				"import static p.X.C;\n" +
3152 				"import static p.X.I;\n" +
3153 				"import static q.X.C;\n" +
3154 				"import static q.X.I;\n" +
3155 				"public class X { \n" +
3156 				"    { f = 0; }\n" +
3157 				"    { C c = null; }\n" +
3158 				"    { I i = null; }\n" +
3159 				"}\n"
3160 			},
3161 			this.complianceLevel < ClassFileConstants.JDK1_8 ?
3162 					"----------\n" +
3163 					"1. ERROR in X.java (at line 2)\n" +
3164 					"	import static q.X.f;\n" +
3165 					"	              ^^^^^\n" +
3166 					"The import q.X.f collides with another import statement\n" +
3167 					"----------\n" +
3168 					"2. ERROR in X.java (at line 5)\n" +
3169 					"	import static q.X.C;\n" +
3170 					"	              ^^^^^\n" +
3171 					"The import q.X.C collides with another import statement\n" +
3172 					"----------\n" +
3173 					"3. ERROR in X.java (at line 6)\n" +
3174 					"	import static q.X.I;\n" +
3175 					"	              ^^^^^\n" +
3176 					"The import q.X.I collides with another import statement\n" +
3177 					"----------\n" :
3178 						"----------\n" +
3179 						"1. ERROR in X.java (at line 8)\n" +
3180 						"	{ f = 0; }\n" +
3181 						"	  ^\n" +
3182 						"The field f is ambiguous\n" +
3183 						"----------\n" +
3184 						"2. ERROR in X.java (at line 9)\n" +
3185 						"	{ C c = null; }\n" +
3186 						"	  ^\n" +
3187 						"The type C is ambiguous\n" +
3188 						"----------\n" +
3189 						"3. ERROR in X.java (at line 10)\n" +
3190 						"	{ I i = null; }\n" +
3191 						"	  ^\n" +
3192 						"The type I is ambiguous\n" +
3193 						"----------\n");
3194 	}
3195 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=479287
3196 	// erroneous compile error using static imports and generics
testBug479287()3197 	public void testBug479287() {
3198 		this.runConformTest(
3199 			new String[] {
3200 				"joetest/GenericsIssue.java",
3201 				"package joetest;\n" +
3202 				"import static joetest.GenericsIssueCollaborator.takesAnything;\n" +
3203 				"import java.util.Collection;\n" +
3204 				"import java.util.Collections;\n" +
3205 				"public class GenericsIssue {\n" +
3206 				"	private void oddCompileError() {\n" +
3207 				"		takesAnything(returnThings(\"works without wildcard in return value\"));\n" +
3208 				"		GenericsIssueCollaborator.takesAnything(returnThingsWildcard(\"works without static import\"));\n" +
3209 				"		takesAnything(returnThingsWildcard(\"doesn\'t work with static import\"));\n" +
3210 				"	}\n" +
3211 				"	private <T> Collection<T> returnThings(T thing) {\n" +
3212 				"		return Collections.singleton(thing);\n" +
3213 				"	}\n" +
3214 				"		\n" +
3215 				"	private <T> Collection<? extends T> returnThingsWildcard(T toReturn) {\n" +
3216 				"		return Collections.singleton(toReturn);\n" +
3217 				"	}\n" +
3218 				"}",
3219 				"joetest/GenericsIssueCollaborator.java",
3220 				"package joetest;\n" +
3221 				"public class GenericsIssueCollaborator {\n" +
3222 				"	public static <T> void takesAnything(T thing) {\n" +
3223 				"		System.out.println(\"TOOK IT: \" + thing);\n" +
3224 				"	}\n" +
3225 				"}"
3226 			});
3227 	}
3228 	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=442580
3229 	// Explicit static import after two wildcard imports is ambiguous (works in javac)
testBug442580()3230 	public void testBug442580() {
3231 		this.runConformTest(new String [] {
3232 				"a/A.java",
3233 				"package a;\n" +
3234 				"\n" +
3235 				"public class A {\n" +
3236 				"	public static void foo() {\n" +
3237 				"		System.out.println(\"A.foo\");\n" +
3238 				"	}\n" +
3239 				"}",
3240 				"b/B.java",
3241 				"package b;\n" +
3242 				"\n" +
3243 				"public class B {\n" +
3244 				"	public static void foo() {\n" +
3245 				"		System.out.println(\"B.foo\");\n" +
3246 				"	}\n" +
3247 				"}",
3248 				"Test.java",
3249 				"import static a.A.*;\n" +
3250 				"import static b.B.*;\n" +
3251 				"import static b.B.foo;\n" +
3252 				"\n" +
3253 				"public class Test {\n" +
3254 				"	public static void main(String[] args) {\n" +
3255 				"		foo();\n" +
3256 				"	}\n" +
3257 				"}"
3258 		});
3259 	}
testBug520874a()3260 	public void testBug520874a() {
3261 		if (this.complianceLevel <= ClassFileConstants.JDK1_8) {
3262 			return;
3263 		}
3264 		runNegativeTest(
3265 				new String[] {
3266 						"p/X.java",
3267 						"package p;\n" +
3268 						"import static p.A1.Outer.*;\n" +
3269 						"import static p.A1.AnotherOuter.Inner;\n" +
3270 						"public class X {}\n" +
3271 						"class A1 {\n" +
3272 						"	static class Outer<T extends Inner> {\n" +
3273 						"		private static interface Inner {}\n" +
3274 						"    }\n" +
3275 						"	static class AnotherOuter {\n" +
3276 						"		private static class Inner {}\n" +
3277 						"	}\n" +
3278 						"}\n"
3279 				},
3280 				"----------\n" +
3281 				"1. ERROR in p\\X.java (at line 3)\n" +
3282 				"	import static p.A1.AnotherOuter.Inner;\n" +
3283 				"	              ^^^^^^^^^^^^^^^^^^^^^^^\n" +
3284 				"The type p.A1.AnotherOuter.Inner is not visible\n" +
3285 				"----------\n" +
3286 				"2. ERROR in p\\X.java (at line 6)\n" +
3287 				"	static class Outer<T extends Inner> {\n" +
3288 				"	                             ^^^^^\n" +
3289 				"The type Inner is not visible\n" +
3290 				"----------\n");
3291 	}
testBug520874b()3292 	public void testBug520874b() {
3293 		if (this.complianceLevel <= ClassFileConstants.JDK1_8) {
3294 			return;
3295 		}
3296 		runNegativeTest(
3297 				new String[] {
3298 						"p/X.java",
3299 						"package p;\n" +
3300 						"import p.A1.Outer.*;\n" +
3301 						"public class X {}\n" +
3302 						"class A1 {\n" +
3303 						"	static class Outer<T extends Inner> {\n" +
3304 						"		private static interface Inner {}\n" +
3305 						"    }\n" +
3306 						"}\n"
3307 				},
3308 				"----------\n" +
3309 				"1. ERROR in p\\X.java (at line 5)\n" +
3310 				"	static class Outer<T extends Inner> {\n" +
3311 				"	                             ^^^^^\n" +
3312 				"The type Inner is not visible\n" +
3313 				"----------\n");
3314 	}
testBug520874c()3315 	public void testBug520874c() {
3316 		if (this.complianceLevel <= ClassFileConstants.JDK1_8) {
3317 			return;
3318 		}
3319 		runNegativeTest(
3320 				new String[] {
3321 						"p/X.java",
3322 						"package p;\n" +
3323 						"import static p.A1.Outer.Inner;\n" +
3324 						"import static p.A1.AnotherOuter.Inner;\n" +
3325 						"public class X {}\n" +
3326 						"class A1 {\n" +
3327 						"	static class Outer<T extends Inner> {\n" +
3328 						"		private static interface Inner {}\n" +
3329 						"    }\n" +
3330 						"	static class AnotherOuter<T extends Inner> {\n" +
3331 						"		private static class Inner {}\n" +
3332 						"	}\n" +
3333 						"}\n"
3334 				},
3335 				"----------\n" +
3336 				"1. ERROR in p\\X.java (at line 2)\n" +
3337 				"	import static p.A1.Outer.Inner;\n" +
3338 				"	              ^^^^^^^^^^^^^^^^\n" +
3339 				"The type p.A1.Outer.Inner is not visible\n" +
3340 				"----------\n" +
3341 				"2. ERROR in p\\X.java (at line 3)\n" +
3342 				"	import static p.A1.AnotherOuter.Inner;\n" +
3343 				"	              ^^^^^^^^^^^^^^^^^^^^^^^\n" +
3344 				"The type p.A1.AnotherOuter.Inner is not visible\n" +
3345 				"----------\n" +
3346 				"3. ERROR in p\\X.java (at line 6)\n" +
3347 				"	static class Outer<T extends Inner> {\n" +
3348 				"	                             ^^^^^\n" +
3349 				"Inner cannot be resolved to a type\n" +
3350 				"----------\n" +
3351 				"4. ERROR in p\\X.java (at line 9)\n" +
3352 				"	static class AnotherOuter<T extends Inner> {\n" +
3353 				"	                                    ^^^^^\n" +
3354 				"Inner cannot be resolved to a type\n" +
3355 				"----------\n");
3356 	}
testBug520874d()3357 	public void testBug520874d() {
3358 		if (this.complianceLevel <= ClassFileConstants.JDK1_8) {
3359 			return;
3360 		}
3361 		runNegativeTest(
3362 				new String[] {
3363 						"p/X.java",
3364 						"package p;\n" +
3365 						"import static p.A.B.Inner;\n" +
3366 						"import p.Bar.Inner;\n" +
3367 						"public class X {}\n" +
3368 						"class A {\n" +
3369 						"    static class B extends Bar {}\n" +
3370 						"}\n",
3371 						"p/Bar.java",
3372 						"package p;\n" +
3373 						"public class Bar {;\n" +
3374 						"	public static class Inner {}\n" +
3375 						"}\n"
3376 				},
3377 				"----------\n" +
3378 				"1. WARNING in p\\X.java (at line 2)\n" +
3379 				"	import static p.A.B.Inner;\n" +
3380 				"	              ^^^^^^^^^^^\n" +
3381 				"The import p.A.B.Inner is never used\n" +
3382 				"----------\n" +
3383 				"2. WARNING in p\\X.java (at line 3)\n" +
3384 				"	import p.Bar.Inner;\n" +
3385 				"	       ^^^^^^^^^^^\n" +
3386 				"The import p.Bar.Inner is never used\n" +
3387 				"----------\n");
3388 	}
testBug520874e()3389 	public void testBug520874e() {
3390 		if (this.complianceLevel <= ClassFileConstants.JDK1_8) {
3391 			return;
3392 		}
3393 		runNegativeTest(
3394 				new String[] {
3395 						"p/X.java",
3396 						"package p;\n" +
3397 						"import static p.A.B.Inner;\n" +
3398 						"import p.Bar.*;\n" +
3399 						"public class X {}\n" +
3400 						"class A {\n" +
3401 						"    static class B extends Bar {}\n" +
3402 						"}\n",
3403 						"p/Bar.java",
3404 						"package p;\n" +
3405 						"public class Bar {;\n" +
3406 						"	public static class Inner {}\n" +
3407 						"}\n"
3408 				},
3409 				"----------\n" +
3410 				"1. WARNING in p\\X.java (at line 2)\n" +
3411 				"	import static p.A.B.Inner;\n" +
3412 				"	              ^^^^^^^^^^^\n" +
3413 				"The import p.A.B.Inner is never used\n" +
3414 				"----------\n" +
3415 				"2. WARNING in p\\X.java (at line 3)\n" +
3416 				"	import p.Bar.*;\n" +
3417 				"	       ^^^^^\n" +
3418 				"The import p.Bar is never used\n" +
3419 				"----------\n");
3420 	}
3421 }