1 /*******************************************************************************
2  * Copyright (c) 2000, 2020 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  *     Benjamin Muskalla - Contribution for bug 239066
14  *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
15  *     							bug 236385 - [compiler] Warn for potential programming problem if an object is created but not used
16  *     							bug 295551 - Add option to automatically promote all warnings to errors
17  *     							bug 185682 - Increment/decrement operators mark local variables as read
18  *     							bug 349326 - [1.7] new warning for missing try-with-resources
19  *     							bug 359721 - [options] add command line option for new warning token "resource"
20  *     							bug 186342 - [compiler][null] Using annotations for null checking
21  *								bug 365208 - [compiler][batch] command line options for annotation based null analysis
22  *								bug 370639 - [compiler][resource] restore the default for resource leak warnings
23  *								bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations
24  *								bug 374605 - Unreasonable warning for enum-based switch statements
25  *								bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set
26  *								bug 388281 - [compiler][null] inheritance of null annotations as an option
27  *								bug 381443 - [compiler][null] Allow parameter widening from @NonNull to unannotated
28  *								bug 383368 - [compiler][null] syntactic null analysis for field references
29  *								Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
30  *								Bug 440477 - [null] Infrastructure for feeding external annotations into compilation
31  *								Bug 440687 - [compiler][batch][null] improve command line option for external annotations
32  *								Bug 408815 - [batch][null] Add CLI option for COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS
33  *     Jesper Steen Moller - Contributions for
34  *								bug 404146 - [1.7][compiler] nested try-catch-finally-blocks leads to unrunnable Java byte code
35  *								bug 407297 - [1.8][compiler] Control generation of parameter names by option
36  *******************************************************************************/
37 package org.eclipse.jdt.core.tests.compiler.regression;
38 
39 import java.io.ByteArrayInputStream;
40 import java.io.File;
41 import java.io.FileNotFoundException;
42 import java.io.FileOutputStream;
43 import java.io.IOException;
44 import java.io.InputStream;
45 import java.io.PrintWriter;
46 import java.text.MessageFormat;
47 import java.util.Iterator;
48 import java.util.List;
49 
50 import javax.lang.model.SourceVersion;
51 
52 import junit.framework.Test;
53 
54 import org.eclipse.jdt.core.JavaCore;
55 import org.eclipse.jdt.core.compiler.CharOperation;
56 import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
57 import org.eclipse.jdt.core.tests.util.Util;
58 import org.eclipse.jdt.internal.compiler.batch.ClasspathDirectory;
59 import org.eclipse.jdt.internal.compiler.batch.ClasspathJar;
60 import org.eclipse.jdt.internal.compiler.batch.FileSystem;
61 import org.eclipse.jdt.internal.compiler.batch.Main;
62 import org.eclipse.jdt.internal.compiler.batch.FileSystem.Classpath;
63 import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
64 import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
65 import org.eclipse.jdt.internal.compiler.util.ManifestAnalyzer;
66 
67 @SuppressWarnings({ "unchecked", "rawtypes" })
68 public class BatchCompilerTest extends AbstractBatchCompilerTest {
69 
70 	static {
71 //		TESTS_NAMES = new String[] { "test440477" };
72 //		TESTS_NUMBERS = new int[] { 306 };
73 //		TESTS_RANGE = new int[] { 298, -1 };
74 	}
BatchCompilerTest(String name)75 	public BatchCompilerTest(String name) {
76 		super(name);
77 	}
78 	/**
79 	 * This test suite only needs to be run on one compliance.
80 	 * As it includes some specific 1.5 tests, it must be used with a least a 1.5 VM
81 	 * and not be duplicated in general test suite.
82 	 * @see TestAll
83 	 */
suite()84 	public static Test suite() {
85 		return buildMinimalComplianceTestSuite(testClass(), F_1_5);
86 	}
testClass()87 	public static Class testClass() {
88 		return BatchCompilerTest.class;
89 	}
90 	static class StringMatcher extends Matcher {
91 		private String expected;
92 		private Normalizer normalizer;
StringMatcher(String expected, Normalizer normalizer)93 		StringMatcher(String expected, Normalizer normalizer) {
94 			this.expected = expected;
95 			this.normalizer = normalizer;
96 		}
97 		@Override
match(String effective)98 		boolean match(String effective) {
99 			if (this.expected == null) {
100 				return effective == null;
101 			}
102 			if (this.normalizer == null) {
103 				return this.expected.equals(effective);
104 			}
105 			return this.expected.equals(this.normalizer.normalized(effective));
106 		}
107 		@Override
expected()108 		String expected() {
109 			return this.expected;
110 		}
111 	}
112 	static class SubstringMatcher extends Matcher {
113 		private String substring;
SubstringMatcher(String substring)114 		SubstringMatcher(String substring) {
115 			this.substring = substring;
116 		}
117 		@Override
match(String effective)118 		boolean match(String effective) {
119 			effective = outputDirNormalizer.normalized(effective);
120 			return effective.indexOf(this.substring) != -1;
121 		}
122 		@Override
expected()123 		String expected() {
124 			return "*" + this.substring + "*";
125 		}
126 	}
127 	static final Matcher EMPTY_STRING_MATCHER = new Matcher() {
128 		@Override
129 		String expected() {
130 			return org.eclipse.jdt.internal.compiler.util.Util.EMPTY_STRING;
131 		}
132 		@Override
133 		boolean match(String effective) {
134 			return effective != null && effective.length() == 0;
135 		}
136 	};
137 	static final Matcher ONE_FILE_GENERATED_MATCHER = new SubstringMatcher("[1 .class file generated]");
138 	static final Matcher TWO_FILES_GENERATED_MATCHER = new SubstringMatcher("[2 .class files generated]");
139 
140 	/**
141 	 * This normalizer replaces the whole classpaths section of a log file with
142 	 * a normalized placeholder.
143 	 */
144 	private static class XMLClasspathsSectionNormalizer extends Normalizer {
XMLClasspathsSectionNormalizer()145 		XMLClasspathsSectionNormalizer() {
146 			super(null);
147 		}
XMLClasspathsSectionNormalizer(Normalizer nextInChain)148 		XMLClasspathsSectionNormalizer(Normalizer nextInChain) {
149 			super(nextInChain);
150 		}
151 		@Override
normalized(String originalValue)152 		String normalized(String originalValue) {
153 			String result;
154 			StringBuffer normalizedValueBuffer = new StringBuffer(originalValue);
155 			int classpathsStartTagStart = normalizedValueBuffer
156 					.indexOf("<classpaths>"), classpathsEndTagStart = normalizedValueBuffer
157 					.indexOf("</classpaths>");
158 			if (classpathsStartTagStart != -1 && classpathsEndTagStart != -1
159 					&& classpathsStartTagStart < classpathsEndTagStart)
160 				normalizedValueBuffer.replace(classpathsStartTagStart + 12,
161 						classpathsEndTagStart, "NORMALIZED SECTION");
162 			result = super.normalized(normalizedValueBuffer.toString());
163 			return result;
164 		}
165 	}
166 
167 	/**
168 	 * This normalizer removes a selected range of lines from a log file.
169 	 */
170 	private static class LinesRangeNormalizer extends Normalizer {
171 		private int first, number;
172 
LinesRangeNormalizer()173 		LinesRangeNormalizer() {
174 			super(null);
175 			this.first = this.number = 0;
176 		}
177 
LinesRangeNormalizer(Normalizer nextInChain)178 		LinesRangeNormalizer(Normalizer nextInChain) {
179 			super(nextInChain);
180 			this.first = this.number = 0;
181 		}
182 
183 		/**
184 		 * Make a new normalizer able to suppress a range of lines delimited by
185 		 * "\n" sequences from a log file (or another string).
186 		 *
187 		 * @param nextInChain
188 		 *            the next normalizer in the chain of responsibility; pass
189 		 *            null if none is needed
190 		 * @param firstLineToRemove
191 		 *            the index of the first line to remove, starting at 0
192 		 * @param linesNumber
193 		 *            the number or lines to remove; if 0, no other
194 		 *            transformation occurs than those operated by nextInChain
195 		 *            (if any)
196 		 */
LinesRangeNormalizer(Normalizer nextInChain, int firstLineToRemove, int linesNumber)197 		LinesRangeNormalizer(Normalizer nextInChain, int firstLineToRemove,
198 				int linesNumber) {
199 			super(nextInChain);
200 			this.first = firstLineToRemove;
201 			this.number = linesNumber >= 0 ? linesNumber : 0;
202 		}
203 
204 		@Override
normalized(String originalValue)205 		String normalized(String originalValue) {
206 			String result;
207 			if (this.number == 0 || originalValue.length() == 0)
208 				result = super.normalized(originalValue);
209 			else {
210 				final int START = 0, KEEPING = 1, KEEPING_R = 2, SKIPING = 3, SKIPING_R = 4, END = 5, ERROR = 6;
211 				int state = START, currentLineIndex = 0, currentCharIndex = 0, sourceLength;
212 				char currentChar = '\0';
213 				if (this.first <= 0)
214 					state = SKIPING;
215 				else
216 					state = KEEPING;
217 				StringBuffer normalizedValueBuffer = new StringBuffer(), source = new StringBuffer(
218 						originalValue);
219 				sourceLength = source.length();
220 				while (state != END && state != ERROR) {
221 					if (currentCharIndex < sourceLength) {
222 						currentChar = source.charAt(currentCharIndex++);
223 						switch (currentChar) {
224 						case '\r':
225 							switch (state) {
226 							case KEEPING:
227 								normalizedValueBuffer.append(currentChar);
228 								state = KEEPING_R;
229 								break;
230 							case SKIPING:
231 								state = SKIPING_R;
232 								break;
233 							default:
234 								state = ERROR;
235 							}
236 							break;
237 						case '\n':
238 							currentLineIndex++;
239 							switch (state) {
240 							case KEEPING: // tolerate Linux line delimiters
241 							case KEEPING_R:
242 								normalizedValueBuffer.append(currentChar);
243 								if (currentLineIndex == this.first) {
244 									state = SKIPING;
245 								}
246 								break;
247 							case SKIPING: // tolerate Linux line delimiters
248 							case SKIPING_R:
249 								// in effect, we tolerate too big first and number
250 								// values
251 								if (currentLineIndex >= this.first + this.number) {
252 									if (currentCharIndex < sourceLength)
253 										normalizedValueBuffer.append(source
254 												.substring(currentCharIndex));
255 									state = END;
256 								} else {
257 									state = SKIPING;
258 								}
259 								break;
260 							default:
261 								state = ERROR;
262 							}
263 							break;
264 						default:
265 							switch (state) {
266 							case KEEPING:
267 								normalizedValueBuffer.append(currentChar);
268 								break;
269 							case SKIPING:
270 								break;
271 							default:
272 								state = ERROR;
273 							}
274 
275 						}
276 					}
277 					else if (currentChar == '\n')
278 						state = END;
279 					else
280 						state = ERROR;
281 				}
282 				if (state == ERROR)
283 					normalizedValueBuffer
284 							.append("UNEXPECTED ERROR in LinesRangeNormalizer");
285 				result = super.normalized(normalizedValueBuffer.toString());
286 			}
287 			return result;
288 		}
289 	}
290 
291 	/**
292 	 * Normalizer instance for non XML log files.
293 	 */
294 	private static Normalizer textLogsNormalizer = new StringNormalizer(
295 			new XMLClasspathsSectionNormalizer(new LinesRangeNormalizer(null,
296 					0, 2)), OUTPUT_DIR, OUTPUT_DIR_PLACEHOLDER);
297 
298 	/**
299 	 * Normalizer instance for XML log files.
300 	 */
301 	private static Normalizer xmlLogsNormalizer = new StringNormalizer(
302 			new XMLClasspathsSectionNormalizer(new LinesRangeNormalizer(null,
303 					1, 1)), OUTPUT_DIR, OUTPUT_DIR_PLACEHOLDER);
304 
305 
test001()306 public void test001() {
307 
308 		String commandLine = "-classpath \"D:/a folder\";d:/jdk1.4/jre/lib/rt.jar -1.4 -preserveAllLocals -g -verbose d:/eclipse/workspaces/development2.0/plugins/Bar/src2/ -d d:/test";
309 		String expected = " <-classpath> <D:/a folder;d:/jdk1.4/jre/lib/rt.jar> <-1.4> <-preserveAllLocals> <-g> <-verbose> <d:/eclipse/workspaces/development2.0/plugins/Bar/src2/> <-d> <d:/test>";
310 
311 		String[] args = Main.tokenize(commandLine);
312 		StringBuffer  buffer = new StringBuffer(30);
313 		for (int i = 0; i < args.length; i++){
314 			buffer.append(" <"+args[i]+">");
315 		}
316 		String result = buffer.toString();
317 		//System.out.println(Util.displayString(result, 2));
318 		assertEquals("incorrect tokenized command line",
319 			expected,
320 			result);
321 }
test002()322 public void test002() {
323 
324 		String commandLine = "-classpath \"a folder\";\"b folder\"";
325 		String expected = " <-classpath> <a folder;b folder>";
326 
327 		String[] args = Main.tokenize(commandLine);
328 		StringBuffer  buffer = new StringBuffer(30);
329 		for (int i = 0; i < args.length; i++){
330 			buffer.append(" <"+args[i]+">");
331 		}
332 		String result = buffer.toString();
333 		//System.out.println(Util.displayString(result, 2));
334 		assertEquals("incorrect tokenized command line",
335 			expected,
336 			result);
337 }
test003()338 public void test003() {
339 
340 		String commandLine = "-classpath \"a folder;b folder\"";
341 		String expected = " <-classpath> <a folder;b folder>";
342 
343 		String[] args = Main.tokenize(commandLine);
344 		StringBuffer  buffer = new StringBuffer(30);
345 		for (int i = 0; i < args.length; i++){
346 			buffer.append(" <"+args[i]+">");
347 		}
348 		String result = buffer.toString();
349 		//System.out.println(Util.displayString(result, 2));
350 		assertEquals("incorrect tokenized command line",
351 			expected,
352 			result);
353 }
test004()354 public void test004() {
355 
356 		String commandLine = "\"d:/tmp A/\"A.java  -classpath \"d:/tmp A\";d:/jars/rt.jar -nowarn -time -g -d d:/tmp";
357 		String expected = " <d:/tmp A/A.java> <-classpath> <d:/tmp A;d:/jars/rt.jar> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
358 
359 		String[] args = Main.tokenize(commandLine);
360 		StringBuffer  buffer = new StringBuffer(30);
361 		for (int i = 0; i < args.length; i++){
362 			buffer.append(" <"+args[i]+">");
363 		}
364 		String result = buffer.toString();
365 		//System.out.println(Util.displayString(result, 2));
366 		assertEquals("incorrect tokenized command line",
367 			expected,
368 			result);
369 }
test005()370 public void test005() {
371 
372 		String commandLine = "\"d:/tmp A/\"A.java  -classpath d:/jars/rt.jar;\"d:/tmp A\";\"toto\" -nowarn -time -g -d d:/tmp";
373 		String expected = " <d:/tmp A/A.java> <-classpath> <d:/jars/rt.jar;d:/tmp A;toto> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
374 
375 		String[] args = Main.tokenize(commandLine);
376 		StringBuffer  buffer = new StringBuffer(30);
377 		for (int i = 0; i < args.length; i++){
378 			buffer.append(" <"+args[i]+">");
379 		}
380 		String result = buffer.toString();
381 		//System.out.println(Util.displayString(result, 2));
382 		assertEquals("incorrect tokenized command line",
383 			expected,
384 			result);
385 }
test006()386 public void test006() {
387 
388 		String commandLine = "\"d:/tmp A/A.java\"  -classpath d:/jars/rt.jar;\"d:/tmp A\";d:/tmpB/ -nowarn -time -g -d d:/tmp";
389 		String expected = " <d:/tmp A/A.java> <-classpath> <d:/jars/rt.jar;d:/tmp A;d:/tmpB/> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
390 
391 		String[] args = Main.tokenize(commandLine);
392 		StringBuffer  buffer = new StringBuffer(30);
393 		for (int i = 0; i < args.length; i++){
394 			buffer.append(" <"+args[i]+">");
395 		}
396 		String result = buffer.toString();
397 		//System.out.println(Util.displayString(result, 2));
398 		assertEquals("incorrect tokenized command line",
399 			expected,
400 			result);
401 }
402 // test the tester - runConformTest
test007()403 public void test007(){
404 	this.runConformTest(
405 		new String[] {
406 			"X.java",
407 			"import java.util.List;\n" +
408 			"\n" +
409 			"@SuppressWarnings(\"all\"//$NON-NLS-1$\n" +
410 			")\n" +
411 			"public class X {\n" +
412 			"	public static void main(String[] args) {\n" +
413 			"		if (false) {\n" +
414 			"			;\n" +
415 			"		} else {\n" +
416 			"		}\n" +
417 			"		// Zork z;\n" +
418 			"	}\n" +
419 			"}"
420         },
421         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
422         + " -1.5 -g -preserveAllLocals"
423         + " -bootclasspath " + getLibraryClassesAsQuotedString()
424         + " -cp " + getJCEJarAsQuotedString()
425         + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
426         + " -verbose -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
427         "[parsing    ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
428 		"[reading    java/lang/Object.class]\n" +
429 		"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
430 		"[reading    java/util/List.class]\n" +
431 		"[reading    java/lang/SuppressWarnings.class]\n" +
432 		"[reading    java/lang/String.class]\n" +
433 		"[writing    X.class - #1]\n" +
434 		"[completed  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
435 		"[1 unit compiled]\n" +
436 		"[1 .class file generated]\n",
437         "", // changed with bug 123522: now the SuppressWarning upon the first type
438         	// influences warnings on unused imports
439         true);
440 }
441 // test the tester - runNegativeTest
test008()442 public void test008(){
443 	this.runNegativeTest(
444 		new String[] {
445 			"X.java",
446 			"import java.util.List;\n" +
447 			"\n" +
448 			"@SuppressWarnings(\"all\"//$NON-NLS-1$\n" +
449 			")\n" +
450 			"public class X {\n" +
451 			"	public static void main(String[] args) {\n" +
452 			"		if (false) {\n" +
453 			"			;\n" +
454 			"		} else {\n" +
455 			"		}\n" +
456 			"		Zork z;\n" +
457 			"	}\n" +
458 			"}"
459         },
460         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
461         + " -1.5 -g -preserveAllLocals"
462         + " -bootclasspath " + getLibraryClassesAsQuotedString()
463         + " -cp " + getJCEJarAsQuotedString()
464         + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
465         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
466         "",
467         "----------\n" +
468         "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 11)\n" +
469         "	Zork z;\n" +
470         "	^^^^\n" +
471         "Zork cannot be resolved to a type\n" +
472         "----------\n" +
473         "1 problem (1 error)\n",
474         true);
475 }
476 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=92398 -- a case that works, another that does not
477 // revisit this test case depending on https://bugs.eclipse.org/bugs/show_bug.cgi?id=95349
test009()478 public void test009(){
479 	this.runNegativeTest(
480 		new String[] {
481 			"X.java",
482 			"/** */\n" +
483 			"public class X {\n" +
484 			"	OK1 ok1;\n" +
485 			"	OK2 ok2;\n" +
486 			"	Warn warn;\n" +
487 			"	KO ko;\n" +
488 	        "	Zork z;\n" +
489 			"}",
490 			"OK1.java",
491 			"/** */\n" +
492 			"public class OK1 {\n" +
493 			"	// empty\n" +
494 			"}",
495 			"OK2.java",
496 			"/** */\n" +
497 			"public class OK2 {\n" +
498 			"	// empty\n" +
499 			"}",
500 			"Warn.java",
501 			"/** */\n" +
502 			"public class Warn {\n" +
503 			"	// empty\n" +
504 			"}",
505 			"KO.java",
506 			"/** */\n" +
507 			"public class KO {\n" +
508 			"	// empty\n" +
509 			"}",
510 		},
511         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
512         + " -1.5 -g -preserveAllLocals"
513         + " -cp \"" + OUTPUT_DIR + "[+OK2" + File.pathSeparator + "~Warn"
514         	+ File.pathSeparator + "-KO]\""
515         + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
516         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
517         "",
518         "----------\n" +
519         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
520         "	Warn warn;\n" +
521         "	^^^^\n" +
522         "Discouraged access: The type \'Warn\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
523         "----------\n" +
524         "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
525         "	KO ko;\n" +
526         "	^^\n" +
527         "Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
528         "----------\n" +
529         "3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
530         "	Zork z;\n" +
531         "	^^^^\n" +
532         "Zork cannot be resolved to a type\n" +
533         "----------\n" +
534         "3 problems (1 error, 2 warnings)\n",
535         true);
536 }
537 // command line - no user classpath nor bootclasspath
test010()538 public void test010(){
539 	this.runConformTest(
540 		new String[] {
541 			"X.java",
542 			"import java.util.List;\n" +
543 			"\n" +
544 			"@SuppressWarnings(\"all\"//$NON-NLS-1$\n" +
545 			")\n" +
546 			"public class X {\n" +
547 			"	public static void main(String[] args) {\n" +
548 			"		if (false) {\n" +
549 			"			;\n" +
550 			"		} else {\n" +
551 			"		}\n" +
552 			"		// Zork z;\n" +
553 			"	}\n" +
554 			"}"
555         },
556         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
557         + " -1.5 -g -preserveAllLocals"
558         + " -verbose -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
559         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
560         "[parsing    ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
561 		"[reading    java/lang/Object.class]\n" +
562 		"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
563 		"[reading    java/util/List.class]\n" +
564 		"[reading    java/lang/SuppressWarnings.class]\n" +
565 		"[reading    java/lang/String.class]\n" +
566 		"[writing    X.class - #1]\n" +
567 		"[completed  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
568 		"[1 unit compiled]\n" +
569 		"[1 .class file generated]\n",
570         "",
571         true);
572 }
573 // command line - unusual classpath (ends with ';', still OK)
test011_classpath()574 public void test011_classpath(){
575 	this.runConformTest(
576 		new String[] {
577 			"X.java",
578 			"/** */\n" +
579 			"public class X {\n" +
580 			"}",
581 		},
582         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
583         + " -1.5 -g -preserveAllLocals"
584         + " -cp \"" + OUTPUT_DIR + "[+**/OK2;~**/Warn;-KO]"
585         + "\"" + File.pathSeparator
586         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
587         "",
588         "",
589         true);
590 }
591 // command line - help
592 // amended for https://bugs.eclipse.org/bugs/show_bug.cgi?id=141512 (checking
593 // width)
test012()594 public void test012(){
595 	final String expectedOutput =
596         "{0} {1}\n" +
597         "{2}\n" +
598         " \n" +
599         " Usage: <options> <source files | directories>\n" +
600         " If directories are specified, then their source contents are compiled.\n" +
601         " Possible options are listed below. Options enabled by default are prefixed\n" +
602         " with ''+''.\n" +
603         " \n" +
604         " Classpath options:\n" +
605         "    -cp -classpath <directories and ZIP archives separated by " + File.pathSeparator + ">\n" +
606         "                       specify location for application classes and sources.\n" +
607         "                       Each directory or file can specify access rules for\n" +
608         "                       types between ''['' and '']'' (e.g. [-X] to forbid\n" +
609         "                       access to type X, [~X] to discourage access to type X,\n" +
610         "                       [+p/X" + File.pathSeparator + "-p/*] to forbid access to all types in package p\n" +
611         "                       but allow access to p/X)\n" +
612         "    -bootclasspath <directories and ZIP archives separated by " + File.pathSeparator + ">\n" +
613         "                       specify location for system classes. Each directory or\n" +
614         "                       file can specify access rules for types between ''[''\n" +
615         "                       and '']''\n" +
616         "    -sourcepath <directories and ZIP archives separated by " + File.pathSeparator + ">\n" +
617         "                       specify location for application sources. Each directory\n" +
618         "                       or file can specify access rules for types between ''[''\n" +
619         "                       and '']''. Each directory can further specify a specific\n" +
620         "                       destination directory using a ''-d'' option between ''[''\n" +
621         "                       and '']''; this overrides the general ''-d'' option.\n" +
622         "                       .class files created from source files contained in a\n" +
623         "                       jar file are put in the user.dir folder in case no\n" +
624         "                       general ''-d'' option is specified. ZIP archives cannot\n" +
625         "                       override the general ''-d'' option\n" +
626         "    -extdirs <directories separated by " + File.pathSeparator + ">\n" +
627         "                       specify location for extension ZIP archives\n" +
628         "    -endorseddirs <directories separated by " + File.pathSeparator + ">\n" +
629         "                       specify location for endorsed ZIP archives\n" +
630         "    -d <dir>           destination directory (if omitted, no directory is\n" +
631         "                       created); this option can be overridden per source\n" +
632         "                       directory\n" +
633         "    -d none            generate no .class files\n" +
634         "    -encoding <enc>    specify default encoding for all source files. Each\n" +
635         "                       file/directory can override it when suffixed with\n" +
636         "                       ''[''<enc>'']'' (e.g. X.java[utf8]).\n" +
637         "                       If multiple default encodings are specified, the last\n" +
638         "                       one will be used.\n" +
639         " \n" +
640         " Module compilation options:\n" +
641         "   These options are meaningful only in Java 9 environment or later.\n" +
642         "    --module-source-path <directories separated by " + File.pathSeparator + ">\n" +
643         "                       specify where to find source files for multiple modules\n" +
644         "    -p --module-path <directories separated by " + File.pathSeparator + ">\n" +
645         "                       specify where to find application modules\n" +
646         "    --processor-module-path <directories separated by " + File.pathSeparator + ">\n" +
647         "                       specify module path where annotation processors\n" +
648         "                       can be found\n" +
649         "    --system <jdk>      Override location of system modules\n" +
650         "    --add-exports <module>/<package>=<other-module>(,<other-module>)*\n" +
651         "                       specify additional package exports clauses to the\n" +
652         "                       given modules\n" +
653         "    --add-reads <module>=<other-module>(,<other-module>)*\n" +
654         "                       specify additional modules to be considered as required\n" +
655         "                       by given modules\n" +
656         "    --add-modules  <module>(,<module>)*\n" +
657         "                       specify the additional module names that should be\n" +
658         "                       resolved to be root modules\n" +
659         "    --limit-modules <module>(,<module>)*\n" +
660         "                       specify the observable module names\n" +
661         "    --release <release>\n" +
662         "                       compile for a specific VM version\n" +
663         " \n" +
664         " Compliance options:\n" +
665         "    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)\n" +
666         "    -1.4             + use 1.4 compliance (-source 1.3 -target 1.2)\n" +
667         "    -1.5 -5 -5.0       use 1.5 compliance (-source 1.5 -target 1.5)\n" +
668         "    -1.6 -6 -6.0       use 1.6 compliance (-source 1.6 -target 1.6)\n" +
669         "    -1.7 -7 -7.0       use 1.7 compliance (-source 1.7 -target 1.7)\n" +
670         "    -1.8 -8 -8.0       use 1.8 compliance (-source 1.8 -target 1.8)\n" +
671         "    -1.9 -9 -9.0       use 1.9 compliance (-source 1.9 -target 1.9)\n" +
672         "    -10 -10.0          use 10  compliance (-source 10  -target 10)\n" +
673         "    -11 -11.0          use 11  compliance (-source 11  -target 11)\n" +
674         "    -12 -12.0          use 12  compliance (-source 12  -target 12)\n" +
675         "    -13 -13.0          use 13  compliance (-source 13  -target 13)\n" +
676         "    -14 -14.0          use 14  compliance (-source 14  -target 14)\n" +
677         "    -source <version>  set source level: 1.3 to 1.9, 10 to 14\n" +
678         "                       (or 6, 6.0, etc)\n" +
679         "    -target <version>  set classfile target: 1.3 to 1.9, 10 to 14\n" +
680         "                       (or 6, 6.0, etc)\n" +
681         "                       cldc1.1 can also be used to generate the StackMap\n" +
682         "                       attribute\n" +
683         " \n" +
684         " Warning options:\n" +
685         "    -deprecation     + deprecation outside deprecated code (equivalent to\n" +
686         "                       -warn:+deprecation)\n" +
687         "    -nowarn -warn:none disable all warnings\n" +
688         "    -nowarn:[<directories separated by " + File.pathSeparator+ ">]\n" +
689         "                       specify directories from which optional problems should\n" +
690         "                       be ignored\n" +
691         "    -?:warn -help:warn display advanced warning options\n" +
692         " \n" +
693         " Error options:\n" +
694         "    -err:<warnings separated by ,>    convert exactly the listed warnings\n" +
695         "                                      to be reported as errors\n" +
696         "    -err:+<warnings separated by ,>   enable additional warnings to be\n" +
697         "                                      reported as errors\n" +
698         "    -err:-<warnings separated by ,>   disable specific warnings to be\n" +
699         "                                      reported as errors\n" +
700         " \n" +
701         " Info options:\n" +
702         "    -info:<warnings separated by ,>    convert exactly the listed warnings\n" +
703         "                                      to be reported as infos\n" +
704         "    -info:+<warnings separated by ,>   enable additional warnings to be\n" +
705         "                                      reported as infos\n" +
706         "    -info:-<warnings separated by ,>   disable specific warnings to be\n" +
707         "                                      reported as infos\n" +
708         " \n" +
709         " Setting warning, error or info options using properties file:\n" +
710         "    -properties <file>   set warnings/errors/info option based on the properties\n" +
711         "                          file contents. This option can be used with -nowarn,\n" +
712         "                          -err:.., -info: or -warn:.. options, but the last one\n" +
713         "                          on the command line sets the options to be used.\n" +
714         " \n" +
715         " Debug options:\n" +
716         "    -g[:lines,vars,source] custom debug info\n" +
717         "    -g:lines,source  + both lines table and source debug info\n" +
718         "    -g                 all debug info\n" +
719         "    -g:none            no debug info\n" +
720         "    -preserveAllLocals preserve unused local vars for debug purpose\n" +
721         " \n" +
722         " Annotation processing options:\n" +
723         "   These options are meaningful only in a 1.6 environment.\n" +
724         "    -Akey[=value]        options that are passed to annotation processors\n" +
725         "    -processorpath <directories and ZIP archives separated by " + File.pathSeparator + ">\n" +
726         "                         specify locations where to find annotation processors.\n" +
727         "                         If this option is not used, the classpath will be\n" +
728         "                         searched for processors\n" +
729         "    -processor <class1[,class2,...]>\n" +
730         "                         qualified names of the annotation processors to run.\n" +
731         "                         This bypasses the default annotation discovery process\n" +
732         "    -proc:only           run annotation processors, but do not compile\n" +
733         "    -proc:none           perform compilation but do not run annotation\n" +
734         "                         processors\n" +
735         "    -s <dir>             destination directory for generated source files\n" +
736         "    -XprintProcessorInfo print information about which annotations and elements\n" +
737         "                         a processor is asked to process\n" +
738         "    -XprintRounds        print information about annotation processing rounds\n" +
739         "    -classNames <className1[,className2,...]>\n" +
740         "                         qualified names of binary classes to process\n" +
741         " \n" +
742         " Advanced options:\n" +
743         "    @<file>            read command line arguments from file\n" +
744         "    -maxProblems <n>   max number of problems per compilation unit (100 by\n" +
745         "                       default)\n" +
746         "    -log <file>        log to a file. If the file extension is ''.xml'', then\n" +
747         "                       the log will be a xml file.\n" +
748         "    -proceedOnError[:Fatal]\n" +
749         "                       do not stop at first error, dumping class files with\n" +
750         "                       problem methods\n" +
751         "                       With \":Fatal\", all optional errors are treated as fatal\n" +
752         "    -failOnWarning     fail compilation if there are warnings\n" +
753         "    -verbose           enable verbose output\n" +
754         "    -referenceInfo     compute reference info\n" +
755         "    -progress          show progress (only in -log mode)\n" +
756         "    -time              display speed information \n" +
757         "    -noExit            do not call System.exit(n) at end of compilation (n==0\n" +
758         "                       if no error)\n" +
759         "    -repeat <n>        repeat compilation process <n> times for perf analysis\n" +
760         "    -inlineJSR         inline JSR bytecode (implicit if target >= 1.5)\n" +
761         "    -enableJavadoc     consider references in javadoc\n" +
762         "    -parameters        generate method parameters attribute (for target >= 1.8)\n" +
763         "    -genericsignature  generate generic signature for lambda expressions\n" +
764         "    -Xemacs            used to enable emacs-style output in the console.\n" +
765         "                       It does not affect the xml log output\n" +
766         "    -missingNullDefault  report missing default nullness annotation\n" +
767         "    -annotationpath <directories and ZIP archives separated by " + File.pathSeparator + ">\n" +
768         "                       specify locations where to find external annotations\n" +
769         "                       to support annotation-based null analysis.\n" +
770         "                       The special name CLASSPATH will cause lookup of\n" +
771         "                       external annotations from the classpath and sourcepath.\n" +
772         " \n" +
773         "    -? -help           print this help message\n" +
774         "    -v -version        print compiler version\n" +
775         "    -showversion       print compiler version and continue\n" +
776         " \n" +
777         " Ignored options:\n" +
778         "    -J<option>         pass option to virtual machine (ignored)\n" +
779         "    -X<option>         specify non-standard option (ignored\n" +
780         "                       except for listed -X options)\n" +
781         "    -X                 print non-standard options and exit (ignored)\n" +
782         "    -O                 optimize for execution time (ignored)\n" +
783         "\n";
784 	String expandedExpectedOutput =
785 		MessageFormat.format(expectedOutput, new Object[] {
786 				MAIN.bind("compiler.name"),
787 				MAIN.bind("compiler.version"),
788 				MAIN.bind("compiler.copyright")
789 		// because misc.version is mono-line - reconsider if this changes
790 //		MessageFormat.format(expectedOutput, new String[] {
791 //				Main.bind("misc.version", new String[] {
792 //					Main.bind("compiler.name"),
793 //					Main.bind("compiler.version"),
794 //					Main.bind("compiler.copyright")
795 //				}),
796 				// File.pathSeparator
797 			});
798 		this.runConformTest(
799 		new String[0],
800         " -help -referenceInfo",
801         expandedExpectedOutput,
802         "", true);
803 	checkWidth(expandedExpectedOutput, 80);
804 }
805 //command line - help
806 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=144248
807 // Progressive help text modifies the help options and messages.
808 // amended for https://bugs.eclipse.org/bugs/show_bug.cgi?id=141512 (checking
809 // width)
test012b()810 public void test012b(){
811 	final String expectedOutput =
812         "{0} {1}\n" +
813         "{2}\n" +
814         " \n" +
815         " Warning options:\n" +
816         "    -deprecation         + deprecation outside deprecated code\n" +
817         "    -nowarn -warn:none disable all warnings and infos\n" +
818         "    -nowarn:[<directories separated by " + File.pathSeparator+ ">]\n" +
819         "                       specify directories from which optional problems should\n" +
820         "                       be ignored\n" +
821         "    -warn:<warnings separated by ,>    enable exactly the listed warnings\n" +
822         "    -warn:+<warnings separated by ,>   enable additional warnings\n" +
823         "    -warn:-<warnings separated by ,>   disable specific warnings\n" +
824         "      all                  enable all warnings\n" +
825         "      allDeadCode          dead code including trivial if(DEBUG) check\n" +
826         "      allDeprecation       deprecation including inside deprecated code\n" +
827         "      allJavadoc           invalid or missing javadoc\n" +
828         "      allOver-ann          all missing @Override annotations\n" +
829         "      all-static-method    all method can be declared as static warnings\n" +
830         "      assertIdentifier   + ''assert'' used as identifier\n" +
831         "      boxing               autoboxing conversion\n" +
832         "      charConcat         + char[] in String concat\n" +
833         "      compareIdentical   + comparing identical expressions\n" +
834         "      conditionAssign      possible accidental boolean assignment\n" +
835         "      constructorName    + method with constructor name\n" +
836         "      deadCode           + dead code excluding trivial if (DEBUG) check\n" +
837         "      dep-ann              missing @Deprecated annotation\n" +
838         "      deprecation        + deprecation outside deprecated code\n" +
839         "      discouraged        + use of types matching a discouraged access rule\n" +
840         "      emptyBlock           undocumented empty block\n" +
841         "      enumIdentifier       ''enum'' used as identifier\n" +
842         "      enumSwitch           incomplete enum switch\n" +
843         "      enumSwitchPedantic + report missing enum switch cases even\n" +
844         "                           in the presence of a default case\n" +
845         "      fallthrough          possible fall-through case\n" +
846         "      fieldHiding          field hiding another variable\n" +
847         "      finalBound           type parameter with final bound\n" +
848         "      finally            + finally block not completing normally\n" +
849         "      forbidden          + use of types matching a forbidden access rule\n" +
850         "      hashCode              missing hashCode() method when overriding equals()\n" +
851         "      hiding               macro for fieldHiding, localHiding, typeHiding and\n" +
852         "                           maskedCatchBlock\n" +
853         "      includeAssertNull    raise null warnings for variables\n" +
854         "                           that got tainted in an assert expression\n" +
855         "      indirectStatic       indirect reference to static member\n" +
856         "      inheritNullAnnot     inherit null annotations\n" +
857         "      intfAnnotation     + annotation type used as super interface\n" +
858         "      intfNonInherited   + interface non-inherited method compatibility\n" +
859         "      intfRedundant        find redundant superinterfaces\n" +
860         "      invalidJavadoc       all warnings for malformed javadoc tags\n" +
861         "      invalidJavadocTag    validate javadoc tag arguments\n" +
862         "      invalidJavadocTagDep validate deprecated references in javadoc tag args\n" +
863         "      invalidJavadocTagNotVisible  validate non-visible references in javadoc\n" +
864         "							tag args\n" +
865         "      invalidJavadocVisibility(<visibility>)  specify visibility modifier\n" +
866         "							for malformed javadoc tag warnings\n" +
867         "      javadoc              invalid javadoc\n" +
868         "      localHiding          local variable hiding another variable\n" +
869         "      maskedCatchBlock   + hidden catch block\n" +
870         "      missingJavadocTags   missing Javadoc tags\n" +
871         "      missingJavadocTagsOverriding missing Javadoc tags in overriding methods\n" +
872         "      missingJavadocTagsMethod missing Javadoc tags for method type parameter\n" +
873         "      missingJavadocTagsVisibility(<visibility>)  specify visibility modifier\n" +
874         "							for missing javadoc tags warnings\n" +
875         "      missingJavadocComments   missing Javadoc comments\n" +
876         "      missingJavadocCommentsOverriding   missing Javadoc tags in overriding\n" +
877         "							methods\n" +
878         "      missingJavadocCommentsVisibility(<visibility>)  specify visibility\n" +
879         "							modifier for missing javadoc comments warnings\n" +
880         "      module             + module related problems.\n" +
881         "      nls                  string literal lacking non-nls tag //$NON-NLS-<n>$\n" +
882         "      noEffectAssign     + assignment without effect\n" +
883         "      null                 potential missing or redundant null check\n" +
884         "      nullAnnot(<annot. names separated by |>)   annotation based null analysis,\n" +
885         "                           nullable|nonnull|nonnullbydefault annotation types\n" +
886         "                           optionally specified using fully qualified names.\n" +
887         "							Enabling this option enables all null-annotation\n" +
888         "							related sub-options. These can be individually\n" +
889         "							controlled using options listed below.\n" +
890         "      nullAnnotConflict    conflict between null annotation specified\n" +
891         "							and nullness inferred. Is effective only with\n" +
892         "							nullAnnot option enabled.\n" +
893         "      nullAnnotRedundant   redundant specification of null annotation. Is\n" +
894         "							effective only with nullAnnot option enabled.\n" +
895         "      nullDereference    + missing null check\n" +
896         "	   nullUncheckedConversion unchecked conversion from non-annotated type\n" +
897         "							to @NonNull type. Is effective only with\n" +
898         "							nullAnnot option enabled.\n" +
899         "      over-ann             missing @Override annotation (superclass)\n" +
900         "      paramAssign          assignment to a parameter\n" +
901         "      pkgDefaultMethod   + attempt to override package-default method\n" +
902         "      raw                + usage of raw type\n" +
903         "      removal            + deprecation marked for removal\n" +
904         "      resource           + (pot.) unsafe usage of resource of type Closeable\n" +
905         "      semicolon            unnecessary semicolon, empty statement\n" +
906         "      serial             + missing serialVersionUID\n" +
907         "      specialParamHiding   constructor or setter parameter hiding a field\n" +
908         "      static-method        method can be declared as static\n" +
909         "      static-access        macro for indirectStatic and staticReceiver\n" +
910         "      staticReceiver     + non-static reference to static member\n" +
911         "      super                overriding a method without making a super invocation\n" +
912         "      suppress           + enable @SuppressWarnings\n" +
913         "                           When used with -err:, it can also silence optional\n" +
914         "                           errors and warnings\n" +
915         "      switchDefault        switch statement lacking a default case\n" +
916         "      syncOverride         missing synchronized in synchr. method override\n" +
917         "      syntacticAnalysis    perform syntax-based null analysis for fields\n" +
918         "      syntheticAccess      synthetic access for innerclass\n" +
919         "      tasks(<tags separated by |>) tasks identified by tags inside comments\n" +
920         "      typeHiding         + type parameter hiding another type\n" +
921         "      unavoidableGenericProblems + ignore unavoidable type safety problems\n" +
922         "                                   due to raw APIs\n" +
923         "      unchecked          + unchecked type operation\n" +
924         "      unlikelyCollectionMethodArgumentType\n" +
925         "                         + unlikely argument type for collection method\n" +
926         "                           declaring an Object parameter\n" +
927         "      unlikelyEqualsArgumentType unlikely argument type for method equals()\n" +
928         "      unnecessaryElse      unnecessary else clause\n" +
929         "      unqualifiedField     unqualified reference to field\n" +
930         "      unused               macro for unusedAllocation, unusedArgument,\n" +
931         "                               unusedImport, unusedLabel, unusedLocal,\n" +
932         "                               unusedPrivate, unusedThrown, and unusedTypeArgs,\n" +
933         "								unusedExceptionParam\n"+
934         "      unusedAllocation     allocating an object that is not used\n" +
935         "      unusedArgument       unread method parameter\n" +
936         "      unusedExceptionParam unread exception parameter\n" +
937         "      unusedImport       + unused import declaration\n" +
938         "      unusedLabel        + unused label\n" +
939         "      unusedLocal        + unread local variable\n" +
940         "      unusedParam		    unused parameter\n" +
941         "      unusedParamOverriding unused parameter for overriding method\n" +
942         "      unusedParamImplementing unused parameter for implementing method\n" +
943         "      unusedParamIncludeDoc unused parameter documented in comment tag\n" +
944         "      unusedPrivate      + unused private member declaration\n" +
945         "      unusedThrown         unused declared thrown exception\n" +
946         "      unusedThrownWhenOverriding unused declared thrown exception in \n" +
947         "							overriding method\n" +
948         "      unusedThrownIncludeDocComment     unused declared thrown exception,\n" +
949         "							documented in a comment tag\n" +
950         "      unusedThrownExemptExceptionThrowable  unused declared thrown exception,\n" +
951         "							exempt Exception and Throwable\n" +
952         "      unusedTypeArgs     + unused type arguments for method and constructor\n" +
953         "      uselessTypeCheck     unnecessary cast/instanceof operation\n" +
954         "      varargsCast        + varargs argument need explicit cast\n" +
955         "      warningToken       + unsupported or unnecessary @SuppressWarnings\n" +
956         "\n";
957 	String expandedExpectedOutput =
958 		MessageFormat.format(expectedOutput, new Object[] {
959 				MAIN.bind("compiler.name"),
960 				MAIN.bind("compiler.version"),
961 				MAIN.bind("compiler.copyright")
962 		// because misc.version is mono-line - reconsider if this changes
963 //		MessageFormat.format(expectedOutput, new String[] {
964 //				Main.bind("misc.version", new String[] {
965 //					Main.bind("compiler.name"),
966 //					Main.bind("compiler.version"),
967 //					Main.bind("compiler.copyright")
968 //				}),
969 				// File.pathSeparator
970 			});
971 	this.runConformTest(
972 		new String[0],
973         " -help:warn -referenceInfo",
974         expandedExpectedOutput,
975         "", true);
976 	checkWidth(expandedExpectedOutput, 80);
977 }
978 
979 	// command line - xml log contents https://bugs.eclipse.org/bugs/show_bug.cgi?id=93904
test013()980 	public void test013() {
981 		String logFileName = OUTPUT_DIR + File.separator + "log.xml";
982 		this.runNegativeTest(new String[] {
983 				"X.java",
984 				"/** */\n" +
985 				"public class X {\n" +
986 				"	Zork z;\n" +
987 				"}", },
988 				"\"" + OUTPUT_DIR + File.separator + "X.java\""
989 				+ " -1.5 -proceedOnError"
990 				+ " -log \"" + logFileName + "\" -d \"" + OUTPUT_DIR + "\"",
991 				"",
992 				"----------\n" +
993 				"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
994 				"	Zork z;\n" +
995 				"	^^^^\n" +
996 				"Zork cannot be resolved to a type\n" +
997 				"----------\n" +
998 				"1 problem (1 error)",
999 				true);
1000 		String logContents = Util.fileContent(logFileName);
1001 		String expectedLogContents =
1002 			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
1003 			"<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.006 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_006.dtd\">\n" +
1004 			"<compiler copyright=\"{2}\" name=\"{1}\" version=\"{3}\">\n" +
1005 			"	<command_line>\n" +
1006 			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.java\"/>\n" +
1007 			"		<argument value=\"-1.5\"/>\n" +
1008 			"		<argument value=\"-proceedOnError\"/>\n" +
1009 			"		<argument value=\"-log\"/>\n" +
1010 			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}log.xml\"/>\n" +
1011 			"		<argument value=\"-d\"/>\n" +
1012 			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---\"/>\n" +
1013 			"	</command_line>\n" +
1014 			"	<options>\n" +
1015 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations\" value=\"disabled\"/>\n" +
1016 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation\" value=\"ignore\"/>\n" +
1017 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnull\" value=\"org.eclipse.jdt.annotation.NonNull\"/>\n" +
1018 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnull.secondary\" value=\"\"/>\n" +
1019 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnullbydefault\" value=\"org.eclipse.jdt.annotation.NonNullByDefault\"/>\n" +
1020 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary\" value=\"\"/>\n" +
1021 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullable\" value=\"org.eclipse.jdt.annotation.Nullable\"/>\n" +
1022 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullable.secondary\" value=\"\"/>\n" +
1023 			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullanalysis\" value=\"disabled\"/>\n" +
1024 			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode\" value=\"disabled\"/>\n" +
1025 			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.lambda.genericSignature\" value=\"do not generate\"/>\n" +
1026 			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.methodParameters\" value=\"do not generate\"/>\n" +
1027 			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.shareCommonFinallyBlocks\" value=\"disabled\"/>\n" +
1028 			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.targetPlatform\" value=\"1.5\"/>\n" +
1029 			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.unusedLocal\" value=\"optimize out\"/>\n" +
1030 			"		<option key=\"org.eclipse.jdt.core.compiler.compliance\" value=\"1.5\"/>\n" +
1031 			"		<option key=\"org.eclipse.jdt.core.compiler.debug.lineNumber\" value=\"generate\"/>\n" +
1032 			"		<option key=\"org.eclipse.jdt.core.compiler.debug.localVariable\" value=\"do not generate\"/>\n" +
1033 			"		<option key=\"org.eclipse.jdt.core.compiler.debug.sourceFile\" value=\"generate\"/>\n" +
1034 			"		<option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" +
1035 			"		<option key=\"org.eclipse.jdt.core.compiler.emulateJavacBug8031744\" value=\"enabled\"/>\n" +
1036 			"		<option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" +
1037 			"		<option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" +
1038 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.APILeak\" value=\"warning\"/>\n" +
1039 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated\" value=\"info\"/>\n" +
1040 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" +
1041 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" +
1042 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" +
1043 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.comparingIdentical\" value=\"warning\"/>\n" +
1044 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deadCode\" value=\"warning\"/>\n" +
1045 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement\" value=\"disabled\"/>\n" +
1046 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecation\" value=\"warning\"/>\n" +
1047 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode\" value=\"disabled\"/>\n" +
1048 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod\" value=\"disabled\"/>\n" +
1049 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.discouragedReference\" value=\"warning\"/>\n" +
1050 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.emptyStatement\" value=\"ignore\"/>\n" +
1051 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures\" value=\"disabled\"/>\n" +
1052 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.enumIdentifier\" value=\"warning\"/>\n" +
1053 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable\" value=\"ignore\"/>\n" +
1054 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.fallthroughCase\" value=\"ignore\"/>\n" +
1055 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.fatalOptionalError\" value=\"disabled\"/>\n" +
1056 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.fieldHiding\" value=\"ignore\"/>\n" +
1057 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.finalParameterBound\" value=\"warning\"/>\n" +
1058 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally\" value=\"warning\"/>\n" +
1059 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.forbiddenReference\" value=\"warning\"/>\n" +
1060 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock\" value=\"warning\"/>\n" +
1061 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts\" value=\"disabled\"/>\n" +
1062 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod\" value=\"warning\"/>\n" +
1063 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch\" value=\"warning\"/>\n" +
1064 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.indirectStaticAccess\" value=\"ignore\"/>\n" +
1065 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadoc\" value=\"ignore\"/>\n" +
1066 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTags\" value=\"disabled\"/>\n" +
1067 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef\" value=\"disabled\"/>\n" +
1068 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef\" value=\"disabled\"/>\n" +
1069 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility\" value=\"public\"/>\n" +
1070 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.localVariableHiding\" value=\"ignore\"/>\n" +
1071 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.methodWithConstructorName\" value=\"warning\"/>\n" +
1072 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingDefaultCase\" value=\"ignore\"/>\n" +
1073 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation\" value=\"ignore\"/>\n" +
1074 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault\" value=\"disabled\"/>\n" +
1075 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod\" value=\"ignore\"/>\n" +
1076 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocComments\" value=\"ignore\"/>\n" +
1077 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding\" value=\"disabled\"/>\n" +
1078 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility\" value=\"public\"/>\n" +
1079 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription\" value=\"return_tag\"/>\n" +
1080 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTags\" value=\"ignore\"/>\n" +
1081 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters\" value=\"disabled\"/>\n" +
1082 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding\" value=\"disabled\"/>\n" +
1083 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility\" value=\"public\"/>\n" +
1084 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation\" value=\"ignore\"/>\n" +
1085 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation\" value=\"enabled\"/>\n" +
1086 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingSerialVersion\" value=\"warning\"/>\n" +
1087 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod\" value=\"ignore\"/>\n" +
1088 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.noEffectAssignment\" value=\"warning\"/>\n" +
1089 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion\" value=\"warning\"/>\n" +
1090 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral\" value=\"ignore\"/>\n" +
1091 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped\" value=\"warning\"/>\n" +
1092 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation\" value=\"warning\"/>\n" +
1093 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict\" value=\"error\"/>\n" +
1094 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullReference\" value=\"warning\"/>\n" +
1095 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullSpecViolation\" value=\"error\"/>\n" +
1096 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion\" value=\"warning\"/>\n" +
1097 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation\" value=\"ignore\"/>\n" +
1098 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" +
1099 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" +
1100 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables\" value=\"warning\"/>\n" +
1101 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" +
1102 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" +
1103 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable\" value=\"ignore\"/>\n" +
1104 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" +
1105 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation\" value=\"warning\"/>\n" +
1106 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" +
1107 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments\" value=\"ignore\"/>\n" +
1108 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" +
1109 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic\" value=\"ignore\"/>\n" +
1110 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic\" value=\"ignore\"/>\n" +
1111 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures\" value=\"warning\"/>\n" +
1112 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" +
1113 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" +
1114 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" +
1115 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" +
1116 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed\" value=\"info\"/>\n" +
1117 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields\" value=\"disabled\"/>\n" +
1118 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" +
1119 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.tasks\" value=\"warning\"/>\n" +
1120 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.terminalDeprecation\" value=\"warning\"/>\n" +
1121 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.typeParameterHiding\" value=\"warning\"/>\n" +
1122 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems\" value=\"enabled\"/>\n" +
1123 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation\" value=\"warning\"/>\n" +
1124 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unclosedCloseable\" value=\"warning\"/>\n" +
1125 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock\" value=\"ignore\"/>\n" +
1126 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unhandledWarningToken\" value=\"warning\"/>\n" +
1127 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison\" value=\"disabled\"/>\n" +
1128 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType\" value=\"warning\"/>\n" +
1129 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict\" value=\"disabled\"/>\n" +
1130 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType\" value=\"info\"/>\n" +
1131 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unnecessaryElse\" value=\"ignore\"/>\n" +
1132 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck\" value=\"ignore\"/>\n" +
1133 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess\" value=\"ignore\"/>\n" +
1134 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName\" value=\"warning\"/>\n" +
1135 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException\" value=\"ignore\"/>\n" +
1136 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable\" value=\"enabled\"/>\n" +
1137 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference\" value=\"enabled\"/>\n" +
1138 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding\" value=\"disabled\"/>\n" +
1139 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter\" value=\"ignore\"/>\n" +
1140 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedImport\" value=\"warning\"/>\n" +
1141 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedLabel\" value=\"warning\"/>\n" +
1142 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedLocal\" value=\"warning\"/>\n" +
1143 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation\" value=\"ignore\"/>\n" +
1144 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameter\" value=\"ignore\"/>\n" +
1145 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference\" value=\"enabled\"/>\n" +
1146 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract\" value=\"disabled\"/>\n" +
1147 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" +
1148 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" +
1149 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation\" value=\"warning\"/>\n" +
1150 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedTypeParameter\" value=\"ignore\"/>\n" +
1151 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedWarningToken\" value=\"warning\"/>\n" +
1152 			"		<option key=\"org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast\" value=\"warning\"/>\n" +
1153 			"		<option key=\"org.eclipse.jdt.core.compiler.processAnnotations\" value=\"disabled\"/>\n" +
1154 			"		<option key=\"org.eclipse.jdt.core.compiler.release\" value=\"disabled\"/>\n" +
1155 			"		<option key=\"org.eclipse.jdt.core.compiler.source\" value=\"1.5\"/>\n" +
1156 			"		<option key=\"org.eclipse.jdt.core.compiler.storeAnnotations\" value=\"disabled\"/>\n" +
1157 			"		<option key=\"org.eclipse.jdt.core.compiler.taskCaseSensitive\" value=\"enabled\"/>\n" +
1158 			"		<option key=\"org.eclipse.jdt.core.compiler.taskPriorities\" value=\"\"/>\n" +
1159 			"		<option key=\"org.eclipse.jdt.core.compiler.taskTags\" value=\"\"/>\n" +
1160 			"	</options>\n" +
1161 			"	<classpaths>NORMALIZED SECTION</classpaths>\n" +
1162 			"	<sources>\n" +
1163 			"		<source output=\"---OUTPUT_DIR_PLACEHOLDER---\" path=\"---OUTPUT_DIR_PLACEHOLDER---" + File.separator + "X.java\">\n" +
1164 			"			<problems errors=\"1\" infos=\"0\" problems=\"1\" warnings=\"0\">\n" +
1165 			"				<problem categoryID=\"40\" charEnd=\"28\" charStart=\"25\" id=\"UndefinedType\" line=\"3\" problemID=\"16777218\" severity=\"ERROR\">\n" +
1166 			"					<message value=\"Zork cannot be resolved to a type\"/>\n" +
1167 			"					<source_context sourceEnd=\"3\" sourceStart=\"0\" value=\"Zork z;\"/>\n" +
1168 			"					<arguments>\n" +
1169 			"						<argument value=\"Zork\"/>\n" +
1170 			"					</arguments>\n" +
1171 			"				</problem>\n" +
1172 			"			</problems>\n" +
1173 			"			<classfile path=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.class\"/>\n" +
1174 			"		</source>\n" +
1175 			"	</sources>\n" +
1176 			"	<stats>\n" +
1177 			"		<problem_summary errors=\"1\" infos=\"0\" problems=\"1\" tasks=\"0\" warnings=\"0\"/>\n" +
1178 			"	</stats>\n" +
1179 			"</compiler>\n";
1180 		String normalizedExpectedLogContents =
1181 				MessageFormat.format(
1182 						expectedLogContents,
1183 						new Object[] {
1184 								File.separator,
1185 								MAIN.bind("compiler.name"),
1186 								MAIN.bind("compiler.copyright"),
1187 								MAIN.bind("compiler.version")
1188 						});
1189 		String normalizedLogContents =
1190 				xmlLogsNormalizer.normalized(logContents);
1191 		boolean compareOK = normalizedExpectedLogContents.equals(
1192 				normalizedLogContents);
1193 		if (!compareOK) {
1194 			System.out.println(getClass().getName() + '#' + getName());
1195 			System.out.println(
1196 					  "------------ [START LOG] ------------\n"
1197 					+ "------------- Expected: -------------\n"
1198 					+ expectedLogContents
1199 				  + "\n------------- but was:  -------------\n"
1200 					+ xmlLogsNormalizer.normalized(logContents)
1201 				  + "\n--------- (cut and paste:) ----------\n"
1202 					+ Util.displayString(xmlLogsNormalizer.normalized(logContents))
1203 				  + "\n------------- [END LOG] -------------\n");
1204 			assertEquals("Unexpected log contents",
1205 					normalizedExpectedLogContents, normalizedLogContents);
1206 		}
1207 	}
1208 
1209 	// command line - txt log contents https://bugs.eclipse.org/bugs/show_bug.cgi?id=93904
test014()1210 	public void test014() {
1211 		String logFileName = OUTPUT_DIR + File.separator + "log.txt";
1212 		this.runNegativeTest(new String[] {
1213 				"X.java",
1214 				"/** */\n" +
1215 				"public class X {\n" +
1216 				"	Zork z;\n" +
1217 				"}", },
1218 				"\"" + OUTPUT_DIR + File.separator + "X.java\""
1219 				+ " -1.5 -proceedOnError"
1220 				+ " -log \"" + logFileName + "\" -d \"" + OUTPUT_DIR + "\"",
1221 				"",
1222 				"----------\n" +
1223 				"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
1224 				"	Zork z;\n" +
1225 				"	^^^^\n" +
1226 				"Zork cannot be resolved to a type\n" +
1227 				"----------\n" +
1228 				"1 problem (1 error)\n",
1229 				false);
1230 		String logContents = Util.fileContent(logFileName);
1231 		String expectedLogContents =
1232 			"----------\n" +
1233 			"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---" + File.separator + "X.java (at line 3)\n" +
1234 			"	Zork z;\n" +
1235 			"	^^^^\n" +
1236 			"Zork cannot be resolved to a type\n" +
1237 			"----------\n" +
1238 			"1 problem (1 error)\n";
1239 		boolean compareOK = semiNormalizedComparison(expectedLogContents,
1240 				logContents, textLogsNormalizer);
1241 		if (!compareOK) {
1242 			System.out.println(getClass().getName() + '#' + getName());
1243 			System.out.println(
1244 							  "------------ [START LOG] ------------\n"
1245 							+ "------------- Expected: -------------\n"
1246 							+ expectedLogContents
1247 						  + "\n------------- but was:  -------------\n"
1248 							+ outputDirNormalizer.normalized(logContents)
1249 						  + "\n--------- (cut and paste:) ----------\n"
1250 							+ Util.displayString(outputDirNormalizer.normalized(logContents))
1251 						  + "\n------------- [END LOG] -------------\n");
1252 		}
1253 		assertTrue("unexpected log contents", compareOK);
1254 	}
1255 
1256 	// command line - no extension log contents https://bugs.eclipse.org/bugs/show_bug.cgi?id=93904
test015()1257 	public void test015() {
1258 		String logFileName = OUTPUT_DIR + File.separator + "log";
1259 		this.runNegativeTest(new String[] {
1260 				"X.java",
1261 				"/** */\n" +
1262 				"public class X {\n" +
1263 				"	Zork z;\n" +
1264 				"}", },
1265 				"\"" + OUTPUT_DIR + File.separator + "X.java\""
1266 				+ " -1.5 -proceedOnError"
1267 				+ " -log \"" + logFileName + "\" -d \"" + OUTPUT_DIR + "\"",
1268 				"",
1269 				"----------\n" +
1270 				"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
1271 				"	Zork z;\n" +
1272 				"	^^^^\n" +
1273 				"Zork cannot be resolved to a type\n" +
1274 				"----------\n" +
1275 				"1 problem (1 error)\n",
1276 				false);
1277 		String logContents = Util.fileContent(logFileName);
1278 		String expectedLogContents =
1279 			"----------\n" +
1280 			"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---" + File.separator + "X.java (at line 3)\n" +
1281 			"	Zork z;\n" +
1282 			"	^^^^\n" +
1283 			"Zork cannot be resolved to a type\n" +
1284 			"----------\n" +
1285 			"1 problem (1 error)\n";
1286 		boolean compareOK = semiNormalizedComparison(expectedLogContents,
1287 				logContents, textLogsNormalizer);
1288 		if (!compareOK) {
1289 			System.out.println(getClass().getName() + '#' + getName());
1290 			System.out.println(
1291 					  "------------ [START LOG] ------------\n"
1292 					+ "------------- Expected: -------------\n"
1293 					+ expectedLogContents
1294 				  + "\n------------- but was:  -------------\n"
1295 					+ outputDirNormalizer.normalized(logContents)
1296 				  + "\n--------- (cut and paste:) ----------\n"
1297 					+ Util.displayString(outputDirNormalizer.normalized(logContents))
1298 				  + "\n------------- [END LOG] -------------\n");
1299 		}
1300 		assertTrue("unexpected log contents", compareOK);
1301 	}
1302 // command line - several path separators within the classpath
test016()1303 public void test016(){
1304 	String setting = System.getProperty("jdt.compiler.useSingleThread");
1305 	try {
1306 		System.setProperty("jdt.compiler.useSingleThread", "true");
1307 		this.runConformTest(
1308 			new String[] {
1309 					"X.java",
1310 					"/** */\n" +
1311 					"public class X {\n" +
1312 					"	OK1 ok1;\n" +
1313 					"}",
1314 					"OK1.java",
1315 					"/** */\n" +
1316 					"public class OK1 {\n" +
1317 					"	// empty\n" +
1318 					"}"
1319 			},
1320 	        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1321 	        + " -1.5 -g -preserveAllLocals"
1322 	        + " -cp ." + File.pathSeparator + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
1323 	        + " -verbose -proceedOnError -referenceInfo"
1324 	        + " -d \"" + OUTPUT_DIR + "\"",
1325 			"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
1326 			"[reading    java/lang/Object.class]\n" +
1327 			"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
1328 			"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/OK1.java - #2/2]\n" +
1329 			"[writing    X.class - #1]\n" +
1330 			"[completed  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/2]\n" +
1331 			"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/OK1.java - #2/2]\n" +
1332 			"[writing    OK1.class - #2]\n" +
1333 			"[completed  ---OUTPUT_DIR_PLACEHOLDER---/OK1.java - #2/2]\n" +
1334 			"[2 units compiled]\n" +
1335 			"[2 .class files generated]\n",
1336 	        "",
1337 	        true);
1338 	} finally {
1339 		System.setProperty("jdt.compiler.useSingleThread", setting == null ? "false" : setting);
1340 	}
1341 }
test017()1342 public void test017(){
1343 		this.runConformTest(
1344 			new String[] {
1345 					"X.java",
1346 					"/** */\n" +
1347 					"public class X {\n" +
1348 					"	OK1 ok1;\n" +
1349 					"}",
1350 					"OK1.java",
1351 					"/** */\n" +
1352 					"public class OK1 {\n" +
1353 					"	// empty\n" +
1354 					"}"
1355 			},
1356 	        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1357 	        + " -1.5 -g -preserveAllLocals"
1358 	        + " -cp dummmy_dir" + File.pathSeparator + "dummy.jar" + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
1359 	        + " -proceedOnError -referenceInfo"
1360 	        + " -d \"" + OUTPUT_DIR + "\"",
1361 	        "",
1362 	        "incorrect classpath: dummmy_dir\n",
1363 	        true);
1364 	}
1365 // we tolerate inexisting jars on the classpath, and we don't even warn about
1366 // them (javac does the same as us)
test017b()1367 public void test017b(){
1368 	this.runTest(
1369 		true,
1370 		new String[] {
1371 			"X.java",
1372 			"/** */\n" +
1373 			"public class X {\n" +
1374 			"	OK1 ok1;\n" +
1375 			"}",
1376 			"OK1.java",
1377 			"/** */\n" +
1378 			"public class OK1 {\n" +
1379 			"	// empty\n" +
1380 			"}"
1381 		},
1382         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1383         + " -1.5 -g -preserveAllLocals"
1384         + " -cp dummy.jar" + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
1385         + " -verbose -proceedOnError -referenceInfo"
1386         + " -d \"" + OUTPUT_DIR + "\"",
1387         TWO_FILES_GENERATED_MATCHER,
1388         EMPTY_STRING_MATCHER,
1389         true);
1390 }
1391 // we tolerate empty classpath entries, and we don't even warn about
1392 // them (javac does the same as us)
test017c()1393 public void test017c(){
1394 	this.runTest(
1395 		true,
1396 		new String[] {
1397 			"X.java",
1398 			"/** */\n" +
1399 			"public class X {\n" +
1400 			"	OK1 ok1;\n" +
1401 			"}",
1402 			"OK1.java",
1403 			"/** */\n" +
1404 			"public class OK1 {\n" +
1405 			"	// empty\n" +
1406 			"}"
1407 		},
1408         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1409         + " -1.5 -g -preserveAllLocals"
1410         + " -cp " + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
1411         + " -verbose -proceedOnError -referenceInfo"
1412         + " -d \"" + OUTPUT_DIR + "\"",
1413         TWO_FILES_GENERATED_MATCHER,
1414         EMPTY_STRING_MATCHER,
1415         true);
1416 }
1417 // command line - unusual classpath (empty)
1418 // ok provided we explicit the sourcepath
test018a()1419 public void test018a(){
1420 	String currentWorkingDirectoryPath = System.getProperty("user.dir");
1421 	if (currentWorkingDirectoryPath == null) {
1422 		System.err.println("BatchCompilerTest#18a could not access the current working directory " + currentWorkingDirectoryPath);
1423 	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
1424 		System.err.println("BatchCompilerTest#18a current working directory is not a directory " + currentWorkingDirectoryPath);
1425 	} else {
1426 		String xPath = currentWorkingDirectoryPath + File.separator + "X.java";
1427 		String ok1Path = currentWorkingDirectoryPath + File.separator + "OK1.java";
1428 		PrintWriter sourceFileWriter;
1429 		try {
1430 			File file = new File(xPath);
1431 			sourceFileWriter = new PrintWriter(new FileOutputStream(file));
1432 			try {
1433 				sourceFileWriter.write(
1434 					"/** */\n" +
1435 					"public class X {\n" +
1436 					"	OK1 ok1;\n" +
1437 					"}");
1438 			} finally {
1439 				sourceFileWriter.close();
1440 			}
1441 			file = new File(ok1Path);
1442 			sourceFileWriter = new PrintWriter(new FileOutputStream(file));
1443 			try {
1444 				sourceFileWriter.write(
1445 					"/** */\n" +
1446 					"public class OK1 {\n" +
1447 					"	// empty\n" +
1448 					"}");
1449 			} finally {
1450 				sourceFileWriter.close();
1451 			}
1452 			this.runTest(
1453 				true,
1454 				new String[] {
1455 					"dummy.java", // enforce output directory creation
1456 					""
1457 				},
1458 		        "X.java"
1459 		        + " -1.5 -g -preserveAllLocals"
1460 		        + " -verbose -proceedOnError"
1461 		        + " -sourcepath ."
1462 		        + " -d \"" + OUTPUT_DIR + "\"",
1463 		        TWO_FILES_GENERATED_MATCHER,
1464 		        EMPTY_STRING_MATCHER,
1465 		        false);
1466 		} catch (FileNotFoundException e) {
1467 			System.err.println("BatchCompilerTest#18a could not write to current working directory " + currentWorkingDirectoryPath);
1468 		} finally {
1469 			new File(xPath).delete();
1470 			new File(ok1Path).delete();
1471 		}
1472 	}
1473 }
1474 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=214725
1475 // empty sourcepath works with javac but not with ecj
_test018b()1476 public void _test018b(){
1477 	String currentWorkingDirectoryPath = System.getProperty("user.dir");
1478 	if (currentWorkingDirectoryPath == null) {
1479 		System.err.println("BatchCompilerTest#18b could not access the current working directory " + currentWorkingDirectoryPath);
1480 	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
1481 		System.err.println("BatchCompilerTest#18b current working directory is not a directory " + currentWorkingDirectoryPath);
1482 	} else {
1483 		String xPath = currentWorkingDirectoryPath + File.separator + "X.java";
1484 		String ok1Path = currentWorkingDirectoryPath + File.separator + "OK1.java";
1485 		PrintWriter sourceFileWriter;
1486 		try {
1487 			File file = new File(xPath);
1488 			sourceFileWriter = new PrintWriter(new FileOutputStream(file));
1489 			sourceFileWriter.write(
1490 				"/** */\n" +
1491 				"public class X {\n" +
1492 				"	OK1 ok1;\n" +
1493 				"}");
1494 			sourceFileWriter.close();
1495 			file = new File(ok1Path);
1496 			sourceFileWriter = new PrintWriter(new FileOutputStream(file));
1497 			sourceFileWriter.write(
1498 				"/** */\n" +
1499 				"public class OK1 {\n" +
1500 				"	// empty\n" +
1501 				"}");
1502 			sourceFileWriter.close();
1503 			this.runTest(
1504 				true,
1505 				new String[] {
1506 					"dummy.java", // enforce output directory creation
1507 					""
1508 				},
1509 		        "X.java"
1510 		        + " -1.5 -g -preserveAllLocals"
1511 		        + " -verbose -proceedOnError"
1512 		        + " -d \"" + OUTPUT_DIR + "\"",
1513 		        TWO_FILES_GENERATED_MATCHER,
1514 		        EMPTY_STRING_MATCHER,
1515 		        false);
1516 		} catch (FileNotFoundException e) {
1517 			System.err.println("BatchCompilerTest#18b could not write to current working directory " + currentWorkingDirectoryPath);
1518 		} finally {
1519 			new File(xPath).delete();
1520 			new File(ok1Path).delete();
1521 		}
1522 	}
1523 }
test019()1524 public void test019(){
1525 		this.runNegativeTest(
1526 			new String[] {
1527 				"X.java",
1528 				"/** */\n" +
1529 				"public class X {\n" +
1530 				"	OK1 ok1;\n" +
1531 				"	OK2 ok2;\n" +
1532 				"	Warn warn;\n" +
1533 				"	KO ko;\n" +
1534 		        "	Zork z;\n" +
1535 				"}",
1536 				"OK1.java",
1537 				"/** */\n" +
1538 				"public class OK1 {\n" +
1539 				"	// empty\n" +
1540 				"}",
1541 				"OK2.java",
1542 				"/** */\n" +
1543 				"public class OK2 {\n" +
1544 				"	// empty\n" +
1545 				"}",
1546 				"Warn.java",
1547 				"/** */\n" +
1548 				"public class Warn {\n" +
1549 				"	// empty\n" +
1550 				"}",
1551 				"KO.java",
1552 				"/** */\n" +
1553 				"public class KO {\n" +
1554 				"	// empty\n" +
1555 				"}",
1556 			},
1557 	        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1558 	        + " -1.5 -g -preserveAllLocals"
1559 	        + " -cp \"" + OUTPUT_DIR + "[+OK2" + File.pathSeparator + "~Warn" + File.pathSeparator + "-KO]\""
1560 	        + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
1561 	        + " -proceedOnError -referenceInfo"
1562 	        + " -d \"" + OUTPUT_DIR + "\"",
1563 	        "",
1564 			"----------\n" +
1565 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
1566 			"	Warn warn;\n" +
1567 			"	^^^^\n" +
1568 			"Discouraged access: The type \'Warn\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
1569 			"----------\n" +
1570 			"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
1571 			"	KO ko;\n" +
1572 			"	^^\n" +
1573 			"Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
1574 			"----------\n" +
1575 			"3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
1576 			"	Zork z;\n" +
1577 			"	^^^^\n" +
1578 			"Zork cannot be resolved to a type\n" +
1579 			"----------\n" +
1580 			"3 problems (1 error, 2 warnings)\n",
1581 	        true);
1582 	}
1583 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - skip options -O -Jxxx and -Xxxx, multiple times if needed
test020()1584 	public void test020(){
1585 		this.runConformTest(
1586 			new String[] {
1587 					"X.java",
1588 					"/** */\n" +
1589 					"public class X {\n" +
1590 					"}",
1591 			},
1592 	        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1593 	        + " -1.5 -g -preserveAllLocals"
1594 	        + " -verbose -proceedOnError -referenceInfo"
1595 	        + " -d \"" + OUTPUT_DIR + "\" -O -Xxxx -O -Jxyz -Xtyu -Jyu",
1596 			"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
1597 			"[reading    java/lang/Object.class]\n" +
1598 			"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
1599 			"[writing    X.class - #1]\n" +
1600 			"[completed  ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" +
1601 			"[1 unit compiled]\n" +
1602 			"[1 .class file generated]\n",
1603 	        "",
1604 	        true);
1605 	}
1606 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - -sourcepath finds additional source files
test021()1607 	public void test021(){
1608 		String setting= System.getProperty("jdt.compiler.useSingleThread");
1609 		try {
1610 			System.setProperty("jdt.compiler.useSingleThread", "true");
1611 			this.runConformTest(
1612 				new String[] {
1613 						"src1/X.java",
1614 						"/** */\n" +
1615 						"public class X {\n" +
1616 						"}",
1617 						"src2/Y.java",
1618 						"/** */\n" +
1619 						"public class Y extends X {\n" +
1620 						"}",
1621 				},
1622 		        "\"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
1623 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src1\""
1624 				  + File.pathSeparator + "\"" + OUTPUT_DIR +  File.separator + "src2\""
1625 		        + " -1.5 -g -preserveAllLocals"
1626 		        + " -verbose -proceedOnError -referenceInfo"
1627 		        + " -d \"" + OUTPUT_DIR + "\" ",
1628 				"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/1]\n" +
1629 				"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1630 				"[reading    java/lang/Object.class]\n" +
1631 				"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/2]\n" +
1632 				"[writing    Y.class - #1]\n" +
1633 				"[completed  ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/2]\n" +
1634 				"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1635 				"[writing    X.class - #2]\n" +
1636 				"[completed  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1637 				"[2 units compiled]\n" +
1638 				"[2 .class files generated]\n",
1639 		        "",
1640 		        true);
1641 		} finally {
1642 			System.setProperty("jdt.compiler.useSingleThread", setting == null ? "false" : setting);
1643 		}
1644 	}
1645 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - repeated -sourcepath fails - even if the error is more
1646 // explicit here than what javac does
test022_repeated_sourcepath()1647 	public void test022_repeated_sourcepath(){
1648 		this.runNegativeTest(
1649 			new String[] {
1650 					"src1/X.java",
1651 					"/** */\n" +
1652 					"public class X {\n" +
1653 					"}",
1654 					"src2/Y.java",
1655 					"/** */\n" +
1656 					"public class Y extends X {\n" +
1657 					"}",
1658 			},
1659 			" -sourcepath \"" + OUTPUT_DIR +  File.separator + "src1\""
1660 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src2\""
1661 	        + " \"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
1662 	        + " -1.5 -g -preserveAllLocals"
1663 	        + " -verbose -proceedOnError -referenceInfo"
1664 	        + " -d \"" + OUTPUT_DIR + "\" ",
1665 	        "",
1666 	        "duplicate sourcepath specification: -sourcepath ---OUTPUT_DIR_PLACEHOLDER---/src2\n",
1667 	        true);
1668 	}
1669 //	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - repeated -extdirs fails
test023()1670 	public void test023(){
1671 		this.runNegativeTest(
1672 			new String[] {
1673 					"src1/X.java",
1674 					"/** */\n" +
1675 					"public class X {\n" +
1676 					"}",
1677 					"src2/Y.java",
1678 					"/** */\n" +
1679 					"public class Y extends X {\n" +
1680 					"}",
1681 			},
1682 			" -extdirs \"" + OUTPUT_DIR +  File.separator + "src1\""
1683 			+ " -extdirs \"" + OUTPUT_DIR +  File.separator + "src2\""
1684 	        + " \"" + OUTPUT_DIR +  File.separator + "src1" + File.separator + "X.java\""
1685 	        + " -1.5 -g -preserveAllLocals"
1686 	        + " -verbose -proceedOnError -referenceInfo"
1687 	        + " -d \"" + OUTPUT_DIR + "\" ",
1688 	        "",
1689 	        "duplicate extdirs specification: -extdirs ---OUTPUT_DIR_PLACEHOLDER---/src2\n",
1690 	        true);
1691 	}
1692 //	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - explicit empty -extdirs removes extensions
test024()1693 	public void test024(){
1694 		if (!System.getProperty("java.vm.vendor").equals("Sun Microsystems Inc.")) return;
1695 		/* this tests is using Sun vm layout. The type sun.net.spi.nameservice.dns.DNSNameService
1696 		 * is located in the ext dir.
1697 		 */
1698 		this.runNegativeTest(
1699 				new String[] {
1700 						"X.java",
1701 						"/** */\n" +
1702 						"public class X {\n" +
1703 						"  sun.net.spi.nameservice.dns.DNSNameService dummy;\n" +
1704 						"}",
1705 				},
1706 				"\"" + OUTPUT_DIR +  File.separator + "X.java\""
1707 				+ " -extdirs \"\""
1708 				+ " -1.5 -g -preserveAllLocals"
1709 				+ " -proceedOnError -referenceInfo"
1710 				+ " -d \"" + OUTPUT_DIR + "\" ",
1711 				"",
1712 				"----------\n" +
1713 				"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
1714 				"	sun.net.spi.nameservice.dns.DNSNameService dummy;\n" +
1715 				"	^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
1716 				"sun.net.spi.nameservice.dns cannot be resolved to a type\n" +
1717 				"----------\n" +
1718 				"1 problem (1 error)\n",
1719 				true);
1720 	}
1721 //	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - cumulative -extdirs extends the classpath
test025()1722 	public void test025() throws Exception {
1723 		String path = LIB_DIR;
1724 		String libPath = null;
1725 		if (path.endsWith(File.separator)) {
1726 			libPath = path + "lib.jar";
1727 		} else {
1728 			libPath = path + File.separator + "lib.jar";
1729 		}
1730 		String setting= System.getProperty("jdt.compiler.useSingleThread");
1731 		try {
1732 			Util.createJar(new String[] {
1733 					"my/pkg/Zork.java",
1734 					"package my.pkg;\n" +
1735 					"public class Zork {\n" +
1736 					"}",
1737 				},
1738 				libPath,
1739 				JavaCore.VERSION_1_4);
1740 			System.setProperty("jdt.compiler.useSingleThread", "true");
1741 			this.runConformTest(
1742 				new String[] {
1743 						"src1/X.java",
1744 						"/** */\n" +
1745 						"public class X {\n" +
1746 						"  my.pkg.Zork dummy;\n" +
1747 						"}",
1748 						"src2/Y.java",
1749 						"/** */\n" +
1750 						"public class Y extends X {\n" +
1751 						"}",
1752 				},
1753 		        "\"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
1754 				+ " -extdirs \"" + path + File.pathSeparator + OUTPUT_DIR +  File.separator + "src1\""
1755 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src1\""
1756 		        + " -1.5 -g -preserveAllLocals"
1757 		        + " -verbose -proceedOnError -referenceInfo"
1758 		        + " -d \"" + OUTPUT_DIR + "\" ",
1759 		        "[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/1]\n" +
1760 		        "[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1761 		        "[reading    java/lang/Object.class]\n" +
1762 		        "[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/2]\n" +
1763 		        "[writing    Y.class - #1]\n" +
1764 		        "[completed  ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/2]\n" +
1765 		        "[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1766 		        "[reading    my/pkg/Zork.class]\n" +
1767 		        "[writing    X.class - #2]\n" +
1768 		        "[completed  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1769 		        "[2 units compiled]\n" +
1770 		        "[2 .class files generated]\n",
1771 		        "",
1772 		        true);
1773 		} finally {
1774 			System.setProperty("jdt.compiler.useSingleThread", setting == null ? "false" : setting);
1775 			Util.delete(libPath);
1776 		}
1777 	}
1778 //	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - -extdirs extends the classpath before -classpath
test026()1779 	public void test026(){
1780 		String setting= System.getProperty("jdt.compiler.useSingleThread");
1781 		try {
1782 			System.setProperty("jdt.compiler.useSingleThread", "true");
1783 			this.runConformTest(
1784 				new String[] {
1785 						"src1/X.java",
1786 						"/** */\n" +
1787 						"public class X {\n" +
1788 						"}",
1789 						"src2/Y.java",
1790 						"/** */\n" +
1791 						"public class Y extends X {\n" +
1792 						"}",
1793 						"src3/X.java",
1794 						"/** */\n" +
1795 						"public class X {\n" +
1796 						"  Zork error;\n" +
1797 						"}",
1798 				},
1799 		        "\"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
1800 				+ " -classpath \"" + OUTPUT_DIR +  File.separator + "src3\""
1801 				+ " -extdirs \"" + getExtDirectory() + File.pathSeparator + OUTPUT_DIR +  File.separator + "src1\""
1802 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src2" + File.pathSeparator + OUTPUT_DIR +  File.separator + "src1\""
1803 		        + " -1.5 -g -preserveAllLocals"
1804 		        + " -verbose -proceedOnError -referenceInfo"
1805 		        + " -d \"" + OUTPUT_DIR + "\" ",
1806 				"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/1]\n" +
1807 				"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1808 				"[reading    java/lang/Object.class]\n" +
1809 				"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/2]\n" +
1810 				"[writing    Y.class - #1]\n" +
1811 				"[completed  ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java - #1/2]\n" +
1812 				"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1813 				"[writing    X.class - #2]\n" +
1814 				"[completed  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #2/2]\n" +
1815 				"[2 units compiled]\n" +
1816 				"[2 .class files generated]\n",
1817 				"",
1818 		        true);
1819 		} finally {
1820 			System.setProperty("jdt.compiler.useSingleThread", setting == null ? "false" : setting);
1821 		}
1822 	}
1823 
test027()1824 public void test027(){
1825 	this.runNegativeTest(
1826 		new String[] {
1827 			"X.java",
1828 			"/** */\n" +
1829 			"public class X {\n" +
1830 			"	OK1 ok1;\n" +
1831 			"	OK2 ok2;\n" +
1832 			"	Warn warn;\n" +
1833 			"	KO ko;\n" +
1834 	        "	Zork z;\n" +
1835 			"}",
1836 			"OK1.java",
1837 			"/** */\n" +
1838 			"public class OK1 {\n" +
1839 			"	// empty\n" +
1840 			"}",
1841 			"OK2.java",
1842 			"/** */\n" +
1843 			"public class OK2 {\n" +
1844 			"	// empty\n" +
1845 			"}",
1846 			"p1/Warn.java",
1847 			"/** */\n" +
1848 			"public class Warn {\n" +
1849 			"	// empty\n" +
1850 			"}",
1851 			"KO.java",
1852 			"/** */\n" +
1853 			"public class KO {\n" +
1854 			"	// empty\n" +
1855 			"}",
1856 		},
1857         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1858         + " -1.5 -g -preserveAllLocals"
1859         + " -cp \"" + OUTPUT_DIR + "[+OK2" + File.pathSeparator + "-KO]" + File.pathSeparator
1860         + OUTPUT_DIR + File.separator + "p1[~Warn]\""
1861         + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
1862         // TODO (maxime) reintroduce the -verbose option to check the number of files
1863         //               generated, once able to avoid console echoing
1864         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
1865         "",
1866         "----------\n" +
1867         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
1868         "	Warn warn;\n" +
1869         "	^^^^\n" +
1870         "Discouraged access: The type \'Warn\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/p1\')\n" +
1871         "----------\n" +
1872         "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
1873         "	KO ko;\n" +
1874         "	^^\n" +
1875         "Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
1876         "----------\n" +
1877         "3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
1878         "	Zork z;\n" +
1879         "	^^^^\n" +
1880         "Zork cannot be resolved to a type\n" +
1881         "----------\n" +
1882         "3 problems (1 error, 2 warnings)\n",
1883         true);
1884 }
test028()1885 public void test028(){
1886 			this.runConformTest(
1887 				new String[] {
1888 					"src1/X.java",
1889 					"/** */\n" +
1890 					"public class X {\n" +
1891 					"}",
1892 				},
1893 		        "\"" + OUTPUT_DIR +  File.separator + "src1/X.java\""
1894 		        + " -1.5 -g -preserveAllLocals"
1895 		        + " -proceedOnError -referenceInfo"
1896 		        + " -d \"" + OUTPUT_DIR + File.separator + "bin/\"",
1897 		        "",
1898 		        "",
1899 		        true);
1900 			this.runConformTest(
1901 				new String[] {
1902 					"src2/Y.java",
1903 					"/** */\n" +
1904 					"public class Y extends X {\n" +
1905 					"}",
1906 				},
1907 		        "\"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
1908 		        + " -1.5 -g -preserveAllLocals"
1909 		        + " -cp dummy" + File.pathSeparator + "\"" + OUTPUT_DIR + File.separator + "bin\"" + File.pathSeparator + "dummy"
1910 		        + " -proceedOnError -referenceInfo"
1911 		        + " -d \"" + OUTPUT_DIR + File.separator + "bin/\"",
1912 		        "",
1913 		        "incorrect classpath: dummy\n" +
1914 		        "incorrect classpath: dummy\n",
1915 		        false);
1916 		}
1917 //Extraneous auto-build error message - https://bugs.eclipse.org/bugs/show_bug.cgi?id=93377
test030()1918 public void test030(){
1919 	// first series shows that a clean build is OK
1920 	this.runConformTest(
1921 		new String[] {
1922 			"X.java",
1923 			"public interface X<T extends X<T, K, S>, \n" +
1924 			"                   K extends X.K<T, S>, \n" +
1925 			"                   S extends X.S> {\n" +
1926 			"	public interface K<KT extends X<KT, ?, KS>, \n" +
1927 			"	                   KS extends X.S> {\n" +
1928 			"	}\n" +
1929 			"	public interface S {\n" +
1930 			"	}\n" +
1931 			"}\n",
1932 			"Y.java",
1933 			"public class Y<T extends X<T, K, S>, \n" +
1934 			"               K extends X.K<T, S>, \n" +
1935 			"               S extends X.S> { \n" +
1936 			"}\n",
1937 		},
1938         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
1939         + " -1.5 -g -preserveAllLocals"
1940         + " -cp \"" + OUTPUT_DIR + File.separator + "\""
1941         + " -proceedOnError -referenceInfo"
1942         + " -d \"" + OUTPUT_DIR + "\"",
1943         "",
1944         "",
1945         true);
1946 	// second series shows that a staged build - that simulates the auto build context - is OK as well
1947 	this.runConformTest(
1948 		new String[] {
1949 			"X.java",
1950 			"public interface X<T extends X<T, K, S>, \n" +
1951 			"                   K extends X.K<T, S>, \n" +
1952 			"                   S extends X.S> {\n" +
1953 			"	public interface K<KT extends X<KT, ?, KS>, \n" +
1954 			"	                   KS extends X.S> {\n" +
1955 			"	}\n" +
1956 			"	public interface S {\n" +
1957 			"	}\n" +
1958 			"}\n",
1959 		},
1960         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
1961         + " -1.5 -g -preserveAllLocals"
1962         + " -proceedOnError -referenceInfo"
1963         + " -d \"" + OUTPUT_DIR + "\"",
1964         "",
1965         "",
1966         true);
1967 	this.runConformTest(
1968 		new String[] {
1969 			"Y.java",
1970 			"public class Y<T extends X<T, K, S>, \n" +
1971 			"               K extends X.K<T, S>, \n" +
1972 			"               S extends X.S> { \n" +
1973 			"}\n",
1974 		},
1975         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
1976         + " -1.5 -g -preserveAllLocals"
1977         + " -cp \"" + OUTPUT_DIR + File.separator + "\""
1978         + " -proceedOnError -referenceInfo"
1979         + " -d \"" + OUTPUT_DIR + "\"",
1980         "",
1981         "",
1982         false);
1983 }
1984 // Extraneous auto-build error message - https://bugs.eclipse.org/bugs/show_bug.cgi?id=93377
1985 // More complex test case than test30
test032()1986 public void test032(){
1987 	// first series shows that a clean build is OK (warning messages only)
1988 	this.runConformTest(
1989 			new String[] {
1990 				"p/X.java",
1991 				"package p;\n" +
1992 				"import java.io.Serializable;\n" +
1993 				"public interface X<T extends X<T, U, V>, \n" +
1994 				"				   U extends X.XX<T, V>, \n" +
1995 				"				   V extends X.XY> {\n" +
1996 				"	public interface XX<TT extends X<TT, ?, UU>, \n" +
1997 				"	                    UU extends X.XY> \n" +
1998 				"			extends	Serializable {\n" +
1999 				"	}\n" +
2000 				"	public interface XY extends Serializable {\n" +
2001 				"	}\n" +
2002 				"}\n",
2003 				"p/Y.java",
2004 				"package p;\n" +
2005 				"import java.util.*;\n" +
2006 				"import p.X.*;\n" +
2007 				"public class Y<T extends X<T, U, V>, \n" +
2008 				"               U extends X.XX<T, V>, \n" +
2009 				"               V extends X.XY> {\n" +
2010 				"	private final Map<U, V> m1 = new HashMap<U, V>();\n" +
2011 				"	private final Map<U, T> m2 = new HashMap<U, T>();\n" +
2012 				"	private final Z m3;\n" +
2013 				"\n" +
2014 				"	public Y(final Z p1) {\n" +
2015 				"		this.m3 = p1;\n" +
2016 				"	}\n" +
2017 				"\n" +
2018 				"	public void foo1(final U p1, final V p2, final T p3) {\n" +
2019 				"		m1.put(p1, p2);\n" +
2020 				"		m2.put(p1, p3);\n" +
2021 				"		m3.foo2(p1, p2);\n" +
2022 				"	}\n" +
2023 				"\n" +
2024 				"	public void foo3(final U p1) {\n" +
2025 				"		assert m1.containsKey(p1);\n" +
2026 				"		m1.remove(p1);\n" +
2027 				"		m2.remove(p1);\n" +
2028 				"		m3.foo2(p1, null);\n" +
2029 				"	}\n" +
2030 				"\n" +
2031 				"	public Collection<T> foo4() {\n" +
2032 				"		return Collections.unmodifiableCollection(m2.values());\n" +
2033 				"	}\n" +
2034 				"\n" +
2035 				"	public void foo5(final Map<XX<?, ?>, XY> p1) {\n" +
2036 				"		p1.putAll(m1);\n" +
2037 				"	}\n" +
2038 				"	public void foo6(final Map<XX<?, ?>, XY> p1) {\n" +
2039 				"		m1.keySet().retainAll(p1.keySet());\n" +
2040 				"		m2.keySet().retainAll(p1.keySet());\n" +
2041 				"	}\n" +
2042 				"}\n",
2043 				"p/Z.java",
2044 				"package p;\n" +
2045 				"\n" +
2046 				"import java.util.*;\n" +
2047 				"\n" +
2048 				"import p.X.*;\n" +
2049 				"\n" +
2050 				"public class Z {\n" +
2051 				"	private final Map<Class<? extends X>, \n" +
2052 				"		              Y<?, ? extends XX<?, ?>, ? extends XY>> \n" +
2053 				"		m1 = new HashMap<Class<? extends X>, \n" +
2054 				"		                 Y<?, ? extends XX<?, ?>, ? extends XY>>();\n" +
2055 				"\n" +
2056 				"	private Map<X.XX<?, XY>, \n" +
2057 				"	            X.XY> \n" +
2058 				"		m2 = new HashMap<X.XX<?, XY>, \n" +
2059 				"		                 X.XY>();\n" +
2060 				"\n" +
2061 				"	public <T extends X<T, U, V>, \n" +
2062 				"	        U extends X.XX<T, V>, \n" +
2063 				"	        V extends X.XY> \n" +
2064 				"	Y<T, U, V> foo1(final Class<T> p1) {\n" +
2065 				"		Y l1 = m1.get(p1);\n" +
2066 				"		if (l1 == null) {\n" +
2067 				"			l1 = new Y<T, U, V>(this);\n" +
2068 				"			m1.put(p1, l1);\n" +
2069 				"		}\n" +
2070 				"		return l1;\n" +
2071 				"	}\n" +
2072 				"\n" +
2073 				"	public <TT extends X.XX<?, UU>, \n" +
2074 				"	        UU extends X.XY> \n" +
2075 				"	void foo2(final TT p1, final UU p2) {\n" +
2076 				"		m2.put((XX<?, XY>) p1, p2);\n" +
2077 				"	}\n" +
2078 				"\n" +
2079 				"	public Map<XX<?, ?>, XY> foo3() {\n" +
2080 				"		final Map<XX<?, ?>, \n" +
2081 				"		          XY> l1 = new HashMap<XX<?, ?>, \n" +
2082 				"		                               XY>();\n" +
2083 				"		for (final Y<?, \n" +
2084 				"				     ? extends XX<?, ?>, \n" +
2085 				"				     ? extends XY> \n" +
2086 				"				i : m1.values()) {\n" +
2087 				"			i.foo5(l1);\n" +
2088 				"		}\n" +
2089 				"		return l1;\n" +
2090 				"	}\n" +
2091 				"\n" +
2092 				"	public void foo4(final Object p1, final Map<XX<?, ?>, \n" +
2093 				"			                                    XY> p2) {\n" +
2094 				"		for (final Y<?, \n" +
2095 				"				     ? extends XX<?, ?>, \n" +
2096 				"				     ? extends XY> i : m1.values()) {\n" +
2097 				"			i.foo6(p2);\n" +
2098 				"		}\n" +
2099 				"		for (final Map.Entry<XX<?, ?>, \n" +
2100 				"				             XY> i : p2.entrySet()) {\n" +
2101 				"			final XX<?, XY> l1 = (XX<?, XY>) i.getKey();\n" +
2102 				"		}\n" +
2103 				"	}\n" +
2104 				"}\n"
2105 			},
2106 	        "\"" + OUTPUT_DIR +  File.separator + "p/X.java\""
2107 	        + " \"" + OUTPUT_DIR +  File.separator + "p/Y.java\""
2108 	        + " \"" + OUTPUT_DIR +  File.separator + "p/Z.java\""
2109 	        + " -1.5 -g -preserveAllLocals"
2110 	        + " -cp \"" + OUTPUT_DIR + File.separator + "\""
2111 	        + " -proceedOnError -referenceInfo"
2112 	        + " -d \"" + OUTPUT_DIR + "\"",
2113 	        "",
2114 	        "----------\n" +
2115 	        "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 8)\n" +
2116 	        "	private final Map<Class<? extends X>, \n" +
2117 	        "	                                  ^\n" +
2118 	        "X is a raw type. References to generic type X<T,U,V> should be parameterized\n" +
2119 	        "----------\n" +
2120 	        "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 10)\n" +
2121 	        "	m1 = new HashMap<Class<? extends X>, \n" +
2122 	        "	                                 ^\n" +
2123 	        "X is a raw type. References to generic type X<T,U,V> should be parameterized\n" +
2124 	        "----------\n" +
2125 	        "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 22)\n" +
2126 	        "	Y l1 = m1.get(p1);\n" +
2127 	        "	^\n" +
2128 	        "Y is a raw type. References to generic type Y<T,U,V> should be parameterized\n" +
2129 	        "----------\n" +
2130 	        "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 25)\n" +
2131 	        "	m1.put(p1, l1);\n" +
2132 	        "	           ^^\n" +
2133 	        "Type safety: The expression of type Y needs unchecked conversion to conform to Y<?,? extends X.XX<?,?>,? extends X.XY>\n" +
2134 	        "----------\n" +
2135 	        "5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 27)\n" +
2136 	        "	return l1;\n" +
2137 	        "	       ^^\n" +
2138 	        "Type safety: The expression of type Y needs unchecked conversion to conform to Y<T,U,V>\n" +
2139 	        "----------\n" +
2140 	        "6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 33)\n" +
2141 	        "	m2.put((XX<?, XY>) p1, p2);\n" +
2142 	        "	       ^^^^^^^^^^^^^^\n" +
2143 	        "Type safety: Unchecked cast from TT to X.XX<?,X.XY>\n" +
2144 	        "----------\n" +
2145 	        "7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 58)\n" +
2146 	        "	final XX<?, XY> l1 = (XX<?, XY>) i.getKey();\n" +
2147 	        "	                ^^\n" +
2148 	        "The value of the local variable l1 is not used\n" +
2149 	        "----------\n" +
2150 	        "8. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 58)\n" +
2151 	        "	final XX<?, XY> l1 = (XX<?, XY>) i.getKey();\n" +
2152 	        "	                     ^^^^^^^^^^^^^^^^^^^^^^\n" +
2153 	        "Type safety: Unchecked cast from X.XX<capture#22-of ?,capture#23-of ?> to X.XX<?,X.XY>\n" +
2154 	        "----------\n" +
2155 	        "8 problems (8 warnings)\n",
2156 	        true);
2157 	// second series shows that a staged build - that simulates the auto build context - is OK as well
2158 	this.runConformTest(
2159 		new String[] {
2160 			"p/X.java",
2161 			"package p;\n" +
2162 			"import java.io.Serializable;\n" +
2163 			"public interface X<T extends X<T, U, V>, \n" +
2164 			"				   U extends X.XX<T, V>, \n" +
2165 			"				   V extends X.XY> {\n" +
2166 			"	public interface XX<TT extends X<TT, ?, UU>, \n" +
2167 			"	                    UU extends X.XY> \n" +
2168 			"			extends	Serializable {\n" +
2169 			"	}\n" +
2170 			"	public interface XY extends Serializable {\n" +
2171 			"	}\n" +
2172 			"}\n",
2173 		},
2174         "\"" + OUTPUT_DIR +  File.separator + "p/X.java\""
2175         + " -1.5 -g -preserveAllLocals"
2176         + " -proceedOnError -referenceInfo"
2177         + " -d \"" + OUTPUT_DIR + "\"",
2178         "",
2179         "",
2180         true);
2181 	this.runConformTest(
2182 		new String[] {
2183 			"p/Y.java",
2184 			"package p;\n" +
2185 			"import java.util.*;\n" +
2186 			"import p.X.*;\n" +
2187 			"public class Y<T extends X<T, U, V>, \n" +
2188 			"               U extends X.XX<T, V>, \n" +
2189 			"               V extends X.XY> {\n" +
2190 			"	private final Map<U, V> m1 = new HashMap<U, V>();\n" +
2191 			"	private final Map<U, T> m2 = new HashMap<U, T>();\n" +
2192 			"	private final Z m3;\n" +
2193 			"\n" +
2194 			"	public Y(final Z p1) {\n" +
2195 			"		this.m3 = p1;\n" +
2196 			"	}\n" +
2197 			"\n" +
2198 			"	public void foo1(final U p1, final V p2, final T p3) {\n" +
2199 			"		m1.put(p1, p2);\n" +
2200 			"		m2.put(p1, p3);\n" +
2201 			"		m3.foo2(p1, p2);\n" +
2202 			"	}\n" +
2203 			"\n" +
2204 			"	public void foo3(final U p1) {\n" +
2205 			"		assert m1.containsKey(p1);\n" +
2206 			"		m1.remove(p1);\n" +
2207 			"		m2.remove(p1);\n" +
2208 			"		m3.foo2(p1, null);\n" +
2209 			"	}\n" +
2210 			"\n" +
2211 			"	public Collection<T> foo4() {\n" +
2212 			"		return Collections.unmodifiableCollection(m2.values());\n" +
2213 			"	}\n" +
2214 			"\n" +
2215 			"	public void foo5(final Map<XX<?, ?>, XY> p1) {\n" +
2216 			"		p1.putAll(m1);\n" +
2217 			"	}\n" +
2218 			"	public void foo6(final Map<XX<?, ?>, XY> p1) {\n" +
2219 			"		m1.keySet().retainAll(p1.keySet());\n" +
2220 			"		m2.keySet().retainAll(p1.keySet());\n" +
2221 			"	}\n" +
2222 			"}\n",
2223 			"p/Z.java",
2224 			"package p;\n" +
2225 			"\n" +
2226 			"import java.util.*;\n" +
2227 			"\n" +
2228 			"import p.X.*;\n" +
2229 			"\n" +
2230 			"public class Z {\n" +
2231 			"	private final Map<Class<? extends X>, \n" +
2232 			"		              Y<?, ? extends XX<?, ?>, ? extends XY>> \n" +
2233 			"		m1 = new HashMap<Class<? extends X>, \n" +
2234 			"		                 Y<?, ? extends XX<?, ?>, ? extends XY>>();\n" +
2235 			"\n" +
2236 			"	private Map<X.XX<?, XY>, \n" +
2237 			"	            X.XY> \n" +
2238 			"		m2 = new HashMap<X.XX<?, XY>, \n" +
2239 			"		                 X.XY>();\n" +
2240 			"\n" +
2241 			"	public <T extends X<T, U, V>, \n" +
2242 			"	        U extends X.XX<T, V>, \n" +
2243 			"	        V extends X.XY> \n" +
2244 			"	Y<T, U, V> foo1(final Class<T> p1) {\n" +
2245 			"		Y l1 = m1.get(p1);\n" +
2246 			"		if (l1 == null) {\n" +
2247 			"			l1 = new Y<T, U, V>(this);\n" +
2248 			"			m1.put(p1, l1);\n" +
2249 			"		}\n" +
2250 			"		return l1;\n" +
2251 			"	}\n" +
2252 			"\n" +
2253 			"	public <TT extends X.XX<?, UU>, \n" +
2254 			"	        UU extends X.XY> \n" +
2255 			"	void foo2(final TT p1, final UU p2) {\n" +
2256 			"		m2.put((XX<?, XY>) p1, p2);\n" +
2257 			"	}\n" +
2258 			"\n" +
2259 			"	public Map<XX<?, ?>, XY> foo3() {\n" +
2260 			"		final Map<XX<?, ?>, \n" +
2261 			"		          XY> l1 = new HashMap<XX<?, ?>, \n" +
2262 			"		                               XY>();\n" +
2263 			"		for (final Y<?, \n" +
2264 			"				     ? extends XX<?, ?>, \n" +
2265 			"				     ? extends XY> \n" +
2266 			"				i : m1.values()) {\n" +
2267 			"			i.foo5(l1);\n" +
2268 			"		}\n" +
2269 			"		return l1;\n" +
2270 			"	}\n" +
2271 			"\n" +
2272 			"	public void foo4(final Object p1, final Map<XX<?, ?>, \n" +
2273 			"			                                    XY> p2) {\n" +
2274 			"		for (final Y<?, \n" +
2275 			"				     ? extends XX<?, ?>, \n" +
2276 			"				     ? extends XY> i : m1.values()) {\n" +
2277 			"			i.foo6(p2);\n" +
2278 			"		}\n" +
2279 			"		for (final Map.Entry<XX<?, ?>, \n" +
2280 			"				             XY> i : p2.entrySet()) {\n" +
2281 			"			final XX<?, XY> l1 = (XX<?, XY>) i.getKey();\n" +
2282 			"		}\n" +
2283 			"	}\n" +
2284 			"}\n"
2285 		},
2286         "\"" + OUTPUT_DIR +  File.separator + "p/Y.java\""
2287         + " \"" + OUTPUT_DIR +  File.separator + "p/Z.java\""
2288         + " -1.5 -g -preserveAllLocals"
2289         + " -cp \"" + OUTPUT_DIR + File.separator + "\""
2290         + " -proceedOnError -referenceInfo"
2291         + " -d \"" + OUTPUT_DIR + "\"",
2292         "",
2293         "----------\n" +
2294         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 8)\n" +
2295         "	private final Map<Class<? extends X>, \n" +
2296         "	                                  ^\n" +
2297         "X is a raw type. References to generic type X<T,U,V> should be parameterized\n" +
2298         "----------\n" +
2299         "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 10)\n" +
2300         "	m1 = new HashMap<Class<? extends X>, \n" +
2301         "	                                 ^\n" +
2302         "X is a raw type. References to generic type X<T,U,V> should be parameterized\n" +
2303         "----------\n" +
2304         "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 22)\n" +
2305         "	Y l1 = m1.get(p1);\n" +
2306         "	^\n" +
2307         "Y is a raw type. References to generic type Y<T,U,V> should be parameterized\n" +
2308         "----------\n" +
2309         "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 25)\n" +
2310         "	m1.put(p1, l1);\n" +
2311         "	           ^^\n" +
2312         "Type safety: The expression of type Y needs unchecked conversion to conform to Y<?,? extends X.XX<?,?>,? extends X.XY>\n" +
2313         "----------\n" +
2314         "5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 27)\n" +
2315         "	return l1;\n" +
2316         "	       ^^\n" +
2317         "Type safety: The expression of type Y needs unchecked conversion to conform to Y<T,U,V>\n" +
2318         "----------\n" +
2319         "6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 33)\n" +
2320         "	m2.put((XX<?, XY>) p1, p2);\n" +
2321         "	       ^^^^^^^^^^^^^^\n" +
2322         "Type safety: Unchecked cast from TT to X.XX<?,X.XY>\n" +
2323         "----------\n" +
2324         "7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 58)\n" +
2325         "	final XX<?, XY> l1 = (XX<?, XY>) i.getKey();\n" +
2326         "	                ^^\n" +
2327         "The value of the local variable l1 is not used\n" +
2328         "----------\n" +
2329         "8. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/Z.java (at line 58)\n" +
2330         "	final XX<?, XY> l1 = (XX<?, XY>) i.getKey();\n" +
2331         "	                     ^^^^^^^^^^^^^^^^^^^^^^\n" +
2332         "Type safety: Unchecked cast from X.XX<capture#22-of ?,capture#23-of ?> to X.XX<?,X.XY>\n" +
2333         "----------\n" +
2334         "8 problems (8 warnings)\n",
2335         false);
2336 }
2337 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=104664
test033()2338 public void test033(){
2339 	this.runConformTest(
2340 		new String[] {
2341 			"X.java",
2342 			"/** */\n" +
2343 			"public class X {\n" +
2344 			"}",
2345 		},
2346         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2347         + " -1.5 -g -preserveAllLocals"
2348         + " -cp \"" + OUTPUT_DIR
2349         + "\"" + File.pathSeparator
2350         + " -repeat 2 -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2351         "[repetition 1/2]\n" +
2352         "[repetition 2/2]\n",
2353         "",
2354         true);
2355 }
test034()2356 public void test034(){
2357 	this.runConformTest(
2358 		new String[] {
2359 			"X.java",
2360 			"/** */\n" +
2361 			"public class X {\n" +
2362 			"}",
2363 		},
2364         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2365         + " -1.5 -g -preserveAllLocals"
2366         + " -cp " + File.pathSeparator + "\"" + OUTPUT_DIR
2367         + "\"" + File.pathSeparator
2368         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2369         "",
2370         "",
2371         true);
2372 }
2373 // check classpath value
test035()2374 public void test035(){
2375 	final String javaClassspath = System.getProperty("java.class.path");
2376 	final String javaUserDir = System.getProperty("user.dir");
2377 	try {
2378 		System.setProperty("user.dir", OUTPUT_DIR);
2379 		this.runConformTest(
2380 			new String[] {
2381 				"p/Y.java",
2382 				"package p;\n" +
2383 				"public class Y { public static final String S = \"\"; }",
2384 			},
2385 	        "\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "Y.java\""
2386 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
2387 	        "",
2388 	        "",
2389 	        true);
2390 		System.setProperty("java.class.path", "");
2391 		this.runConformTest(
2392 				new String[] {
2393 					"X.java",
2394 					"import p.Y;\n" +
2395 					"public class X {\n" +
2396 					"	public static void main(String[] args) {\n" +
2397 					"		System.out.print(Y.S);\n" +
2398 					"	}\n" +
2399 					"}",
2400 				},
2401 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2402 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
2403 		        "",// this is not the runtime output
2404 		        "no classpath defined, using default directory instead\n",
2405 		        false);
2406 		final String userDir = System.getProperty("user.dir");
2407 		File f = new File(userDir, "X.java");
2408 		if (!Util.delete(f)) {
2409 			System.out.println("Could not delete X");
2410 		}
2411 		f = new File(userDir, "p" + File.separator + "Y.java");
2412 		if (!Util.delete(f)) {
2413 			System.out.println("Could not delete Y");
2414 		}
2415 
2416 	} finally {
2417 		System.setProperty("java.class.path", javaClassspath);
2418 		System.setProperty("user.dir", javaUserDir);
2419 	}
2420 }
2421 
2422 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=119108
2423 // \ in call to AccessRulesSet.getViolatedRestriction
test036()2424 public void test036(){
2425 	this.runConformTest(
2426 		new String[] {
2427 			"src1/p/X.java",
2428 			"package p;\n" +
2429 			"/** */\n" +
2430 			"public class X {\n" +
2431 			"}",
2432 		},
2433         "\"" + OUTPUT_DIR + "/src1/p/X.java\""
2434         + " -1.5 -g -preserveAllLocals"
2435         + " -proceedOnError -referenceInfo"
2436         + " -d \"" + OUTPUT_DIR + "/bin1/\"",
2437         "",
2438         "",
2439         true);
2440 	this.runConformTest(
2441 		new String[] {
2442 			"src2/Y.java",
2443 			"/** */\n" +
2444 			"public class Y extends p.X {\n" +
2445 			"}",
2446 		},
2447         "\"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
2448         + " -1.5 -g -preserveAllLocals"
2449         + " -cp \"" + OUTPUT_DIR + File.separator + "bin1[~**/X]\""
2450         + " -proceedOnError -referenceInfo"
2451         + " -d \"" + OUTPUT_DIR + File.separator + "bin2/\"",
2452         "",
2453         "----------\n" +
2454         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 2)\n" +
2455         "	public class Y extends p.X {\n" +
2456         "	                       ^^^\n" +
2457         "Discouraged access: The type \'X\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
2458         "----------\n" +
2459         "1 problem (1 warning)\n",
2460         false);
2461 }
2462 
2463 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=53773
2464 // complain on assignment to parameters
test037()2465 public void test037() {
2466 	this.runNegativeTest(
2467 		new String[] {
2468 			"X.java",
2469 			"public class X {\n" +
2470 			"  void foo(int i, final int j) {\n" +
2471 			"    i =  0; // warning\n" +
2472 			"    j =  0; // error\n" +
2473 			"  }\n" +
2474 			"}\n"},
2475 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
2476 		+ " -1.5 "
2477 		+ " -cp \"" + OUTPUT_DIR + "\""
2478 		+ " -warn:+paramAssign"
2479 		+ " -proceedOnError"
2480 		+ " -d \"" + OUTPUT_DIR + "\"",
2481 		"",
2482 		"----------\n" +
2483 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
2484 		"	i =  0; // warning\n" +
2485 		"	^\n" +
2486 		"The parameter i should not be assigned\n" +
2487 		"----------\n" +
2488 		"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
2489 		"	j =  0; // error\n" +
2490 		"	^\n" +
2491 		"The final local variable j cannot be assigned. It must be blank and not using a compound assignment\n" +
2492 		"----------\n" +
2493 		"2 problems (1 error, 1 warning)\n",
2494 		true);
2495 }
2496 
2497 // Missing access restriction violation error on generic type.
2498 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995
2499 // Binary case.
test039()2500 public void test039(){
2501 	this.runConformTest(
2502 		new String[] {
2503 			"src1/p/X.java",
2504 			"package p;\n" +
2505 			"public class X<T> {\n" +
2506 			"	T m;\n" +
2507 			"}",
2508 		},
2509         "\"" + OUTPUT_DIR + "/src1/p/X.java\""
2510         + " -1.5 -g -preserveAllLocals"
2511         + " -proceedOnError -referenceInfo"
2512         + " -d \"" + OUTPUT_DIR + "/bin1/\"",
2513         "",
2514         "",
2515         true);
2516 	this.runConformTest(
2517 		new String[] {
2518 			"src2/Y.java",
2519 			"package p;\n" +
2520 			"public class Y {\n" +
2521 			"	X x1;\n" +
2522 			"	X<String> x2 = new X<String>();\n" +
2523 			"}",
2524 		},
2525         "\"" + OUTPUT_DIR +  File.separator + "src2/Y.java\""
2526         + " -1.5 -g -preserveAllLocals"
2527         + " -cp \"" + OUTPUT_DIR + File.separator + "bin1[~**/X]\""
2528         + " -proceedOnError -referenceInfo"
2529         + " -d \"" + OUTPUT_DIR + File.separator + "bin2/\"",
2530         "",
2531         "----------\n" +
2532        "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 3)\n" +
2533        "	X x1;\n" +
2534        "	^\n" +
2535        "Discouraged access: The type \'X<T>\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
2536        "----------\n" +
2537        "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 3)\n" +
2538        "	X x1;\n" +
2539        "	^\n" +
2540        "X is a raw type. References to generic type X<T> should be parameterized\n" +
2541        "----------\n" +
2542        "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 4)\n" +
2543        "	X<String> x2 = new X<String>();\n" +
2544        "	^\n" +
2545        "Discouraged access: The type \'X<String>\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
2546        "----------\n" +
2547        "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 4)\n" +
2548        "	X<String> x2 = new X<String>();\n" +
2549        "	                   ^\n" +
2550        "Discouraged access: The type \'X<String>\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
2551        "----------\n" +
2552        "5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 4)\n" +
2553        "	X<String> x2 = new X<String>();\n" +
2554        "	                   ^\n" +
2555        "Discouraged access: The constructor \'X<String>()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
2556        "----------\n" +
2557        "5 problems (5 warnings)\n",
2558         false);
2559 }
2560 
2561 // check we get appropriate combination of access rules
test040()2562 public void test040(){
2563 	this.runConformTest(
2564 		new String[] {
2565 			"p/X.java",
2566 			"package p;\n" +
2567 			"/** */\n" +
2568 			"public class X {\n" +
2569 			"}",
2570 			"p/Z.java",
2571 			"package p;\n" +
2572 			"/** */\n" +
2573 			"public class Z {\n" +
2574 			"}"
2575 		},
2576         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2577         + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2578         + " -1.5 -g -preserveAllLocals"
2579         + " -nowarn"
2580         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2581         "",
2582         "",
2583         true);
2584 	this.runConformTest(
2585 		new String[] {
2586 			"Y.java",
2587 			"/** */\n" +
2588 			"public class Y {\n" +
2589 			"  p.X x;\n" +
2590 			"  p.Z z;\n" +
2591 			"}",
2592 		},
2593         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2594         + " -1.5 -g -preserveAllLocals"
2595         + " -cp \"" + OUTPUT_DIR + "[+p/X" + File.pathSeparator + "-p/*]\""
2596         + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2597         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2598         "",
2599         "----------\n" +
2600         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 4)\n" +
2601         "	p.Z z;\n" +
2602         "	^^^\n" +
2603         "Access restriction: The type \'Z\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
2604         "----------\n" +
2605         "1 problem (1 warning)\n",
2606         false);
2607 }
2608 
2609 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533
2610 // turn off discouraged references warnings
test041()2611 public void test041(){
2612 	this.runConformTest(
2613 		new String[] {
2614 			"p/X.java",
2615 			"package p;\n" +
2616 			"/** */\n" +
2617 			"public class X {\n" +
2618 			"}",
2619 			"p/Z.java",
2620 			"package p;\n" +
2621 			"/** */\n" +
2622 			"public class Z {\n" +
2623 			"}"
2624 		},
2625         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2626         + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2627         + " -1.5 -g -preserveAllLocals"
2628         + " -nowarn"
2629         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2630         "",
2631         "",
2632         true);
2633 	this.runConformTest(
2634 		new String[] {
2635 			"Y.java",
2636 			"/** */\n" +
2637 			"public class Y {\n" +
2638 			"  p.X x;\n" +
2639 			"  p.Z z;\n" +
2640 			"}",
2641 		},
2642         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2643         + " -1.5 -g -preserveAllLocals"
2644         + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2645         + " -warn:-discouraged -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2646         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2647         "",
2648         "----------\n" +
2649         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 4)\n" +
2650         "	p.Z z;\n" +
2651         "	^^^\n" +
2652         "Access restriction: The type \'Z\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
2653         "----------\n" +
2654         "1 problem (1 warning)\n",
2655         false);
2656 }
2657 
2658 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533
2659 // turn off forbidden references warnings
test042()2660 public void test042(){
2661 	this.runConformTest(
2662 		new String[] {
2663 			"p/X.java",
2664 			"package p;\n" +
2665 			"/** */\n" +
2666 			"public class X {\n" +
2667 			"}",
2668 			"p/Z.java",
2669 			"package p;\n" +
2670 			"/** */\n" +
2671 			"public class Z {\n" +
2672 			"}"
2673 		},
2674         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2675         + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2676         + " -1.5 -g -preserveAllLocals"
2677         + " -nowarn"
2678         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2679         "",
2680         "",
2681         true);
2682 	this.runConformTest(
2683 		new String[] {
2684 			"Y.java",
2685 			"/** */\n" +
2686 			"public class Y {\n" +
2687 			"  p.X x;\n" +
2688 			"  p.Z z;\n" +
2689 			"}",
2690 		},
2691         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2692         + " -1.5 -g -preserveAllLocals"
2693         + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2694         + " -warn:-forbidden -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2695         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2696         "",
2697         "----------\n" +
2698         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 3)\n" +
2699         "	p.X x;\n" +
2700         "	^^^\n" +
2701         "Discouraged access: The type \'X\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
2702         "----------\n" +
2703         "1 problem (1 warning)\n",
2704         false);
2705 }
2706 
2707 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533
2708 // turn off discouraged and forbidden references warnings
test043()2709 public void test043(){
2710 	this.runConformTest(
2711 		new String[] {
2712 			"p/X.java",
2713 			"package p;\n" +
2714 			"/** */\n" +
2715 			"public class X {\n" +
2716 			"}",
2717 			"p/Z.java",
2718 			"package p;\n" +
2719 			"/** */\n" +
2720 			"public class Z {\n" +
2721 			"}"
2722 		},
2723         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2724         + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2725         + " -1.5 -g -preserveAllLocals"
2726         + " -nowarn"
2727         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2728         "",
2729         "",
2730         true);
2731 	this.runConformTest(
2732 		new String[] {
2733 			"Y.java",
2734 			"/** */\n" +
2735 			"public class Y {\n" +
2736 			"  p.X x;\n" +
2737 			"  p.Z z;\n" +
2738 			"}",
2739 		},
2740         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2741         + " -1.5 -g -preserveAllLocals"
2742         + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2743         + " -warn:-discouraged,forbidden -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2744         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2745         "",
2746 		"",
2747         false);
2748 }
2749 
2750 // null ref option
test044()2751 public void test044(){
2752 	this.runConformTest(
2753 		new String[] {
2754 			"X.java",
2755 			"public class X {\n" +
2756 			"  void foo() {\n" +
2757 			"    Object o = null;\n" +
2758 			"    o.toString();\n" +
2759 			"  }\n" +
2760 			"}"},
2761         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2762         + " -1.5 -g -preserveAllLocals"
2763         + " -bootclasspath " + getLibraryClassesAsQuotedString()
2764         + " -cp " + getJCEJarAsQuotedString()
2765         + " -warn:+null"
2766         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2767         "",
2768         "----------\n" +
2769         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
2770         "	o.toString();\n" +
2771         "	^\n" +
2772         "Null pointer access: The variable o can only be null at this location\n" +
2773         "----------\n" +
2774         "1 problem (1 warning)\n",
2775         true);
2776 }
2777 
2778 // null ref option
test045()2779 public void test045(){
2780 	this.runConformTest(
2781 		new String[] {
2782 			"X.java",
2783 			"public class X {\n" +
2784 			"  void foo() {\n" +
2785 			"    Object o = null;\n" +
2786 			"    o.toString();\n" +
2787 			"  }\n" +
2788 			"}"},
2789         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2790         + " -1.5 -g -preserveAllLocals"
2791         + " -bootclasspath " + getLibraryClassesAsQuotedString()
2792         + " -cp " + getJCEJarAsQuotedString()
2793         + " -warn:-null" // contrast with test036
2794         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2795         "",
2796         "", true);
2797 }
2798 
2799 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=114456
2800 // turn off discouraged and forbidden references warnings using SuppressWarnings all
test046()2801 public void test046(){
2802 	this.runConformTest(
2803 		new String[] {
2804 			"p/X.java",
2805 			"package p;\n" +
2806 			"/** */\n" +
2807 			"public class X {\n" +
2808 			"}",
2809 		},
2810         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2811         + " -1.5 -g -preserveAllLocals"
2812         + " -nowarn"
2813         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2814         "",
2815         "",
2816         true);
2817 	this.runConformTest(
2818 		new String[] {
2819 			"Y.java",
2820 			"/** */\n" +
2821 			"@SuppressWarnings(\"all\")\n" +
2822 			"public class Y {\n" +
2823 			"  p.X x;\n" +
2824 			"}",
2825 		},
2826         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2827         + " -1.5 -g -preserveAllLocals"
2828         + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2829         + " -warn:+discouraged,forbidden,deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2830         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2831         "",
2832 		"",
2833         false);
2834 }
2835 
2836 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=114456
2837 // turn off discouraged and forbidden references warnings using SuppressWarnings restriction
test047()2838 public void test047(){
2839 	this.runConformTest(
2840 		new String[] {
2841 			"p/X.java",
2842 			"package p;\n" +
2843 			"/** */\n" +
2844 			"public class X {\n" +
2845 			"}",
2846 		},
2847         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2848         + " -1.5 -g -preserveAllLocals"
2849         + " -nowarn"
2850         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2851         "",
2852         "",
2853         true);
2854 	this.runConformTest(
2855 		new String[] {
2856 			"Y.java",
2857 			"/** */\n" +
2858 			"@SuppressWarnings(\"restriction\")\n" +
2859 			"public class Y {\n" +
2860 			"  p.X x;\n" +
2861 			"}",
2862 		},
2863         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2864         + " -1.5 -g -preserveAllLocals"
2865         + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2866         + " -warn:+discouraged,forbidden,deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2867         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2868         "",
2869 		"",
2870         false);
2871 }
2872 
2873 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=114456
2874 // turn off discouraged and forbidden references warnings using SuppressWarnings
test048()2875 public void test048(){
2876 	this.runConformTest(
2877 		new String[] {
2878 			"p/X.java",
2879 			"package p;\n" +
2880 			"/** */\n" +
2881 			"public class X {\n" +
2882 			"}",
2883 		},
2884         "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2885         + " -1.5 -g -preserveAllLocals"
2886         + " -nowarn"
2887         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2888         "",
2889         "",
2890         true);
2891 	this.runConformTest(
2892 		new String[] {
2893 			"Y.java",
2894 			"/** */\n" +
2895 			"@SuppressWarnings(\"deprecation\")\n" +
2896 			"public class Y {\n" +
2897 			"  p.X x;\n" +
2898 			"}",
2899 		},
2900         "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2901         + " -1.5 -g -preserveAllLocals"
2902         + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2903         + " -warn:+discouraged,forbidden,deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2904         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2905         "",
2906         "----------\n" +
2907         "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 2)\n" +
2908         "	@SuppressWarnings(\"deprecation\")\n" +
2909         "	                  ^^^^^^^^^^^^^\n" +
2910         "Unnecessary @SuppressWarnings(\"deprecation\")\n" +
2911         "----------\n" +
2912         "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 4)\n" +
2913         "	p.X x;\n" +
2914         "	^^^\n" +
2915         "Discouraged access: The type \'X\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
2916         "----------\n" +
2917         "2 problems (2 warnings)\n",
2918         false);
2919 }
2920 
2921 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836
2922 // [compiler] warning on fall through
2923 // disable warning on command line (implicit)
test049()2924 public void test049(){
2925 	this.runConformTest(
2926 		new String[] {
2927 			"X.java",
2928 			"/** */\n" +
2929 			"public class X {\n" +
2930 			"    public void test(int p) {\n" +
2931 			"        switch (p) {\n" +
2932 			"        case 0:\n" +
2933 			"            System.out.println(0);\n" +
2934 			"        case 1:\n" +
2935 			"            System.out.println(1); // possible fall-through\n" +
2936 			"        }\n" +
2937 			"    }\n" +
2938 			"}",
2939 		},
2940         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2941         + " -1.5 -g -preserveAllLocals"
2942         + " -nowarn"
2943         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2944         "",
2945         "",
2946         true);
2947 }
2948 
2949 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836
2950 // [compiler] warning on fall through
2951 // disable warning on command line (explicit)
test050()2952 public void test050(){
2953 	this.runConformTest(
2954 		new String[] {
2955 			"X.java",
2956 			"/** */\n" +
2957 			"public class X {\n" +
2958 			"    public void test(int p) {\n" +
2959 			"        switch (p) {\n" +
2960 			"        case 0:\n" +
2961 			"            System.out.println(0);\n" +
2962 			"        case 1:\n" +
2963 			"            System.out.println(1); // possible fall-through\n" +
2964 			"        }\n" +
2965 			"    }\n" +
2966 			"}",
2967 		},
2968         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2969         + " -1.5 -g -preserveAllLocals"
2970         + " -warn:-fallthrough"
2971         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2972         "",
2973         "",
2974         true);
2975 }
2976 
2977 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836
2978 // [compiler] warning on fall through
2979 // enable warning on command line
test051()2980 public void test051(){
2981 	this.runConformTest(
2982 		new String[] {
2983 			"X.java",
2984 			"/** */\n" +
2985 			"public class X {\n" +
2986 			"    public void test(int p) {\n" +
2987 			"        switch (p) {\n" +
2988 			"        case 0:\n" +
2989 			"            System.out.println(0);\n" +
2990 			"        case 1:\n" +
2991 			"            System.out.println(1); // complain: possible fall-through\n" +
2992 			"        }\n" +
2993 			"    }\n" +
2994 			"}",
2995 		},
2996         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
2997         + " -1.5 -g -preserveAllLocals"
2998         + " -warn:+fallthrough"
2999         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
3000         "",
3001 		"----------\n" +
3002 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
3003 		"	case 1:\n" +
3004 		"	^^^^^^\n" +
3005 		"Switch case may be entered by falling through previous case. If intended, add a new comment //$FALL-THROUGH$ on the line above\n" +
3006 		"----------\n" +
3007 		"1 problem (1 warning)\n",
3008         true);
3009 }
3010 
3011 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=123476
test052()3012 public void test052(){
3013 	try {
3014 		new File(OUTPUT_DIR).mkdirs();
3015 		File barFile = new File(OUTPUT_DIR +  File.separator + "Bar.java");
3016 		FileOutputStream barOutput = new FileOutputStream(barFile);
3017 		try {
3018 			String barContents =
3019 				"public class Bar	\n" +
3020 				"{	\n" +
3021 				"  Bar(int class)	\n" +
3022 				"  {	\n" +
3023 				"  }	\n" +
3024 				"}\n";
3025 			barOutput.write(barContents.getBytes());
3026 		} finally {
3027 			barOutput.close();
3028 		}
3029 	} catch(IOException e) {
3030 		// do nothing, will fail below
3031 	}
3032 
3033 	this.runNegativeTest(
3034 		new String[] {
3035 			"X.java",
3036 			"public class X\n" +
3037 			"{\n" +
3038 			"  static Object x()\n" +
3039 			"  {\n" +
3040 			"    return new Bar(5);\n" +
3041 			"  }\n" +
3042 			"}\n",
3043 		},
3044      "\"" + OUTPUT_DIR +  File.separator + "X.java\""
3045      + " -cp \"" + OUTPUT_DIR + File.pathSeparator + "\""
3046      + " -d \"" + OUTPUT_DIR + "\"",
3047      "",
3048      "----------\n" +
3049      "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
3050      "	return new Bar(5);\n" +
3051      "	       ^^^^^^^^^^\n" +
3052      "The constructor Bar(int) is undefined\n" +
3053      "----------\n" +
3054      "----------\n" +
3055      "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Bar.java (at line 2)\n" +
3056      "	{	\n" +
3057      "	^\n" +
3058      "Syntax error, insert \"}\" to complete ClassBody\n" +
3059      "----------\n" +
3060      "3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Bar.java (at line 3)\n" +
3061      "	Bar(int class)	\n" +
3062      "	        ^^^^^\n" +
3063      "Syntax error on token \"class\", invalid VariableDeclaratorId\n" +
3064      "----------\n" +
3065      "4. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Bar.java (at line 3)\n" +
3066      "	Bar(int class)	\n" +
3067      "  {	\n" +
3068      "  }	\n" +
3069      "	        ^^^^^^^^^^^^^^^^\n" +
3070      "Syntax error on tokens, delete these tokens\n" +
3071      "----------\n" +
3072      "5. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Bar.java (at line 6)\n" +
3073      "	}\n" +
3074      "	^\n" +
3075      "Syntax error on token \"}\", delete this token\n" +
3076      "----------\n" +
3077      "5 problems (5 errors)\n",
3078      false);
3079 }
3080 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=137053
test053()3081 public void test053(){
3082 	this.runConformTest(
3083 		new String[] {
3084 			"X.java",
3085 			"public class X {}"
3086         },
3087         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
3088         + " -1.5 -g -preserveAllLocals"
3089         + " -d \"" + OUTPUT_DIR + File.separator + "X.java\"",
3090 		"",
3091 		"No .class file created for file X.class in ---OUTPUT_DIR_PLACEHOLDER" +
3092 			"---/X.java because of an IOException: Regular file " +
3093 			"---OUTPUT_DIR_PLACEHOLDER---/X.java cannot be used " +
3094 			"as output directory\n",
3095 		true);
3096 }
3097 // suggested by https://bugs.eclipse.org/bugs/show_bug.cgi?id=141522
3098 // only checking messages (the bug itself involves concurrent access to
3099 // the file system and a true test case would call for instrumented
3100 // code)
test054()3101 public void test054(){
3102 	this.runConformTest(
3103 		new String[] {
3104 			"X.java",
3105 			"public class X {}",
3106 			"f", // create simple file f
3107 			""
3108         },
3109         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
3110         + " -1.5 -g -preserveAllLocals"
3111         + " -d \"" + OUTPUT_DIR + "/f/out\"",
3112 		"",
3113 		"No .class file created for file X.class in ---OUTPUT_DIR_PLACEHOLDER" +
3114 			"---/f/out because of an IOException: " +
3115 			"Could not create output directory ---OUTPUT_DIR_PLACEHOLDER---/f/out\n",
3116 		true);
3117 }
3118 // suggested by https://bugs.eclipse.org/bugs/show_bug.cgi?id=141522
3119 // only checking messages (the bug itself involves concurrent access to
3120 // the file system and a true test case would call for instrumented
3121 // code)
3122 // this test only works on appropriate file systems
test055()3123 public void test055(){
3124 	if (File.separatorChar == '/') {
3125 	  	String tentativeOutputDirNameTail =
3126 	      	File.separator + "out";
3127 	  	File outputDirectory = new File(OUTPUT_DIR + tentativeOutputDirNameTail);
3128 	  	outputDirectory.mkdirs();
3129 	  	outputDirectory.setReadOnly();
3130 	  	// read-only directories do not prevent file creation
3131 	  	// on under-gifted file systems
3132 		this.runConformTest(
3133 			new String[] {
3134 				"p/X.java",
3135 				"package p;\n" +
3136 				"public class X {}",
3137 	        },
3138 	        "\"" + OUTPUT_DIR +  File.separator + "p/X.java\""
3139 	        + " -1.5 -g -preserveAllLocals"
3140 	        + " -d \"" + OUTPUT_DIR + "/out\"",
3141 			"",
3142 			"No .class file created for file p/X.class in " +
3143 				"---OUTPUT_DIR_PLACEHOLDER---/out because of " +
3144 				"an IOException: Could not create subdirectory p into output directory " +
3145 				"---OUTPUT_DIR_PLACEHOLDER---/out\n",
3146 			false /* do not flush output directory */);
3147 	}
3148 }
3149 // suggested by https://bugs.eclipse.org/bugs/show_bug.cgi?id=141522
3150 // only checking messages (the bug itself involves concurrent access to
3151 // the file system and a true test case would call for instrumented
3152 // code)
test056()3153 public void test056(){
3154   	String tentativeOutputDirNameTail =
3155       	File.separator + "out";
3156 	this.runConformTest(
3157 		new String[] {
3158 			"p/X.java",
3159 			"package p;\n" +
3160 			"public class X {}",
3161 			"out/p", // create simple file out/p
3162 			""
3163         },
3164         "\"" + OUTPUT_DIR +  File.separator + "p/X.java\""
3165         + " -1.5 -g -preserveAllLocals"
3166         + " -d \"" + OUTPUT_DIR + tentativeOutputDirNameTail + "\"",
3167 		"",
3168 		"No .class file created for file p/X.class in " +
3169 			"---OUTPUT_DIR_PLACEHOLDER---/out" +
3170 			" because of an IOException: Regular file ---OUTPUT_DIR_PLACEHOLDER---" +
3171 			"/out/p cannot be used as output directory\n",
3172 		true);
3173 }
3174 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=147461
3175 // the compilation is successful because we do not check the classpath entries
3176 // given in the rules; accordingly OK<sep>-KO is seen as a directory that is
3177 // added to positive rules, and the compilation completes normally
test057_access_restrictions_separator()3178 public void test057_access_restrictions_separator(){
3179 	String oppositeSeparator = File.pathSeparatorChar == ':' ?
3180 			";" : ":";
3181 	this.runConformTest(
3182 		new String[] {
3183 			"X.java",
3184 			"/** */\n" +
3185 			"public class X {\n" +
3186 			"	OK1 ok1;\n" +
3187 			"	OK2 ok2;\n" +
3188 			"	KO ko;\n" +
3189 			"}",
3190 			"OK1.java",
3191 			"/** */\n" +
3192 			"public class OK1 {\n" +
3193 			"	// empty\n" +
3194 			"}",
3195 			"OK2.java",
3196 			"/** */\n" +
3197 			"public class OK2 {\n" +
3198 			"	// empty\n" +
3199 			"}",
3200 			"KO.java",
3201 			"/** */\n" +
3202 			"public class KO {\n" +
3203 			"	// empty\n" +
3204 			"}",
3205 		},
3206         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
3207         + " -1.5 -g -preserveAllLocals"
3208         + " -cp \"" + OUTPUT_DIR + "[+OK2" + oppositeSeparator + "-KO]\""
3209         + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
3210         "",
3211         "",
3212         true);
3213 }
3214 
3215 // .java ending directory name
3216 // as a sibling of the compiled file
test058()3217 public void test058(){
3218   	File outputDirectory = new File(OUTPUT_DIR + File.separator + "foo.java");
3219   	outputDirectory.mkdirs();
3220 	this.runConformTest(
3221 		new String[] {
3222 			"X.java",
3223 			"public class X {}",
3224         },
3225         "\"" + OUTPUT_DIR +  File.separator + "X.java\""
3226         + " -1.5 -g -preserveAllLocals"
3227         + " -d \"" + OUTPUT_DIR + "/out\"",
3228 		"",
3229 		"",
3230 		false /* do not flush output directory */);
3231 }
3232 // .java ending directory name
3233 // subdirectory of a compiled directory, unreferenced
test060()3234 public void test060(){
3235 	File outputDirectory = new File(OUTPUT_DIR + File.separator + "foo.java");
3236 	outputDirectory.mkdirs();
3237 	this.runConformTest(
3238 		new String[] {
3239 			"X.java",
3240 			"public class X {}",
3241         },
3242 	    "\"" + OUTPUT_DIR + "\""
3243 	    + " -1.5 -g -preserveAllLocals"
3244 	    + " -d \"" + OUTPUT_DIR + "/out\"",
3245 		"",
3246 		"",
3247 		false /* do not flush output directory */);
3248 }
3249 
3250 // .java ending directory name
3251 // subdirectory of a compiled directory, referenced
test061()3252 public void test061(){
3253 	File outputDirectory = new File(OUTPUT_DIR + File.separator + "foo.java");
3254 	outputDirectory.mkdirs();
3255 	this.runNegativeTest(
3256 		new String[] {
3257 				"X.java",
3258 				"public class X {\n" +
3259 				"  foo m;\n" +
3260 				"}",
3261 	        },
3262 	    "\"" + OUTPUT_DIR + "\""
3263 	    + " -1.5 -g -preserveAllLocals"
3264 	    + " -d \"" + OUTPUT_DIR + "/out\"",
3265 		"",
3266 		"----------\n" +
3267 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
3268 		"	foo m;\n" +
3269 		"	^^^\n" +
3270 		"foo cannot be resolved to a type\n" +
3271 		"----------\n" +
3272 		"1 problem (1 error)\n",
3273 		false /* do not flush output directory */);
3274 }
3275 
3276 // self-referential jar file
3277 // variant using a relative path to the jar file in the -cp option
3278 // this only tests that the fact the jar file references itself in a Class-Path
3279 // clause does not break anything; the said clause is not needed for the
3280 // compilation to succeed, and is merely irrelevant, but other compilers have
3281 // shown a bug in that area
3282 // TODO (maxime) improve management of current working directory
3283 // we have a problem here in that the working directory is set once and for all
3284 // from above, and we cannot change it afterwards (more on that when jdk7 gets
3285 // ready); moreover, the default working directory may not the best choice we
3286 // could expect (it is within the workspace, endangering the test project
3287 // layout); this would need to be reconsidered from scratch, keeping in mind
3288 // that some disk regions are not available for writing when running the releng
3289 // tests; the pity is that this is precisely the case that fails with other
3290 // compilers, whereas test063 passes;
3291 // this problem affects other batch compiler tests as well, since we must be
3292 // able to simulate command lines that would include relative paths; the
3293 // solution probably encompasses putting the effective working directory under
3294 // control;
_test062()3295 public void _test062(){
3296 	String outputDirName = OUTPUT_DIR + File.separator + "d",
3297 	  metaInfDirName = outputDirName + File.separator + "META-INF",
3298 	  jarFileName = outputDirName + File.separator + "L.jar";
3299 //	  currentWorkingDirectory = System.getProperty("user.dir");
3300 	this.runConformTest(
3301 		new String[] {
3302 			"d/Y.java",
3303 			"public class Y {\n" +
3304 			"}"},
3305 	    "\"" + outputDirName + "\""
3306 	    + " -1.5 -g -preserveAllLocals"
3307 	    + " -d \"" + outputDirName + "\"",
3308 		"",
3309 		"",
3310 		true /* flush output directory */);
3311 	File outputDirectory = new File(outputDirName);
3312 	File metaInfDirectory = new File(metaInfDirName);
3313 	metaInfDirectory.mkdirs();
3314 	try {
3315 		Util.createFile(metaInfDirName + File.separator + "MANIFEST.MF",
3316 			"Manifest-Version: 1.0\n" +
3317 			"Class-Path: ../d/L.jar\n");
3318 	} catch (IOException e) {
3319 		fail("could not create manifest file");
3320 	}
3321 	try {
3322 		Util.zip(outputDirectory, jarFileName);
3323 	} catch (IOException e) {
3324 		fail("could not create jar file");
3325 	}
3326 	Util.delete(outputDirName + File.separator + "Y.class");
3327 	Util.delete(outputDirName + File.separator + "Y.java");
3328 	this.runConformTest(
3329 		new String[] {
3330 			"d/X.java",
3331 			"public class X {\n" +
3332 			"  Y m;\n" +
3333 			"}"},
3334 	    "\"" + outputDirName + "\""
3335 	    + " -1.5 -g -preserveAllLocals"
3336 	    + " -cp L.jar"
3337 	    + " -d \"" + OUTPUT_DIR + "\"",
3338 		"",
3339 		"",
3340 		false /* do not flush output directory */);
3341 }
3342 
3343 // self-referential jar file
3344 // variant using an absolute path to the jar file in the -cp option
test063()3345 public void test063(){
3346 	String outputDirName = OUTPUT_DIR + File.separator + "d",
3347 	  metaInfDirName = outputDirName + File.separator + "META-INF",
3348 	  jarFileName = outputDirName + File.separator + "L.jar";
3349 	this.runConformTest(
3350 		new String[] {
3351 			"d/Y.java",
3352 			"public class Y {\n" +
3353 			"}"},
3354 	    "\"" + outputDirName + "\""
3355 	    + " -1.5 -g -preserveAllLocals"
3356 	    + " -d \"" + outputDirName + "\"",
3357 		"",
3358 		"",
3359 		true /* flush output directory */);
3360 	File outputDirectory = new File(outputDirName);
3361 	File metaInfDirectory = new File(metaInfDirName);
3362 	metaInfDirectory.mkdirs();
3363 	try {
3364 		Util.createFile(metaInfDirName + File.separator + "MANIFEST.MF",
3365 			"Manifest-Version: 1.0\n" +
3366 			"Class-Path: ../d/L.jar\n");
3367 	} catch (IOException e) {
3368 		fail("could not create manifest file");
3369 	}
3370 	try {
3371 		Util.zip(outputDirectory, jarFileName);
3372 	} catch (IOException e) {
3373 		fail("could not create jar file");
3374 	}
3375 	Util.delete(outputDirName + File.separator + "Y.class");
3376 	Util.delete(outputDirName + File.separator + "Y.java");
3377 	this.runConformTest(
3378 		new String[] {
3379 			"d/X.java",
3380 			"public class X {\n" +
3381 			"  Y m;\n" +
3382 			"}"},
3383 	    "\"" + outputDirName + "\""
3384 	    + " -1.5 -g -preserveAllLocals"
3385 	    + " -cp \"" + jarFileName + "\""
3386 	    + " -d \"" + OUTPUT_DIR + "\"",
3387 		"",
3388 		"",
3389 		false /* do not flush output directory */);
3390 }
3391 
3392 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=155809
3393 // per sourcepath directory default encoding
_test064_per_sourcepath_directory_default_encoding()3394 public void _test064_per_sourcepath_directory_default_encoding(){
3395 	String source1 = "src1";
3396 	this.runConformTest(
3397 		new String[] {
3398 			source1 + File.separator + "/X.java",
3399 			"public class X {}",
3400 			"Z.java",
3401 			"public class Z {\n" +
3402 			"  X f;\n" +
3403 			"}",
3404         },
3405         "\"" + OUTPUT_DIR +  File.separator +
3406         	"Z.java\""
3407         + " -1.5"
3408         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1
3409         + "[UTF-8]\"",
3410 		"",
3411 		"",
3412 		true);
3413 }
3414 
3415 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3416 // per source directory output directory
3417 // pre-existing case 1: using a single, definite output directory
test065_per_source_output_directory()3418 public void test065_per_source_output_directory(){
3419 	String source1 = "src1",
3420 		output1 = "bin1";
3421 	this.runConformTest(
3422 		new String[] {
3423 			source1 + File.separator + "/X.java",
3424 			"public class X {}",
3425 			"Z.java",
3426 			"public class Z {\n" +
3427 			"  X f;\n" +
3428 			"}",
3429         },
3430         "\"" + OUTPUT_DIR +  File.separator +
3431         	"Z.java\""
3432         + " -1.5"
3433         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3434         + " -d \"" + OUTPUT_DIR + File.separator + output1 + "\"",
3435 		"",
3436 		"",
3437 		true);
3438 	String fileName = OUTPUT_DIR + File.separator + output1 +
3439 			File.separator + "X.class";
3440 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3441 	fileName = OUTPUT_DIR + File.separator + output1 +
3442 			File.separator + "Z.class";
3443 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3444 }
3445 
3446 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3447 // per source directory output directory
3448 // pre-existing case 2: using no definite output directory
test066_per_source_output_directory()3449 public void test066_per_source_output_directory(){
3450 	String source1 = "src1";
3451 	this.runConformTest(
3452 		new String[] {
3453 			source1 + File.separator + "/X.java",
3454 			"public class X {}",
3455 			"Z.java",
3456 			"public class Z {\n" +
3457 			"  X f;\n" +
3458 			"}",
3459         },
3460         "\"" + OUTPUT_DIR +  File.separator +
3461         	"Z.java\""
3462         + " -1.5"
3463         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\"",
3464 		"",
3465 		"",
3466 		true);
3467 	String fileName = OUTPUT_DIR + File.separator + source1 +
3468 			File.separator + "X.class";
3469 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3470 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3471 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3472 }
3473 
3474 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3475 // per source directory output directory
3476 // pre-existing case 3: -d none absorbs output
test067_per_source_output_directory()3477 public void test067_per_source_output_directory(){
3478 	this.runConformTest(
3479 		new String[] {
3480 			"X.java",
3481 			"public class X {}",
3482         },
3483         "\"" + OUTPUT_DIR +  File.separator +
3484         	"X.java\""
3485         + " -1.5"
3486         + " -d none",
3487 		"",
3488 		"",
3489 		true);
3490 	String fileName = OUTPUT_DIR + File.separator + "X.class";
3491 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3492 }
3493 
3494 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3495 // per source directory output directory
3496 // new case 1: overriding the default output directory for one of the sources
3497 // -sourcepath series
test068_per_source_output_directory()3498 public void test068_per_source_output_directory(){
3499 	String source1 = "src1",
3500 		output1 = "bin1", output2 = "bin2";
3501 	this.runConformTest(
3502 		new String[] {
3503 			source1 + File.separator + "/X.java",
3504 			"public class X {}",
3505 			"Z.java",
3506 			"public class Z {\n" +
3507 			"  X f;\n" +
3508 			"}",
3509         },
3510         "\"" + OUTPUT_DIR +  File.separator +
3511         	"Z.java\""
3512         + " -1.5"
3513         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3514         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
3515         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
3516 		"",
3517 		"",
3518 		true);
3519 	String fileName = OUTPUT_DIR + File.separator + output1 +
3520 			File.separator + "X.class";
3521 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3522 	fileName = OUTPUT_DIR + File.separator + source1 +
3523 			File.separator + "X.class";
3524 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3525 	fileName = OUTPUT_DIR + File.separator + output2 +
3526 			File.separator + "X.class";
3527 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3528 	fileName = OUTPUT_DIR + File.separator + output2 +
3529 			File.separator + "Z.class";
3530 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3531 }
3532 
3533 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3534 // per source directory output directory
3535 // new case 2: specifying an output directory for a given source directory only
3536 // -sourcepath series
test069_per_source_output_directory()3537 public void test069_per_source_output_directory(){
3538 	String source1 = "src1",
3539 		output1 = "bin1";
3540 	this.runConformTest(
3541 		new String[] {
3542 			source1 + File.separator + "/X.java",
3543 			"public class X {}",
3544 			"Z.java",
3545 			"public class Z {\n" +
3546 			"  X f;\n" +
3547 			"}",
3548         },
3549         "\"" + OUTPUT_DIR +  File.separator +
3550         	"Z.java\""
3551         + " -1.5"
3552         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3553         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]",
3554 		"",
3555 		"",
3556 		true);
3557 	String fileName = OUTPUT_DIR + File.separator + output1 +
3558 			File.separator + "X.class";
3559 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3560 	fileName = OUTPUT_DIR + File.separator + source1 +
3561 			File.separator + "X.class";
3562 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3563 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3564 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3565 }
3566 
3567 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3568 // per source directory output directory
3569 // new case 3: [-d none] selectively absorbs output
3570 // -sourcepath series
test070_per_source_output_directory()3571 public void test070_per_source_output_directory(){
3572 	String source1 = "src1";
3573 	this.runConformTest(
3574 		new String[] {
3575 			source1 + File.separator + "/X.java",
3576 			"public class X {}",
3577 			"Z.java",
3578 			"public class Z {\n" +
3579 			"  X f;\n" +
3580 			"}",
3581         },
3582         "\"" + OUTPUT_DIR +  File.separator +
3583         	"Z.java\""
3584         + " -1.5"
3585         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3586         + "[-d none]",
3587 		"",
3588 		"",
3589 		true);
3590 	String fileName = OUTPUT_DIR + File.separator + source1 +
3591 			File.separator + "X.class";
3592 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3593 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3594 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3595 }
3596 
3597 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3598 // per source directory output directory
3599 // new case 4: overriding -d none for one of the sources
3600 // -sourcepath series
test071_per_source_output_directory()3601 public void test071_per_source_output_directory(){
3602 	String source1 = "src1",
3603 		output1 = "bin1";
3604 	this.runConformTest(
3605 		new String[] {
3606 			source1 + File.separator + "/X.java",
3607 			"public class X {}",
3608 			"Z.java",
3609 			"public class Z {\n" +
3610 			"  X f;\n" +
3611 			"}",
3612         },
3613         "\"" + OUTPUT_DIR +  File.separator +
3614         	"Z.java\""
3615         + " -1.5"
3616         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3617         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
3618         + " -d none",
3619 		"",
3620 		"",
3621 		true);
3622 	String fileName = OUTPUT_DIR + File.separator + output1 +
3623 			File.separator + "X.class";
3624 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3625 	fileName = OUTPUT_DIR + File.separator + source1 +
3626 			File.separator + "X.class";
3627 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3628 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3629 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3630 }
3631 
3632 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3633 // per source directory output directory
3634 // [-d dir][rule] is forbidden
3635 // -sourcepath series
test072_per_source_output_directory()3636 public void test072_per_source_output_directory(){
3637 	this.runNegativeTest(
3638 		new String[] {
3639 			"X.java",
3640 			"public class X {\n" +
3641 			"}"},
3642         "\"" + OUTPUT_DIR +  File.separator +
3643         	"X.java\""
3644         + " -1.5"
3645         + " -sourcepath \"" + OUTPUT_DIR + "\"" + "[-d dir][~**/internal/*]",
3646 		"",
3647 		"access rules cannot follow destination path entries: ---OUTPUT_DIR_PLACEHOLDER---[-d dir][~**/internal/*]\n",
3648 		true);
3649 }
3650 
3651 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3652 // per source directory output directory
3653 // [rule][-d dir] is ok
3654 // -sourcepath series
test073_per_source_output_directory()3655 public void test073_per_source_output_directory(){
3656 	String source1 = "src1",
3657 		output1 = "bin1";
3658 	this.runConformTest(
3659 		new String[] {
3660 			source1 + File.separator + "/X.java",
3661 			"public class X {}",
3662 			"Z.java",
3663 			"public class Z {\n" +
3664 			"  X f;\n" +
3665 			"}",
3666         },
3667         "\"" + OUTPUT_DIR +  File.separator +
3668         	"Z.java\""
3669         + " -1.5"
3670         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\"" +
3671         	"[-**/*][-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]",
3672 		"",
3673 		"----------\n" +
3674 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Z.java (at line 2)\n" +
3675 		"	X f;\n" +
3676 		"	^\n" +
3677 		"Access restriction: The type \'X\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/src1\')\n" +
3678 		"----------\n" +
3679 		"1 problem (1 warning)\n",
3680 		true);
3681 }
3682 
3683 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3684 // per source directory output directory
3685 // new case 1: overriding the default output directory for one of the sources
3686 // -classpath series
test074_per_source_output_directory()3687 public void test074_per_source_output_directory(){
3688 	String source1 = "src1",
3689 		output1 = "bin1", output2 = "bin2";
3690 	this.runConformTest(
3691 		new String[] {
3692 			source1 + File.separator + "/X.java",
3693 			"public class X {}",
3694 			"Z.java",
3695 			"public class Z {\n" +
3696 			"  X f;\n" +
3697 			"}",
3698         },
3699         "\"" + OUTPUT_DIR +  File.separator +
3700         	"Z.java\""
3701         + " -1.5"
3702         + " -classpath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3703         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
3704         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
3705 		"",
3706 		"",
3707 		true);
3708 	String fileName = OUTPUT_DIR + File.separator + output1 +
3709 			File.separator + "X.class";
3710 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3711 	fileName = OUTPUT_DIR + File.separator + source1 +
3712 			File.separator + "X.class";
3713 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3714 	fileName = OUTPUT_DIR + File.separator + output2 +
3715 			File.separator + "X.class";
3716 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3717 	fileName = OUTPUT_DIR + File.separator + output2 +
3718 			File.separator + "Z.class";
3719 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3720 }
3721 
3722 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3723 // per source directory output directory
3724 // new case 2: specifying an output directory for a given source directory only
3725 // -classpath series
test075_per_source_output_directory()3726 public void test075_per_source_output_directory(){
3727 	String source1 = "src1",
3728 		output1 = "bin1";
3729 	this.runConformTest(
3730 		new String[] {
3731 			source1 + File.separator + "/X.java",
3732 			"public class X {}",
3733 			"Z.java",
3734 			"public class Z {\n" +
3735 			"  X f;\n" +
3736 			"}",
3737         },
3738         "\"" + OUTPUT_DIR +  File.separator +
3739         	"Z.java\""
3740         + " -1.5"
3741         + " -cp \"" + OUTPUT_DIR + File.separator + source1 + "\""
3742         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]",
3743 		"",
3744 		"",
3745 		true);
3746 	String fileName = OUTPUT_DIR + File.separator + output1 +
3747 			File.separator + "X.class";
3748 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3749 	fileName = OUTPUT_DIR + File.separator + source1 +
3750 			File.separator + "X.class";
3751 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3752 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3753 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3754 }
3755 
3756 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3757 // per source directory output directory
3758 // new case 3: [-d none] selectively absorbs output
3759 // -classpath series
test076_per_source_output_directory()3760 public void test076_per_source_output_directory(){
3761 	String source1 = "src1";
3762 	this.runConformTest(
3763 		new String[] {
3764 			source1 + File.separator + "/X.java",
3765 			"public class X {}",
3766 			"Z.java",
3767 			"public class Z {\n" +
3768 			"  X f;\n" +
3769 			"}",
3770         },
3771         "\"" + OUTPUT_DIR +  File.separator +
3772         	"Z.java\""
3773         + " -1.5"
3774         + " -classpath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3775         + "[-d none]",
3776 		"",
3777 		"",
3778 		true);
3779 	String fileName = OUTPUT_DIR + File.separator + source1 +
3780 			File.separator + "X.class";
3781 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3782 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3783 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3784 }
3785 
3786 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3787 // per source directory output directory
3788 // new case 4: overriding -d none for one of the sources
3789 // -classpath series
test077_per_source_output_directory()3790 public void test077_per_source_output_directory(){
3791 	String source1 = "src1",
3792 		output1 = "bin1";
3793 	this.runConformTest(
3794 		new String[] {
3795 			source1 + File.separator + "/X.java",
3796 			"public class X {}",
3797 			"Z.java",
3798 			"public class Z {\n" +
3799 			"  X f;\n" +
3800 			"}",
3801         },
3802         "\"" + OUTPUT_DIR +  File.separator +
3803         	"Z.java\""
3804         + " -1.5"
3805         + " -classpath \"" + OUTPUT_DIR + File.separator + source1 + "\""
3806         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
3807         + " -d none",
3808 		"",
3809 		"",
3810 		true);
3811 	String fileName = OUTPUT_DIR + File.separator + output1 +
3812 			File.separator + "X.class";
3813 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3814 	fileName = OUTPUT_DIR + File.separator + source1 +
3815 			File.separator + "X.class";
3816 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3817 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3818 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3819 }
3820 
3821 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3822 // per source directory output directory
3823 // [-d dir][rule] is forbidden
3824 // -classpath series
test078_per_source_output_directory()3825 public void test078_per_source_output_directory(){
3826 	this.runNegativeTest(
3827 		new String[] {
3828 			"X.java",
3829 			"public class X {\n" +
3830 			"}"},
3831         "\"" + OUTPUT_DIR +  File.separator +
3832         	"X.java\""
3833         + " -1.5"
3834         + " -classpath \"" + OUTPUT_DIR + "\"" + "[-d dir][~**/internal/*]",
3835 		"",
3836 		"access rules cannot follow destination path entries: ---OUTPUT_DIR_PLACEHOLDER---[-d dir][~**/internal/*]\n",
3837 		true);
3838 }
3839 
3840 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3841 // per source directory output directory
3842 // [rule][-d dir] is ok
3843 // -classpath series
test079_per_source_output_directory()3844 public void test079_per_source_output_directory(){
3845 	String source1 = "src1",
3846 		output1 = "bin1";
3847 	this.runConformTest(
3848 		new String[] {
3849 			source1 + File.separator + "/X.java",
3850 			"public class X {}",
3851 			"Z.java",
3852 			"public class Z {\n" +
3853 			"  X f;\n" +
3854 			"}",
3855         },
3856         "\"" + OUTPUT_DIR +  File.separator +
3857         	"Z.java\""
3858         + " -1.5"
3859         + " -classpath \"" + OUTPUT_DIR + File.separator + source1 + "\"" +
3860         	"[-**/*][-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]",
3861 		"",
3862 		"----------\n" +
3863 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Z.java (at line 2)\n" +
3864 		"	X f;\n" +
3865 		"	^\n" +
3866 		"Access restriction: The type \'X\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/src1\')\n" +
3867 		"----------\n" +
3868 		"1 problem (1 warning)\n",
3869 		true);
3870 }
3871 
3872 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3873 // per source directory output directory
3874 // new case 1: overriding the default output directory for one of the sources
3875 // -bootclasspath series
test080_per_source_output_directory()3876 public void test080_per_source_output_directory(){
3877 	String source1 = "src1",
3878 		output1 = "bin1", output2 = "bin2";
3879 	this.runConformTest(
3880 		new String[] {
3881 			source1 + File.separator + "/X.java",
3882 			"public class X {}",
3883 			"Z.java",
3884 			"public class Z {\n" +
3885 			"  X f;\n" +
3886 			"}",
3887         },
3888         "\"" + OUTPUT_DIR +  File.separator +
3889         	"Z.java\""
3890         + " -1.5"
3891         + " -bootclasspath " + getLibraryClassesAsQuotedString() + File.pathSeparator + "\"" +
3892           OUTPUT_DIR + File.separator + source1 + "\""
3893         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
3894         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
3895 		"",
3896 		"",
3897 		true);
3898 	String fileName = OUTPUT_DIR + File.separator + output1 +
3899 			File.separator + "X.class";
3900 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3901 	fileName = OUTPUT_DIR + File.separator + source1 +
3902 			File.separator + "X.class";
3903 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3904 	fileName = OUTPUT_DIR + File.separator + output2 +
3905 			File.separator + "X.class";
3906 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3907 	fileName = OUTPUT_DIR + File.separator + output2 +
3908 			File.separator + "Z.class";
3909 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3910 }
3911 
3912 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3913 // per source directory output directory
3914 // new case 2: specifying an output directory for a given source directory only
3915 // -bootclasspath series
test081_per_source_output_directory()3916 public void test081_per_source_output_directory(){
3917 	String source1 = "src1",
3918 		output1 = "bin1";
3919 	this.runConformTest(
3920 		new String[] {
3921 			source1 + File.separator + "/X.java",
3922 			"public class X {}",
3923 			"Z.java",
3924 			"public class Z {\n" +
3925 			"  X f;\n" +
3926 			"}",
3927         },
3928         "\"" + OUTPUT_DIR +  File.separator +
3929         	"Z.java\""
3930         + " -1.5"
3931         + " -bootclasspath " + getLibraryClassesAsQuotedString() + File.pathSeparator + "\"" +
3932           OUTPUT_DIR + File.separator + source1 + "\""
3933         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]",
3934 		"",
3935 		"",
3936 		true);
3937 	String fileName = OUTPUT_DIR + File.separator + output1 +
3938 			File.separator + "X.class";
3939 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3940 	fileName = OUTPUT_DIR + File.separator + source1 +
3941 			File.separator + "X.class";
3942 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3943 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3944 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3945 }
3946 
3947 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3948 // per source directory output directory
3949 // new case 3: [-d none] selectively absorbs output
3950 // -bootclasspath series
test082_per_source_output_directory()3951 public void test082_per_source_output_directory(){
3952 	String source1 = "src1";
3953 	this.runConformTest(
3954 		new String[] {
3955 			source1 + File.separator + "/X.java",
3956 			"public class X {}",
3957 			"Z.java",
3958 			"public class Z {\n" +
3959 			"  X f;\n" +
3960 			"}",
3961         },
3962         "\"" + OUTPUT_DIR +  File.separator +
3963         	"Z.java\""
3964         + " -1.5"
3965         + " -bootclasspath " + getLibraryClassesAsQuotedString() + File.pathSeparator + "\"" +
3966           OUTPUT_DIR + File.separator + source1 + "\""
3967         + "[-d none]",
3968 		"",
3969 		"",
3970 		true);
3971 	String fileName = OUTPUT_DIR + File.separator + source1 +
3972 			File.separator + "X.class";
3973 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
3974 	fileName = OUTPUT_DIR + File.separator + "Z.class";
3975 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
3976 }
3977 
3978 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
3979 // per source directory output directory
3980 // new case 4: overriding -d none for one of the sources
3981 // -bootclasspath series
test083_per_source_output_directory()3982 public void test083_per_source_output_directory(){
3983 	String source1 = "src1",
3984 		output1 = "bin1";
3985 	this.runConformTest(
3986 		new String[] {
3987 			source1 + File.separator + "/X.java",
3988 			"public class X {}",
3989 			"Z.java",
3990 			"public class Z {\n" +
3991 			"  X f;\n" +
3992 			"}",
3993         },
3994         "\"" + OUTPUT_DIR +  File.separator +
3995         	"Z.java\""
3996         + " -1.5"
3997         + " -bootclasspath " + getLibraryClassesAsQuotedString() + File.pathSeparator + "\"" +
3998           OUTPUT_DIR + File.separator + source1 + "\""
3999         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4000         + " -d none",
4001 		"",
4002 		"",
4003 		true);
4004 	String fileName = OUTPUT_DIR + File.separator + output1 +
4005 			File.separator + "X.class";
4006 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4007 	fileName = OUTPUT_DIR + File.separator + source1 +
4008 			File.separator + "X.class";
4009 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4010 	fileName = OUTPUT_DIR + File.separator + File.separator + "Z.class";
4011 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4012 }
4013 
4014 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4015 // per source directory output directory
4016 // [-d dir][rule] is forbidden
4017 // -bootclasspath series
test084_per_source_output_directory()4018 public void test084_per_source_output_directory(){
4019 	this.runNegativeTest(
4020 		new String[] {
4021 			"X.java",
4022 			"public class X {\n" +
4023 			"}"},
4024         "\"" + OUTPUT_DIR +  File.separator +
4025         	"X.java\""
4026         + " -1.5"
4027         + " -bootclasspath \"" + OUTPUT_DIR + "\"" + "[-d dir][~**/internal/*]",
4028 		"",
4029 		"access rules cannot follow destination path entries: ---OUTPUT_DIR_PLACEHOLDER---[-d dir][~**/internal/*]\n",
4030 		true);
4031 }
4032 
4033 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4034 // per source directory output directory
4035 // [rule][-d dir] is ok
4036 // -bootclasspath series
test085_per_source_output_directory()4037 public void test085_per_source_output_directory(){
4038 	String source1 = "src1",
4039 		output1 = "bin1";
4040 	this.runConformTest(
4041 		new String[] {
4042 			source1 + File.separator + "/X.java",
4043 			"public class X {}",
4044 			"Z.java",
4045 			"public class Z {\n" +
4046 			"  X f;\n" +
4047 			"}",
4048         },
4049         "\"" + OUTPUT_DIR +  File.separator +
4050         	"Z.java\""
4051         + " -1.5"
4052         + " -bootclasspath " + getLibraryClassesAsQuotedString() + File.pathSeparator +
4053         	"\"" + OUTPUT_DIR + File.separator + source1 + "\"" +
4054         	"[-**/*][-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]",
4055 		"",
4056 		"----------\n" +
4057 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Z.java (at line 2)\n" +
4058 		"	X f;\n" +
4059 		"	^\n" +
4060 		"Access restriction: The type \'X\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/src1\')\n" +
4061 		"----------\n" +
4062 		"1 problem (1 warning)\n",
4063 		true);
4064 }
4065 
4066 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4067 // per source directory output directory
4068 // jar / zip files in sourcepath
test086_per_source_output_directory()4069 public void test086_per_source_output_directory(){
4070 	String source1 = "src1",
4071 		output1 = "bin1", output2 = "bin2";
4072 	File outputDir = new File(OUTPUT_DIR),
4073 		sourceDir = new File(OUTPUT_DIR + File.separator + source1);
4074 	try {
4075 		if (outputDir.exists()) {
4076 			Util.flushDirectoryContent(outputDir);
4077 		} else {
4078 			outputDir.mkdirs();
4079 		}
4080 		sourceDir.mkdir();
4081 		Util.createFile(OUTPUT_DIR + File.separator +
4082 			source1 + File.separator + "X.java",
4083 			"public class X {}");
4084 		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4085 	} catch (IOException e) {
4086 		fail("could not create jar file");
4087 	}
4088 	this.runConformTest(
4089 		new String[] {
4090 			"Z.java",
4091 			"public class Z {\n" +
4092 			"  X f;\n" +
4093 			"}",
4094         },
4095         "\"" + OUTPUT_DIR +  File.separator +
4096         	"Z.java\""
4097         + " -1.5"
4098         + " -sourcepath \"" + OUTPUT_DIR + File.separator + "X.jar\""
4099         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4100         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
4101 		"",
4102 		"",
4103 		false); // keep jar
4104 	String fileName = OUTPUT_DIR + File.separator + output1 +
4105 			File.separator + "X.class";
4106 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4107 	fileName = OUTPUT_DIR + File.separator + source1 +
4108 			File.separator + "X.class";
4109 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4110 	fileName = OUTPUT_DIR + File.separator + output2 +
4111 			File.separator + "X.class";
4112 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4113 	fileName = OUTPUT_DIR + File.separator + output2 +
4114 			File.separator + "Z.class";
4115 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4116 }
4117 
4118 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4119 // per source directory output directory
4120 // jar / zip files in classpath are binaries only: no -d argument
test087_per_source_output_directory()4121 public void test087_per_source_output_directory(){
4122 	String output1 = "bin1", output2 = "bin2";
4123 	this.runNegativeTest(
4124 		new String[] {
4125 			"Z.java",
4126 			"public class Z {\n" +
4127 			"  X f;\n" +
4128 			"}",
4129         },
4130         "\"" + OUTPUT_DIR +  File.separator +
4131         	"Z.java\""
4132         + " -1.5"
4133         + " -classpath \"" + OUTPUT_DIR + File.separator + "X.jar\""
4134         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4135         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
4136 		"",
4137 		"unexpected destination path entry for file: ---OUTPUT_DIR_PLACEHOLDER---/X.jar\n",
4138 		true);
4139 }
4140 
4141 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4142 // per source directory output directory
4143 // jar / zip files in bootclasspath are binaries only: no -d argument
test088_per_source_output_directory()4144 public void test088_per_source_output_directory(){
4145 	String output1 = "bin1", output2 = "bin2";
4146 	this.runNegativeTest(
4147 		new String[] {
4148 			"Z.java",
4149 			"public class Z {\n" +
4150 			"}",
4151         },
4152         "\"" + OUTPUT_DIR +  File.separator +
4153         	"Z.java\""
4154         + " -1.5"
4155         + " -bootclasspath \"" + OUTPUT_DIR + File.separator + "X.jar\""
4156         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4157         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
4158 		"",
4159 		"unexpected destination path entry for file: ---OUTPUT_DIR_PLACEHOLDER---/X.jar\n",
4160 		true);
4161 }
4162 
4163 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4164 // per source directory output directory
4165 // new case 2: specifying an output directory for a given source directory only
4166 // jar / zip files in sourcepath
test089_per_source_output_directory()4167 public void test089_per_source_output_directory(){
4168 	String source1 = "src1",
4169 		output1 = "bin1";
4170 	File outputDir = new File(OUTPUT_DIR),
4171 		sourceDir = new File(OUTPUT_DIR + File.separator + source1),
4172 		standardXOutputFile = new File(System.getProperty("user.dir") +
4173 			File.separator + "X.class");
4174 	try {
4175 		if (outputDir.exists()) {
4176 			Util.flushDirectoryContent(outputDir);
4177 		} else {
4178 			outputDir.mkdirs();
4179 		}
4180 		sourceDir.mkdir();
4181 		Util.createFile(OUTPUT_DIR + File.separator +
4182 			source1 + File.separator + "X.java",
4183 			"public class X {}");
4184 		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4185 		if (standardXOutputFile.exists()) {
4186 			Util.delete(standardXOutputFile);
4187 		}
4188 	} catch (IOException e) {
4189 		fail("could not create jar file");
4190 	}
4191 	this.runConformTest(
4192 		new String[] {
4193 			"Z.java",
4194 			"public class Z {\n" +
4195 			"  X f;\n" +
4196 			"}",
4197         },
4198         "\"" + OUTPUT_DIR +  File.separator +
4199         	"Z.java\""
4200         + " -1.5"
4201         + " -sourcepath \"" + OUTPUT_DIR + File.separator + "X.jar\""
4202         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4203         ,
4204 		"",
4205 		"",
4206 		false);
4207 	String fileName = OUTPUT_DIR + File.separator + output1 +
4208 			File.separator + "X.class";
4209 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4210 	assertFalse("extraneous file: " + standardXOutputFile.getPath(),
4211 		standardXOutputFile.exists());
4212 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4213 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4214 }
4215 
4216 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4217 // per source directory output directory
4218 // new case 3: [-d none] selectively absorbs output
4219 // jar / zip files
test090_per_source_output_directory()4220 public void test090_per_source_output_directory(){
4221 	String source1 = "src1";
4222 	File outputDir = new File(OUTPUT_DIR),
4223 		sourceDir = new File(OUTPUT_DIR + File.separator + source1),
4224 		standardXOutputFile = new File(System.getProperty("user.dir") +
4225 			File.separator + "X.class");
4226 	try {
4227 		if (outputDir.exists()) {
4228 			Util.flushDirectoryContent(outputDir);
4229 		} else {
4230 			outputDir.mkdirs();
4231 		}
4232 		sourceDir.mkdir();
4233 		Util.createFile(OUTPUT_DIR + File.separator +
4234 			source1 + File.separator + "X.java",
4235 			"public class X {}");
4236 		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4237 		if (standardXOutputFile.exists()) {
4238 			Util.delete(standardXOutputFile);
4239 		}
4240 	} catch (IOException e) {
4241 		fail("could not create jar file");
4242 	}
4243 	this.runConformTest(
4244 		new String[] {
4245 			"Z.java",
4246 			"public class Z {\n" +
4247 			"  X f;\n" +
4248 			"}",
4249         },
4250         "\"" + OUTPUT_DIR +  File.separator +
4251         	"Z.java\""
4252         + " -1.5"
4253         + " -sourcepath \"" + OUTPUT_DIR + File.separator + "X.jar\""
4254         + "[-d none]",
4255 		"",
4256 		"",
4257 		false);
4258 	String fileName = OUTPUT_DIR + File.separator + source1 +
4259 			File.separator + "X.class";
4260 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4261 	assertFalse("extraneous file: " + standardXOutputFile.getPath(),
4262 		standardXOutputFile.exists());
4263 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4264 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4265 }
4266 
4267 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4268 // per source directory output directory
4269 // new case 4: overriding -d none for one of the sources
4270 // jar / zip files
test091_per_source_output_directory()4271 public void test091_per_source_output_directory(){
4272 	String source1 = "src1", output1 = "bin1";
4273 	File outputDir = new File(OUTPUT_DIR),
4274 		sourceDir = new File(OUTPUT_DIR + File.separator + source1),
4275 		standardXOutputFile = new File(System.getProperty("user.dir") +
4276 			File.separator + "X.class");
4277 	try {
4278 		if (outputDir.exists()) {
4279 			Util.flushDirectoryContent(outputDir);
4280 		} else {
4281 			outputDir.mkdirs();
4282 		}
4283 		sourceDir.mkdir();
4284 		Util.createFile(OUTPUT_DIR + File.separator +
4285 			source1 + File.separator + "X.java",
4286 			"public class X {}");
4287 		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4288 		if (standardXOutputFile.exists()) {
4289 			Util.delete(standardXOutputFile);
4290 		}
4291 	} catch (IOException e) {
4292 		fail("could not create jar file");
4293 	}
4294 	this.runConformTest(
4295 		new String[] {
4296 			"Z.java",
4297 			"public class Z {\n" +
4298 			"  X f;\n" +
4299 			"}",
4300         },
4301         "\"" + OUTPUT_DIR +  File.separator +
4302         	"Z.java\""
4303         + " -1.5"
4304         + " -sourcepath \"" + OUTPUT_DIR + File.separator + source1 + "\""
4305         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4306         + " -d none",
4307 		"",
4308 		"",
4309 		false);
4310 	String fileName = OUTPUT_DIR + File.separator + output1 +
4311 			File.separator + "X.class";
4312 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4313 	fileName = OUTPUT_DIR + File.separator + source1 +
4314 			File.separator + "X.class";
4315 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4316 	fileName = OUTPUT_DIR + File.separator + "X.class";
4317 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4318 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4319 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4320 }
4321 
4322 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4323 // per source directory output directory
4324 // new case 1: overriding the default output directory for one of the sources
4325 // source directories series
test092_per_source_output_directory()4326 public void test092_per_source_output_directory(){
4327 	String source1 = "src1",
4328 		output1 = "bin1", output2 = "bin2";
4329 	this.runConformTest(
4330 		new String[] {
4331 			source1 + File.separator + "/X.java",
4332 			"public class X {}",
4333 			"Z.java",
4334 			"public class Z {\n" +
4335 			"  X f;\n" +
4336 			"}",
4337         },
4338         "\"" + OUTPUT_DIR +  File.separator +
4339         	"Z.java\""
4340         + " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4341         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4342         + " -1.5"
4343         + " -d \"" + OUTPUT_DIR + File.separator + output2 + "\"",
4344 		"",
4345 		"",
4346 		true);
4347 	String fileName = OUTPUT_DIR + File.separator + output1 +
4348 			File.separator + "X.class";
4349 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4350 	fileName = OUTPUT_DIR + File.separator + source1 +
4351 			File.separator + "X.class";
4352 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4353 	fileName = OUTPUT_DIR + File.separator + output2 +
4354 			File.separator + "X.class";
4355 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4356 	fileName = OUTPUT_DIR + File.separator + output2 +
4357 			File.separator + "Z.class";
4358 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4359 }
4360 
4361 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4362 // per source directory output directory
4363 // new case 2: specifying an output directory for a given source directory only
4364 // source directories series
test093_per_source_output_directory()4365 public void test093_per_source_output_directory(){
4366 	String source1 = "src1",
4367 		output1 = "bin1";
4368 	this.runConformTest(
4369 		new String[] {
4370 			source1 + File.separator + "/X.java",
4371 			"public class X {}",
4372 			"Z.java",
4373 			"public class Z {\n" +
4374 			"  X f;\n" +
4375 			"}",
4376         },
4377         "\"" + OUTPUT_DIR +  File.separator +
4378         	"Z.java\""
4379         + " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4380         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4381         + " -1.5",
4382 		"",
4383 		"",
4384 		true);
4385 	String fileName = OUTPUT_DIR + File.separator + output1 +
4386 			File.separator + "X.class";
4387 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4388 	fileName = OUTPUT_DIR + File.separator + source1 +
4389 			File.separator + "X.class";
4390 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4391 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4392 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4393 }
4394 
4395 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4396 // per source directory output directory
4397 // new case 3: [-d none] selectively absorbs output
4398 // source directories series
test094_per_source_output_directory()4399 public void test094_per_source_output_directory(){
4400 	String source1 = "src1";
4401 	this.runConformTest(
4402 		new String[] {
4403 			source1 + File.separator + "/X.java",
4404 			"public class X {}",
4405 			"Z.java",
4406 			"public class Z {\n" +
4407 			"  // X f;\n" +
4408 			"}",
4409         },
4410         "\"" + OUTPUT_DIR +  File.separator +
4411         	"Z.java\""
4412         + " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4413         + "[-d none]"
4414         + " -1.5",
4415 		"",
4416 		"",
4417 		true);
4418 	String fileName = OUTPUT_DIR + File.separator + source1 +
4419 			File.separator + "X.class";
4420 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4421 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4422 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4423 }
4424 
4425 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4426 // per source directory output directory
4427 // new case 3: [-d none] selectively absorbs output
4428 // source directories series
4429 // variant: swap entries
test095_per_source_output_directory()4430 public void test095_per_source_output_directory(){
4431 	String source1 = "src1";
4432 	this.runConformTest(
4433 		new String[] {
4434 			source1 + File.separator + "/X.java",
4435 			"public class X {}",
4436 			"Z.java",
4437 			"public class Z {\n" +
4438 			"  // X f;\n" +
4439 			"}",
4440         },
4441         " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4442         + "[-d none] "
4443         + "\"" + OUTPUT_DIR +  File.separator +
4444         	"Z.java\""
4445         + " -1.5",
4446 		"",
4447 		"",
4448 		true);
4449 	String fileName = OUTPUT_DIR + File.separator + source1 +
4450 			File.separator + "X.class";
4451 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4452 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4453 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4454 }
4455 
4456 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4457 // per source directory output directory
4458 // new case 4: overriding -d none for one of the sources
4459 // source directories series
test096_per_source_output_directory()4460 public void test096_per_source_output_directory(){
4461 	String source1 = "src1",
4462 		output1 = "bin1";
4463 	this.runConformTest(
4464 		new String[] {
4465 			source1 + File.separator + "/X.java",
4466 			"public class X {}",
4467 			"Z.java",
4468 			"public class Z {\n" +
4469 			"  X f;\n" +
4470 			"}",
4471         },
4472         "\"" + OUTPUT_DIR +  File.separator +
4473         	"Z.java\""
4474         + " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4475         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4476         + " -1.5"
4477         + " -d none",
4478 		"",
4479 		"",
4480 		true);
4481 	String fileName = OUTPUT_DIR + File.separator + output1 +
4482 			File.separator + "X.class";
4483 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4484 	fileName = OUTPUT_DIR + File.separator + source1 +
4485 			File.separator + "X.class";
4486 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4487 	fileName = OUTPUT_DIR + File.separator + "Z.class";
4488 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4489 }
4490 
4491 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4492 // per source directory output directory
4493 // new case 4: overriding -d none for one of the sources
4494 // source directories series
4495 // variant: two source folders
test097_per_source_output_directory()4496 public void test097_per_source_output_directory(){
4497 	String source1 = "src1", source2 = "src2",
4498 		output1 = "bin1", output2 = "bin2";
4499 	this.runConformTest(
4500 		new String[] {
4501 			source1 + File.separator + "/X.java",
4502 			"public class X {}",
4503 			source2 + File.separator + "Z.java",
4504 			"public class Z {\n" +
4505 			"  X f;\n" +
4506 			"}",
4507         },
4508         " \"" + OUTPUT_DIR + File.separator + source2 + "\""
4509         + " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4510         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4511         + " -1.5"
4512         + " -d none",
4513 		"",
4514 		"",
4515 		true);
4516 	String fileName = OUTPUT_DIR + File.separator + output1 +
4517 			File.separator + "X.class";
4518 	assertTrue("missing file: " + fileName, (new File(fileName)).exists());
4519 	fileName = OUTPUT_DIR + File.separator + source1 +
4520 			File.separator + "X.class";
4521 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4522 	fileName = OUTPUT_DIR + File.separator + output2 +
4523 			File.separator + "X.class";
4524 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4525 	fileName = OUTPUT_DIR + File.separator + source2 +
4526 			File.separator + "Z.class";
4527 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4528 }
4529 
4530 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4531 // per source directory output directory
4532 // [rule] is forbidden for source directories
test098_per_source_output_directory()4533 public void test098_per_source_output_directory(){
4534 	String source1 = "src1";
4535 	this.runNegativeTest(
4536 		new String[] {
4537 			source1 + File.separator + "X.java",
4538 			"public class X {\n" +
4539 			"  Zork z;\n" +
4540 			"}"},
4541         "\"" + OUTPUT_DIR +  File.separator + source1 + "\""
4542         + "[~**/internal/*]"
4543         + " -1.5",
4544 		"",
4545 		"unsupported encoding format: ~**/internal/*\n",
4546 		true);
4547 }
4548 
4549 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4550 // per source directory output directory
4551 // changing the coding of -d none option
test099_per_source_output_directory()4552 public void test099_per_source_output_directory() {
4553 	File none = new File(Main.NONE);
4554 	if (none.exists()) {
4555 		fail("unexpected file: " + none.getAbsolutePath() +
4556 				"; please cleanup the test environment");
4557 		// by design, we do not want to agressively destroy a directory that
4558 		// could well exist outside of our dedicated output area
4559 		// TODO (maxime) one more case that calls for a better management of the
4560 		//               current working directory in our batch compiler tests
4561 	}
4562 	this.runConformTest(
4563 		new String[] {
4564 			"X.java",
4565 			"public class X {}",
4566         },
4567         "\"" + OUTPUT_DIR +  File.separator +
4568         	"X.java\""
4569         + " -1.5"
4570         + " -d none",
4571 		"",
4572 		"",
4573 		true);
4574 	String fileName = Main.NONE + File.separator + "X.class";
4575 	assertFalse("extraneous file: " + fileName, (new File(fileName)).exists());
4576 }
4577 
4578 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4579 // per source directory output directory
4580 // -extdirs cannot receive a -d option
test100_per_source_output_directory()4581 public void test100_per_source_output_directory(){
4582 	this.runNegativeTest(
4583 		new String[] {
4584 			"X.java",
4585 			"public class X {\n" +
4586 			"}"},
4587         "\"" + OUTPUT_DIR +  File.separator +
4588         	"X.java\""
4589         + " -1.5"
4590         + " -extdirs \"" + OUTPUT_DIR + "\"" + "[-d dir]",
4591 		"",
4592 		"unexpected destination path entry in -extdir option\n",
4593 		true);
4594 }
4595 
4596 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4597 // per source directory output directory
4598 // -endorseddirs cannot receive a -d option
test101_per_source_output_directory()4599 public void test101_per_source_output_directory(){
4600 	this.runNegativeTest(
4601 		new String[] {
4602 			"X.java",
4603 			"public class X {\n" +
4604 			"}"},
4605         "\"" + OUTPUT_DIR +  File.separator +
4606         	"X.java\""
4607         + " -1.5"
4608         + " -endorseddirs \"" + OUTPUT_DIR + "\"" + "[-d dir]",
4609 		"",
4610 		"unexpected destination path entry in -endorseddirs option\n",
4611 		true);
4612 }
4613 
4614 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4615 // per source directory output directory
4616 // bad syntax
test102_per_source_output_directory()4617 public void test102_per_source_output_directory(){
4618 	String source1 = "src1",
4619 		output1 = "bin1";
4620 	this.runNegativeTest(
4621 		new String[] {
4622 			source1 + File.separator + "/X.java",
4623 			"public class X {}",
4624         },
4625         " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4626         + "[-d \"" + OUTPUT_DIR + File.separator + output1 + "\""
4627         + " -1.5"
4628         + " -d none",
4629 		"",
4630 		"incorrect destination path entry: [-d ---OUTPUT_DIR_PLACEHOLDER---/bin1\n",
4631 		true);
4632 }
4633 
4634 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4635 // per source directory output directory
4636 // bad syntax
test103_per_source_output_directory()4637 public void test103_per_source_output_directory(){
4638 	String source1 = "src1",
4639 		output1 = "bin1";
4640 	this.runNegativeTest(
4641 		new String[] {
4642 			source1 + File.separator + "/X.java",
4643 			"public class X {}",
4644         },
4645         " \"" + OUTPUT_DIR + File.separator + source1 + "\""
4646         + " [-d \"" + OUTPUT_DIR + File.separator + output1 + "\"]"
4647         + " -1.5",
4648 		"",
4649 		"unexpected bracket: [-d\n",
4650 		true);
4651 }
4652 
4653 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4654 // per source directory output directory
4655 // bad syntax
test104_per_source_output_directory()4656 public void test104_per_source_output_directory(){
4657 	this.runNegativeTest(
4658 		new String[] {
4659 			"X.java",
4660 			"public class X {\n" +
4661 			"}"},
4662         "\"" + OUTPUT_DIR +  File.separator +
4663         	"X.java\""
4664         + " -1.5"
4665         + " -sourcepath \"" + OUTPUT_DIR + "\"" + "[[-d dir]",
4666 		"",
4667 		"unexpected bracket: ---OUTPUT_DIR_PLACEHOLDER---[[-d\n",
4668 		true);
4669 }
4670 
4671 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4672 // per source directory output directory
4673 // bad syntax
test105_per_source_output_directory()4674 public void test105_per_source_output_directory(){
4675 	this.runNegativeTest(
4676 		new String[] {
4677 			"X.java",
4678 			"public class X {\n" +
4679 			"}"},
4680         "\"" + OUTPUT_DIR +  File.separator +
4681         	"X.java\""
4682         + " -1.5"
4683         + " -cp \"" + OUTPUT_DIR + "\"" + "[-d dir]]",
4684 		"",
4685 		"unexpected bracket: dir]]\n",
4686 		true);
4687 }
4688 
4689 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=146554
4690 // per source directory output directory
4691 // bad syntax
test106_per_source_output_directory()4692 public void test106_per_source_output_directory(){
4693 	this.runNegativeTest(
4694 		new String[] {
4695 			"X.java",
4696 			"public class X {\n" +
4697 			"}"},
4698         "\"" + OUTPUT_DIR +  File.separator +
4699         	"X.java\""
4700         + " -1.5"
4701         + " -cp \"" + OUTPUT_DIR + "\"" + "[-d dir1" + File.pathSeparator +
4702         	"dir2]",
4703 		"",
4704 		"incorrect destination path entry: ---OUTPUT_DIR_PLACEHOLDER---" +
4705 			"[-d dir1" + File.pathSeparator + "dir2]\n",
4706 		true);
4707 }
4708 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4709 // source 1.3 compliance 1.3
test107()4710 public void test107() throws Exception {
4711 	this.runConformTest(
4712 		new String[] {
4713 			"X.java",
4714 			"/** */\n" +
4715 			"public class X {\n" +
4716 			"}",
4717 		},
4718      "\"" + OUTPUT_DIR +  File.separator + "X.java\""
4719      + " -1.3 -source 1.3 -d \"" + OUTPUT_DIR + "\"",
4720      "",
4721      "",
4722      true);
4723 	String expectedOutput = "// Compiled from X.java (version 1.1 : 45.3, super bit)";
4724 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4725 }
4726 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4727 //compliance 1.4 source 1.3
test108()4728 public void test108() throws Exception {
4729 	this.runConformTest(
4730 		new String[] {
4731 			"X.java",
4732 			"/** */\n" +
4733 			"public class X {\n" +
4734 			"}",
4735 		},
4736 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4737 		+ " -1.4 -source 1.3 -d \"" + OUTPUT_DIR + "\"",
4738 		"",
4739 		"",
4740 		true);
4741 	String expectedOutput = "// Compiled from X.java (version 1.2 : 46.0, super bit)";
4742 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4743 }
4744 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4745 //compliance 1.4 source 1.4
test109()4746 public void test109() throws Exception {
4747 	this.runConformTest(
4748 		new String[] {
4749 			"X.java",
4750 			"/** */\n" +
4751 			"public class X {\n" +
4752 			"}",
4753 		},
4754 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4755 		+ " -1.4 -source 1.4 -d \"" + OUTPUT_DIR + "\"",
4756 		"",
4757 		"",
4758 		true);
4759 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4760 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4761 }
4762 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4763 //compliance 1.5 source 1.3
test110()4764 public void test110() throws Exception {
4765 	this.runConformTest(
4766 		new String[] {
4767 			"X.java",
4768 			"/** */\n" +
4769 			"public class X {\n" +
4770 			"}",
4771 		},
4772 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4773 		+ " -1.5 -source 1.3 -d \"" + OUTPUT_DIR + "\"",
4774 		"",
4775 		"",
4776 		true);
4777 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4778 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4779 }
4780 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4781 //compliance 1.5 source 1.4
test111()4782 public void test111() throws Exception {
4783 	this.runConformTest(
4784 		new String[] {
4785 			"X.java",
4786 			"/** */\n" +
4787 			"public class X {\n" +
4788 			"}",
4789 		},
4790 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4791 		+ " -1.5 -source 1.4 -d \"" + OUTPUT_DIR + "\"",
4792 		"",
4793 		"",
4794 		true);
4795 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4796 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4797 }
4798 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4799 //compliance 1.5 source 1.5
test112()4800 public void test112() throws Exception {
4801 	this.runConformTest(
4802 		new String[] {
4803 			"X.java",
4804 			"/** */\n" +
4805 			"public class X {\n" +
4806 			"}",
4807 		},
4808 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4809 		+ " -1.5 -source 1.5 -d \"" + OUTPUT_DIR + "\"",
4810 		"",
4811 		"",
4812 		true);
4813 	String expectedOutput = "// Compiled from X.java (version 1.5 : 49.0, super bit)";
4814 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4815 }
4816 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4817 //compliance 1.6 source 1.3
test113()4818 public void test113() throws Exception {
4819 	this.runConformTest(
4820 		new String[] {
4821 			"X.java",
4822 			"/** */\n" +
4823 			"public class X {\n" +
4824 			"}",
4825 		},
4826 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4827 		+ " -1.6 -source 1.3 -proc:none -d \"" + OUTPUT_DIR + "\"",
4828 		"",
4829 		"",
4830 		true);
4831 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4832 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4833 }
4834 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4835 //compliance 1.6 source 1.4
test114()4836 public void test114() throws Exception {
4837 	this.runConformTest(
4838 		new String[] {
4839 			"X.java",
4840 			"/** */\n" +
4841 			"public class X {\n" +
4842 			"}",
4843 		},
4844 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4845 		+ " -1.6 -source 1.4 -proc:none -d \"" + OUTPUT_DIR + "\"",
4846 		"",
4847 		"",
4848 		true);
4849 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4850 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4851 }
4852 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4853 //compliance 1.6 source 1.5
test115()4854 public void test115() throws Exception {
4855 	this.runConformTest(
4856 		new String[] {
4857 			"X.java",
4858 			"/** */\n" +
4859 			"public class X {\n" +
4860 			"}",
4861 		},
4862 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4863 		+ " -1.6 -source 1.5 -proc:none -d \"" + OUTPUT_DIR + "\"",
4864 		"",
4865 		"",
4866 		true);
4867 	String expectedOutput = "// Compiled from X.java (version 1.6 : 50.0, super bit)";
4868 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4869 }
4870 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4871 //compliance 1.6 source 1.6
test116()4872 public void test116() throws Exception {
4873 	this.runConformTest(
4874 		new String[] {
4875 			"X.java",
4876 			"/** */\n" +
4877 			"public class X {\n" +
4878 			"}",
4879 		},
4880 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4881 		+ " -1.6 -source 1.6 -proc:none -d \"" + OUTPUT_DIR + "\"",
4882 		"",
4883 		"",
4884 		true);
4885 	String expectedOutput = "// Compiled from X.java (version 1.6 : 50.0, super bit)";
4886 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4887 }
4888 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4889 //compliance 1.7 source 1.3
test117()4890 public void test117() throws Exception {
4891 	this.runConformTest(
4892 		new String[] {
4893 			"X.java",
4894 			"/** */\n" +
4895 			"public class X {\n" +
4896 			"}",
4897 		},
4898 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4899 		+ " -1.7 -source 1.3 -proc:none -d \"" + OUTPUT_DIR + "\"",
4900 		"",
4901 		"",
4902 		true);
4903 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4904 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4905 }
4906 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4907 //compliance 1.7 source 1.4
test118()4908 public void test118() throws Exception {
4909 	this.runConformTest(
4910 		new String[] {
4911 			"X.java",
4912 			"/** */\n" +
4913 			"public class X {\n" +
4914 			"}",
4915 		},
4916 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4917 		+ " -1.7 -source 1.4 -proc:none -d \"" + OUTPUT_DIR + "\"",
4918 		"",
4919 		"",
4920 		true);
4921 	String expectedOutput = "// Compiled from X.java (version 1.4 : 48.0, super bit)";
4922 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4923 }
4924 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4925 //compliance 1.7 source 1.5
test119()4926 public void test119() throws Exception {
4927 	this.runConformTest(
4928 		new String[] {
4929 			"X.java",
4930 			"/** */\n" +
4931 			"public class X {\n" +
4932 			"}",
4933 		},
4934 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4935 		+ " -1.7 -source 1.5 -proc:none -d \"" + OUTPUT_DIR + "\"",
4936 		"",
4937 		"",
4938 		true);
4939 	String expectedOutput = "// Compiled from X.java (version 1.6 : 50.0, super bit)";
4940 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4941 }
4942 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4943 //compliance 1.7 source 1.6
test120()4944 public void test120() throws Exception {
4945 	this.runConformTest(
4946 		new String[] {
4947 			"X.java",
4948 			"/** */\n" +
4949 			"public class X {\n" +
4950 			"}",
4951 		},
4952 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4953 		+ " -1.7 -source 1.6 -proc:none -d \"" + OUTPUT_DIR + "\"",
4954 		"",
4955 		"",
4956 		true);
4957 	String expectedOutput = "// Compiled from X.java (version 1.6 : 50.0, super bit)";
4958 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4959 }
4960 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141830
4961 //compliance 1.7 source 1.7
4962 // TODO part of the changes for 206483
test121()4963 public void test121() throws Exception {
4964 	this.runConformTest(
4965 		new String[] {
4966 			"X.java",
4967 			"/** */\n" +
4968 			"public class X {\n" +
4969 			"}",
4970 		},
4971 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
4972 		+ " -1.7 -source 1.7 -proc:none -d \"" + OUTPUT_DIR + "\"",
4973 		"",
4974 		"",
4975 		true);
4976 	String expectedOutput = "// Compiled from X.java (version 1.7 : 51.0, super bit)";
4977 	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
4978 }
4979 // command line - unusual classpath (ends with ';;;', still OK)
test122_classpath()4980 public void test122_classpath(){
4981 	runClasspathTest(
4982 		OUTPUT_DIR + "[+**/OK2]" + File.pathSeparator + File.pathSeparator +
4983 				File.pathSeparator,
4984 		new String[] {
4985 			OUTPUT_DIR,	"{pattern=**/OK2 (ACCESSIBLE)}", null,
4986 		},
4987 		null);
4988 }
4989 // command line - unusual classpath (rules with multiple path separators KO, but
4990 // without any error message though)
test123_classpath()4991 public void test123_classpath(){
4992 	String cp = OUTPUT_DIR + "[+OK2" + File.pathSeparator + File.pathSeparator +
4993 			File.pathSeparator + "~Warn" + File.pathSeparator + "-KO]";
4994 	runClasspathTest(
4995 		cp,
4996 		null,
4997 		null);
4998 }
4999 // command line - unusual classpath (rules with embedded -d OK)
test124_classpath()5000 public void test124_classpath (){
5001 	runClasspathTest(
5002 		OUTPUT_DIR + "[+OK2" + File.pathSeparator +	"-d ~Warn" +
5003 				File.pathSeparator + "-KO]",
5004 		new String[] {
5005 			OUTPUT_DIR,
5006 				"{pattern=OK2 (ACCESSIBLE), pattern=d ~Warn (NON ACCESSIBLE), pattern=KO (NON ACCESSIBLE)}",
5007 				null,
5008 		},
5009 		null);
5010 }
5011 // command line - unusual classpath (rules starting with -d KO)
test125_classpath()5012 public void test125_classpath() {
5013 	String cp = OUTPUT_DIR + "[-d +OK2" + File.pathSeparator + "~Warn" +
5014 			File.pathSeparator + "-KO]";
5015 	runClasspathTest(
5016 		cp,
5017 		null,
5018 		"incorrect destination path entry: " + cp);
5019 }
5020 // command line - unusual classpath (rules starting with -d KO)
test126_classpath()5021 public void test126_classpath() {
5022 	String cp = OUTPUT_DIR + "[-d +OK2" + File.pathSeparator + "~Warn" +
5023 			File.pathSeparator + "-KO][-d dummy]";
5024 	runClasspathTest(
5025 		cp,
5026 		null,
5027 		"incorrect destination path entry: " + cp);
5028 }
5029 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
test127_classpath()5030 public void test127_classpath() {
5031 	String jarFile = OUTPUT_DIR + File.separator + "[squarebracket].jar";
5032 	runClasspathTest(
5033 		jarFile,
5034 		new String[] {
5035 			jarFile, null, null,
5036 		},
5037 		null);
5038 }
5039 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
test128_classpath()5040 public void test128_classpath() {
5041 	String jarFile = OUTPUT_DIR + File.separator + "[square][bracket].jar";
5042 	runClasspathTest(
5043 		jarFile,
5044 		new String[] {
5045 			jarFile, null, null,
5046 		},
5047 		null);
5048 }
5049 // command line - classpath order
test129_classpath()5050 public void test129_classpath() {
5051 	runClasspathTest(
5052 		"file.jar[+A]" + File.pathSeparator + OUTPUT_DIR,
5053 		new String[] {
5054 			"file.jar",	"{pattern=A (ACCESSIBLE)}", null,
5055 			OUTPUT_DIR, null, null,
5056 		},
5057 		null);
5058 }
5059 // command line - output directories
5060 // see also test072
test130_classpath()5061 public void test130_classpath() {
5062 	String cp = OUTPUT_DIR + "[-d dir][~**/internal/*]";
5063 	runClasspathTest(
5064 		cp,
5065 		null,
5066 		"access rules cannot follow destination path entries: " + cp);
5067 }
5068 // command line - output directories
test131_classpath()5069 public void test131_classpath() {
5070 	String cp = OUTPUT_DIR + "[~**/internal/*][-d dir]";
5071 	runClasspathTest(
5072 		cp,
5073 		new String[] {
5074 			OUTPUT_DIR,	"{pattern=**/internal/* (DISCOURAGED)}", "dir",
5075 		},
5076 		null);
5077 }
5078 // command line - brackets in classpath
5079 // unbalanced brackets fail (without any message though)
test132_classpath()5080 public void test132_classpath() {
5081 	String cp = OUTPUT_DIR + "[~**/internal/*[-d dir]";
5082 	runClasspathTest(
5083 		cp,
5084 		null,
5085 		null);
5086 }
5087 // command line - brackets in classpath
5088 // unbalanced brackets fail (without any message though)
test133_classpath()5089 public void test133_classpath() {
5090 	String cp = OUTPUT_DIR + "[~**/internal/*]-d dir]";
5091 	runClasspathTest(
5092 		cp,
5093 		null,
5094 		null);
5095 }
5096 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
test134_classpath()5097 public void test134_classpath() {
5098 	String jarFile = OUTPUT_DIR + File.separator + "[squarebracket].jar";
5099 	runClasspathTest(
5100 		jarFile + "[~**/internal/*][-d " + OUTPUT_DIR + "]",
5101 		new String[] {
5102 			jarFile, "{pattern=**/internal/* (DISCOURAGED)}", OUTPUT_DIR,
5103 		},
5104 		null);
5105 }
5106 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
test135_classpath()5107 public void test135_classpath() {
5108 	String jarFile = OUTPUT_DIR + File.separator + "[square][bracket].jar";
5109 	runClasspathTest(
5110 		jarFile + "[~**/internal/*][-d dir]",
5111 		new String[] {
5112 			jarFile, "{pattern=**/internal/* (DISCOURAGED)}", "dir",
5113 		},
5114 		null);
5115 }
5116 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
test136_classpath()5117 public void test136_classpath() {
5118 	String target = OUTPUT_DIR + File.separator + "[a]";
5119 	(new File(target)).mkdirs();
5120 	runClasspathTest(
5121 		target + File.separator,
5122 		new String[] {
5123 			target, null, null,
5124 		},
5125 		null);
5126 }
5127 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
test137_classpath()5128 public void test137_classpath() {
5129 	String target = OUTPUT_DIR + File.separator + "[a]";
5130 	(new File(target)).mkdirs();
5131 	runClasspathTest(
5132 		target + File.separator + "[~**/internal/*][-d dir]",
5133 		new String[] {
5134 			target, "{pattern=**/internal/* (DISCOURAGED)}", "dir",
5135 		},
5136 		null);
5137 }
5138 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5139 // too many brackets series KO (no error though)
test138_classpath()5140 public void test138_classpath() {
5141 	runClasspathTest(
5142 		OUTPUT_DIR + File.separator + "[a][~**/internal/*][-d dir]",
5143 		null,
5144 		null);
5145 }
5146 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=173416
5147 // start with a bracket
test139_classpath()5148 public void test139_classpath() {
5149     String cp = "[a].jar";
5150     runClasspathTest(
5151         cp,
5152         new String [] {
5153             cp, null, null,
5154         },
5155         null);
5156 }
5157 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=173416
5158 // start with a bracket
test140_classpath()5159 public void test140_classpath() {
5160     String cp = "[a].jar";
5161     runClasspathTest(
5162         cp + "[~**/internal/*][-d dir]",
5163         new String [] {
5164             cp, "{pattern=**/internal/* (DISCOURAGED)}", "dir",
5165         },
5166         null);
5167 }
5168 // null ref option
5169 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
5170 // adding distinct options to control null checks in more detail
test141_null_ref_option()5171 public void test141_null_ref_option(){
5172 	this.runConformTest(
5173 		new String[] {
5174 			"X.java",
5175 			"public class X {\n" +
5176 			"  void foo() {\n" +
5177 			"    Object o = null;\n" +
5178 			"    o.toString();\n" +
5179 			"  }\n" +
5180 			"}"},
5181      "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5182      + " -1.5 -g -preserveAllLocals"
5183      + " -bootclasspath " + getLibraryClassesAsQuotedString()
5184      + " -cp " + getJCEJarAsQuotedString()
5185      + " -warn:+nullDereference"
5186      + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5187      "",
5188      "----------\n" +
5189      "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5190      "	o.toString();\n" +
5191      "	^\n" +
5192      "Null pointer access: The variable o can only be null at this location\n" +
5193      "----------\n" +
5194      "1 problem (1 warning)\n",
5195      true);
5196 }
5197 // null ref option
5198 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
5199 // adding distinct options to control null checks in more detail
test142_null_ref_option()5200 public void test142_null_ref_option(){
5201 	this.runConformTest(
5202 		new String[] {
5203 			"X.java",
5204 			"public class X {\n" +
5205 			"  void foo() {\n" +
5206 			"    Object o = null;\n" +
5207 			"    if (o == null) {}\n" +
5208 			"  }\n" +
5209 			"}"},
5210   "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5211   + " -1.5 -g -preserveAllLocals"
5212   + " -bootclasspath " + getLibraryClassesAsQuotedString()
5213   + " -cp " + getJCEJarAsQuotedString()
5214   + " -warn:+null"
5215   + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5216   "",
5217   "----------\n" +
5218   "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5219   "	if (o == null) {}\n" +
5220   "	    ^\n" +
5221   "Redundant null check: The variable o can only be null at this location\n" +
5222   "----------\n" +
5223   "1 problem (1 warning)\n",
5224   true);
5225 }
5226 // null ref option
5227 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
5228 // adding distinct options to control null checks in more detail
test143_null_ref_option()5229 public void test143_null_ref_option(){
5230 	this.runConformTest(
5231 		new String[] {
5232 			"X.java",
5233 			"public class X {\n" +
5234 			"  void foo() {\n" +
5235 			"    Object o = null;\n" +
5236 			"    if (o == null) {}\n" +
5237 			"  }\n" +
5238 			"}"},
5239 "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5240 + " -1.5 -g -preserveAllLocals"
5241 + " -bootclasspath " + getLibraryClassesAsQuotedString()
5242 + " -cp " + getJCEJarAsQuotedString()
5243 + " -warn:+nullDereference"
5244 + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5245 "",
5246 "",
5247 true);
5248 }
5249 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=190493
test144()5250 public void test144() throws Exception {
5251 	String version = System.getProperty("java.class.version");
5252 	if ("49.0".equals(version)) {
5253 		this.runConformTest(
5254 			new String[] {
5255 				"X.java",
5256 				"/** */\n" +
5257 				"public class X {\n" +
5258 				"}",
5259 			},
5260 			"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5261 			+ " -1.6 -source 1.6 -d \"" + OUTPUT_DIR + "\"",
5262 			"",
5263 			"Annotation processing got disabled, since it requires a 1.6 compliant JVM\n",
5264 			true);
5265 		String expectedOutput = "// Compiled from X.java (version 1.6 : 50.0, super bit)";
5266 		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
5267 	}
5268 }
5269 // reporting unnecessary declaration of thrown checked exceptions
5270 // default is off
test145_declared_thrown_checked_exceptions()5271 public void test145_declared_thrown_checked_exceptions(){
5272 	this.runConformTest(
5273 		new String[] {
5274 			"X.java",
5275 			"import java.io.IOException;\n" +
5276 			"public class X {\n" +
5277 			"  public void foo() throws IOException {\n" +
5278 			"  }\n" +
5279 			"}\n"},
5280   "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5281   + " -1.5 -g -preserveAllLocals"
5282   + " -bootclasspath " + getLibraryClassesAsQuotedString()
5283   + " -cp " + getJCEJarAsQuotedString()
5284   + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5285   "",
5286   "",
5287   true);
5288 }
5289 // reporting unnecessary declaration of thrown checked exceptions
test146_declared_thrown_checked_exceptions()5290 public void test146_declared_thrown_checked_exceptions(){
5291 	this.runConformTest(
5292 		new String[] {
5293 			"X.java",
5294 			"import java.io.IOException;\n" +
5295 			"public class X {\n" +
5296 			"  public void foo() throws IOException {\n" +
5297 			"  }\n" +
5298 			"}\n"},
5299   "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5300   + " -1.5 -g -preserveAllLocals"
5301   + " -bootclasspath " + getLibraryClassesAsQuotedString()
5302   + " -cp " + getJCEJarAsQuotedString()
5303   + " -warn:+unusedThrown"
5304   + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5305   "",
5306   "----------\n" +
5307   "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
5308   "	public void foo() throws IOException {\n" +
5309   "	                         ^^^^^^^^^^^\n" +
5310   "The declared exception IOException is not actually thrown by the method foo() from type X\n" +
5311   "----------\n" +
5312   "1 problem (1 warning)\n",
5313   true);
5314 }
5315 
5316 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=122885
5317 //coverage test
test148_access_restrictions()5318 public void test148_access_restrictions(){
5319 	this.runNegativeTest(
5320 		new String[] {
5321 			"X.java",
5322 			"/** */\n" +
5323 			"public class X {\n" +
5324 			"	KO ko;\n" +
5325 			"   void foo() {\n" +
5326 			"     ko = new KO();\n" +
5327 			"     ko.bar();\n" +
5328 			"     if (ko.m) {}\n" +
5329 			"   }\n" +
5330 			"   Zork z;\n" +
5331 			"}",
5332 			"KO.java",
5333 			"/** */\n" +
5334 			"public class KO {\n" +
5335 			"  void bar() {};\n" +
5336 			"  boolean m;\n" +
5337 			"}",
5338 		},
5339   "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5340   + " -1.5 -g -preserveAllLocals"
5341   + " -cp \"" + OUTPUT_DIR + "[-KO]\""
5342   + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
5343   + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5344   "",
5345   "----------\n" +
5346   "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
5347   "	KO ko;\n" +
5348   "	^^\n" +
5349   "Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
5350   "----------\n" +
5351   "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5352   "	ko = new KO();\n" +
5353   "	         ^^\n" +
5354   "Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
5355   "----------\n" +
5356   "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5357   "	ko = new KO();\n" +
5358   "	         ^^\n" +
5359   "Access restriction: The constructor \'KO()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
5360   "----------\n" +
5361   "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
5362   "	ko.bar();\n" +
5363   "	   ^^^\n" +
5364   "Access restriction: The method \'KO.bar()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
5365   "----------\n" +
5366   "5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
5367   "	if (ko.m) {}\n" +
5368   "	       ^\n" +
5369   "Access restriction: The field \'KO.m\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
5370   "----------\n" +
5371   "6. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 9)\n" +
5372   "	Zork z;\n" +
5373   "	^^^^\n" +
5374   "Zork cannot be resolved to a type\n" +
5375   "----------\n" +
5376   "6 problems (1 error, 5 warnings)\n",
5377   true);
5378 }
5379 //http://bugs.eclipse.org/bugs/show_bug.cgi?id=168230
test149()5380 public void test149() {
5381 	this.runConformTest(
5382 		new String[] {
5383 			"X.java",
5384 			"public class X {\n" +
5385 			"	public static void foo() {}\n" +
5386 			"	public static void bar() {\n" +
5387 			"		X.<String>foo();\n" +
5388 			"	}\n" +
5389 			"}",
5390 		},
5391 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5392 		+ " -1.7 -warn:-unused -proc:none -d \"" + OUTPUT_DIR + "\"",
5393 		"",
5394 		"",
5395 		true);
5396 }
5397 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=192875
5398 // default in now on for nullDereference
test150_null_ref_options()5399 public void test150_null_ref_options() {
5400 	this.runConformTest(
5401 		new String[] {
5402 			"X.java",
5403 			"public class X {\n" +
5404 			"	public static void foo() {\n" +
5405 			"     String s = null;\n" +
5406 			"     s.toString();\n" +
5407 			"   }\n" +
5408 			"	// Zork z;\n" +
5409 			"}",
5410 		},
5411 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5412 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
5413 		"",
5414 		"----------\n" +
5415 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5416 		"	s.toString();\n" +
5417 		"	^\n" +
5418 		"Null pointer access: The variable s can only be null at this location\n" +
5419 		"----------\n" +
5420 		"1 problem (1 warning)\n",
5421 		true);
5422 }
5423 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=192875
5424 // default in now on for nullDereference
test151_null_ref_options()5425 public void test151_null_ref_options() {
5426 	this.runConformTest(
5427 		new String[] {
5428 			"X.java",
5429 			"public class X {\n" +
5430 			"	public static void foo() {\n" +
5431 			"     String s = null;\n" +
5432 			"     s.toString();\n" +
5433 			"   }\n" +
5434 			"	// Zork z;\n" +
5435 			"}",
5436 		},
5437 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5438 		+ " -warn:-nullDereference -proc:none -d \"" + OUTPUT_DIR + "\"",
5439 		"",
5440 		"",
5441 		true);
5442 }
5443 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=138018
test152()5444 public void test152() {
5445 	this.runConformTest(
5446 		new String[] {
5447 			"X.java",
5448 			"public class X {\n" +
5449 			"	public static void foo() {\n" +
5450 			"     String s = null;\n" +
5451 			"     s.toString();\n" +
5452 			"   }\n" +
5453 			"	// Zork z;\n" +
5454 			"}",
5455 		},
5456 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5457 		+ " -warn:-nullDereferences -proc:none -d \"" + OUTPUT_DIR + "\"",
5458 		"",
5459 		"invalid warning token: 'nullDereferences'. Ignoring warning and compiling\n" +
5460 		"----------\n" +
5461 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5462 		"	s.toString();\n" +
5463 		"	^\n" +
5464 		"Null pointer access: The variable s can only be null at this location\n" +
5465 		"----------\n" +
5466 		"1 problem (1 warning)\n",
5467 		true);
5468 }
5469 // -warn option - regression tests
test153_warn_options()5470 public void test153_warn_options() {
5471 	// check defaults
5472 	this.runConformTest(
5473 		new String[] {
5474 			"X.java",
5475 			"public class X {\n" +
5476 			"	public static void foo() {\n" +
5477 			"     String s = null;\n" +
5478 			"     s.toString();\n" +
5479 			"     String u;\n" +
5480 			"   }\n" +
5481 			"}",
5482 		},
5483 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5484 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
5485 //		+ " -warn:none -proc:none -d \"" + OUTPUT_DIR + "\"",
5486 		"",
5487 		"----------\n" +
5488 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5489 		"	s.toString();\n" +
5490 		"	^\n" +
5491 		"Null pointer access: The variable s can only be null at this location\n" +
5492 		"----------\n" +
5493 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5494 		"	String u;\n" +
5495 		"	       ^\n" +
5496 		"The value of the local variable u is not used\n" +
5497 		"----------\n" +
5498 		"2 problems (2 warnings)\n",
5499 		true);
5500 	// observe -warn options variations
5501 	this.runConformTest(
5502 		new String[] { },
5503 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5504 		+ " -warn:none -proc:none -d \"" + OUTPUT_DIR + "\"",
5505 		"",
5506 		"",
5507 		false);
5508 }
5509 // -warn option - regression tests
test154_warn_options()5510 public void test154_warn_options() {
5511 	// same source as 153, skip default checks
5512 	this.runConformTest(
5513 		new String[] {
5514 			"X.java",
5515 			"public class X {\n" +
5516 			"	public static void foo() {\n" +
5517 			"     String s = null;\n" +
5518 			"     s.toString();\n" +
5519 			"     String u;\n" +
5520 			"   }\n" +
5521 			"}",
5522 		},
5523 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5524 		+ " -warn:null -proc:none -d \"" + OUTPUT_DIR + "\"",
5525 		"",
5526 		"----------\n" +
5527 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5528 		"	s.toString();\n" +
5529 		"	^\n" +
5530 		"Null pointer access: The variable s can only be null at this location\n" +
5531 		"----------\n" +
5532 		"1 problem (1 warning)\n",
5533 		true);
5534 }
5535 // -warn option - regression tests
test155_warn_options()5536 public void test155_warn_options() {
5537 	// same source as 153, skip default checks
5538 	this.runConformTest(
5539 		new String[] {
5540 			"X.java",
5541 			"public class X {\n" +
5542 			"	public static void foo() {\n" +
5543 			"     String s = null;\n" +
5544 			"     s.toString();\n" +
5545 			"     String u;\n" +
5546 			"   }\n" +
5547 			"}",
5548 		},
5549 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5550 		+ " -warn:none -warn:null -proc:none -d \"" + OUTPUT_DIR + "\"",
5551 		"",
5552 		"----------\n" +
5553 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5554 		"	s.toString();\n" +
5555 		"	^\n" +
5556 		"Null pointer access: The variable s can only be null at this location\n" +
5557 		"----------\n" +
5558 		"1 problem (1 warning)\n",
5559 		true);
5560 }
5561 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210518
5562 // bad behavior for -warn:null -warn:unused
test156_warn_options()5563 public void test156_warn_options() {
5564 	// same source as 153, skip default checks
5565 	this.runConformTest(
5566 		new String[] {
5567 			"X.java",
5568 			"public class X {\n" +
5569 			"	public static void foo() {\n" +
5570 			"     String s = null;\n" +
5571 			"     s.toString();\n" +
5572 			"     String u;\n" +
5573 			"   }\n" +
5574 			"}",
5575 		},
5576 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5577 		+ " -warn:null -warn:unused -proc:none -d \"" + OUTPUT_DIR + "\"",
5578 		"",
5579 		"----------\n" +
5580 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5581 		"	String u;\n" +
5582 		"	       ^\n" +
5583 		"The value of the local variable u is not used\n" +
5584 		"----------\n" +
5585 		"1 problem (1 warning)\n",
5586 		true);
5587 }
5588 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210518
5589 // variant
test157_warn_options()5590 public void test157_warn_options() {
5591 	// same source as 153, skip default checks
5592 	this.runConformTest(
5593 		new String[] {
5594 			"X.java",
5595 			"public class X {\n" +
5596 			"	public static void foo() {\n" +
5597 			"     String s = null;\n" +
5598 			"     s.toString();\n" +
5599 			"     String u;\n" +
5600 			"   }\n" +
5601 			"}",
5602 		},
5603 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5604 		+ " -warn:null -warn:+unused -proc:none -d \"" + OUTPUT_DIR + "\"",
5605 		"",
5606 		"----------\n" +
5607 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5608 		"	s.toString();\n" +
5609 		"	^\n" +
5610 		"Null pointer access: The variable s can only be null at this location\n" +
5611 		"----------\n" +
5612 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5613 		"	String u;\n" +
5614 		"	       ^\n" +
5615 		"The value of the local variable u is not used\n" +
5616 		"----------\n" +
5617 		"2 problems (2 warnings)\n",
5618 		true);
5619 }
5620 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210518
5621 // variant
test158_warn_options()5622 public void test158_warn_options() {
5623 	// same source as 153, skip default checks
5624 	this.runConformTest(
5625 		new String[] {
5626 			"X.java",
5627 			"public class X {\n" +
5628 			"	public static void foo() {\n" +
5629 			"     String s = null;\n" +
5630 			"     s.toString();\n" +
5631 			"     String u;\n" +
5632 			"   }\n" +
5633 			"}",
5634 		},
5635 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5636 		+ " -warn:null -warn:+unused -warn:-null -proc:none -d \"" + OUTPUT_DIR + "\"",
5637 		"",
5638 		"----------\n" +
5639 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5640 		"	String u;\n" +
5641 		"	       ^\n" +
5642 		"The value of the local variable u is not used\n" +
5643 		"----------\n" +
5644 		"1 problem (1 warning)\n",
5645 		true);
5646 }
5647 // -warn option - regression tests
test159_warn_options()5648 public void test159_warn_options() {
5649 	// same source as 153, skip default checks
5650 	this.runConformTest(
5651 		new String[] {
5652 			"X.java",
5653 			"public class X {\n" +
5654 			"	public static void foo() {\n" +
5655 			"     String s = null;\n" +
5656 			"     s.toString();\n" +
5657 			"     String u;\n" +
5658 			"   }\n" +
5659 			"}",
5660 		},
5661 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5662 		+ " -warn:unused -proc:none -d \"" + OUTPUT_DIR + "\"",
5663 		"",
5664 		"----------\n" +
5665 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5666 		"	String u;\n" +
5667 		"	       ^\n" +
5668 		"The value of the local variable u is not used\n" +
5669 		"----------\n" +
5670 		"1 problem (1 warning)\n",
5671 		true);
5672 }
5673 // -warn option - regression tests
test160_warn_options()5674 public void test160_warn_options() {
5675 	// same source as 153, skip default checks
5676 	this.runConformTest(
5677 		new String[] {
5678 			"X.java",
5679 			"public class X {\n" +
5680 			"	public static void foo() {\n" +
5681 			"     String s = null;\n" +
5682 			"     s.toString();\n" +
5683 			"     String u;\n" +
5684 			"   }\n" +
5685 			"}",
5686 		},
5687 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5688 		+ " -warn:none -warn:+unused,null -proc:none -d \"" + OUTPUT_DIR + "\"",
5689 		"",
5690 		"----------\n" +
5691 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5692 		"	s.toString();\n" +
5693 		"	^\n" +
5694 		"Null pointer access: The variable s can only be null at this location\n" +
5695 		"----------\n" +
5696 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5697 		"	String u;\n" +
5698 		"	       ^\n" +
5699 		"The value of the local variable u is not used\n" +
5700 		"----------\n" +
5701 		"2 problems (2 warnings)\n",
5702 		true);
5703 }
5704 // -warn option - regression tests
5705 // this one is undocumented but makes some sense
test161_warn_options()5706 public void test161_warn_options() {
5707 	// same source as 153, skip default checks
5708 	this.runConformTest(
5709 		new String[] {
5710 			"X.java",
5711 			"public class X {\n" +
5712 			"	public static void foo() {\n" +
5713 			"     String s = null;\n" +
5714 			"     s.toString();\n" +
5715 			"     String u;\n" +
5716 			"   }\n" +
5717 			"}",
5718 		},
5719 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5720 		+ " -warn:-null,unused,+unused,null -proc:none -d \"" + OUTPUT_DIR + "\"",
5721 		"",
5722 		"----------\n" +
5723 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
5724 		"	s.toString();\n" +
5725 		"	^\n" +
5726 		"Null pointer access: The variable s can only be null at this location\n" +
5727 		"----------\n" +
5728 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
5729 		"	String u;\n" +
5730 		"	       ^\n" +
5731 		"The value of the local variable u is not used\n" +
5732 		"----------\n" +
5733 		"2 problems (2 warnings)\n",
5734 		true);
5735 }
5736 // -warn option - regression tests
5737 // this one is undocumented but makes some sense
test162_warn_options()5738 public void test162_warn_options() {
5739 	// same source as 153, skip default checks
5740 	this.runConformTest(
5741 		new String[] {
5742 			"X.java",
5743 			"public class X {\n" +
5744 			"	public static void foo() {\n" +
5745 			"     String s = null;\n" +
5746 			"     s.toString();\n" +
5747 			"     String u;\n" +
5748 			"   }\n" +
5749 			"}",
5750 		},
5751 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5752 		+ " -nowarn -warn:+null,unused,-unused,null -proc:none -d \"" + OUTPUT_DIR + "\"",
5753 		"",
5754 		"",
5755 		true);
5756 }
5757 // -warn option - regression tests
test163_warn_options()5758 public void test163_warn_options() {
5759 	// check defaults
5760 	this.runConformTest(
5761 		new String[] {
5762 			"X.java",
5763 			"public class X {\n" +
5764 			"  Y f;\n" +
5765 			"}",
5766 			"Y.java",
5767 			"/** @deprecated */\n" +
5768 			"public class Y {\n" +
5769 			"}",
5770 		},
5771 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5772 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
5773 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
5774 		"",
5775 		"----------\n" +
5776 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
5777 		"	Y f;\n" +
5778 		"	^\n" +
5779 		"The type Y is deprecated\n" +
5780 		"----------\n" +
5781 		"1 problem (1 warning)\n",
5782 		true);
5783 	// observe -warn options variations
5784 	this.runConformTest(
5785 		new String[] { },
5786 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5787 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
5788 		+ " -warn:none -proc:none -d \"" + OUTPUT_DIR + "\"",
5789 		"",
5790 		"",
5791 		false);
5792 }
5793 // -warn option - regression tests
test164_warn_options()5794 public void test164_warn_options() {
5795 	// same source as 163, skip check defaults
5796 	this.runConformTest(
5797 		new String[] {
5798 			"X.java",
5799 			"public class X {\n" +
5800 			"  Y f;\n" +
5801 			"}",
5802 			"Y.java",
5803 			"/** @deprecated */\n" +
5804 			"public class Y {\n" +
5805 			"}",
5806 		},
5807 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5808 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
5809 		+ " -nowarn -deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
5810 		"",
5811 		"----------\n" +
5812 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
5813 		"	Y f;\n" +
5814 		"	^\n" +
5815 		"The type Y is deprecated\n" +
5816 		"----------\n" +
5817 		"1 problem (1 warning)\n",
5818 		true);
5819 }
5820 // -warn option - regression tests
test165_warn_options()5821 public void test165_warn_options() {
5822 	// same source as 163, skip check defaults
5823 	this.runConformTest(
5824 		new String[] {
5825 			"X.java",
5826 			"public class X {\n" +
5827 			"  Y f;\n" +
5828 			"}",
5829 			"Y.java",
5830 			"/** @deprecated */\n" +
5831 			"public class Y {\n" +
5832 			"}",
5833 		},
5834 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5835 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
5836 		+ " -nowarn -deprecation -warn:-deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
5837 		"",
5838 		"",
5839 		true);
5840 }
5841 // -warn option - regression tests
test166_warn_options()5842 public void test166_warn_options() {
5843 	// same source as 163, skip check defaults
5844 	this.runConformTest(
5845 		new String[] {
5846 			"X.java",
5847 			"public class X {\n" +
5848 			"  Y f;\n" +
5849 			"}",
5850 			"Y.java",
5851 			"/** @deprecated */\n" +
5852 			"public class Y {\n" +
5853 			"}",
5854 		},
5855 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5856 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
5857 		+ " -nowarn -deprecation -warn:-allDeprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
5858 		"",
5859 		"",
5860 		true);
5861 }
5862 // -warn option - regression tests
test167_warn_options()5863 public void test167_warn_options() {
5864 	// same source as 163, skip check defaults
5865 	this.runConformTest(
5866 		new String[] {
5867 			"X.java",
5868 			"public class X {\n" +
5869 			"  Y f;\n" +
5870 			"}",
5871 			"Y.java",
5872 			"/** @deprecated */\n" +
5873 			"public class Y {\n" +
5874 			"}",
5875 		},
5876 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5877 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
5878 		+ " -warn:allDeprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
5879 		"",
5880 		"----------\n" +
5881 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
5882 		"	Y f;\n" +
5883 		"	^\n" +
5884 		"The type Y is deprecated\n" +
5885 		"----------\n" +
5886 		"1 problem (1 warning)\n",
5887 		true);
5888 }
5889 // -warn option - regression tests
test168_warn_options()5890 public void test168_warn_options() {
5891 	// check defaults
5892 	this.runConformTest(
5893 		new String[] {
5894 			"X.java",
5895 			"public class X {\n" +
5896 			"  /**\n" +
5897 			"    @param\n" +
5898 			"  */\n" +
5899 			"  public void foo() {\n" +
5900 			"  }\n" +
5901 			"}",
5902 		},
5903 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5904 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
5905 		"",
5906 		"",
5907 		true);
5908 	// observe -warn options variations
5909 	this.runConformTest(
5910 		new String[] { },
5911 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5912 		+ " -warn:javadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
5913 		"",
5914 		"----------\n" +
5915 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
5916 		"	@param\n" +
5917 		"	 ^^^^^\n" +
5918 		"Javadoc: Missing parameter name\n" +
5919 		"----------\n" +
5920 		"1 problem (1 warning)\n",
5921 		false);
5922 }
5923 // -warn option - regression tests
test169_warn_options()5924 public void test169_warn_options() {
5925 	// same source as 168, skip check defaults
5926 	this.runConformTest(
5927 		new String[] {
5928 			"X.java",
5929 			"public class X {\n" +
5930 			"  /**\n" +
5931 			"    @param\n" +
5932 			"  */\n" +
5933 			"  public void foo() {\n" +
5934 			"  }\n" +
5935 			"}",
5936 		},
5937 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5938 		+ " -warn:allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
5939 		"",
5940 		"----------\n" +
5941 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
5942 		"	public class X {\n" +
5943 		"	             ^\n" +
5944 		"Javadoc: Missing comment for public declaration\n" +
5945 		"----------\n" +
5946 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
5947 		"	@param\n" +
5948 		"	 ^^^^^\n" +
5949 		"Javadoc: Missing parameter name\n" +
5950 		"----------\n" +
5951 		"2 problems (2 warnings)\n",
5952 		true);
5953 }
5954 // -warn option - regression tests
test170_warn_options()5955 public void test170_warn_options() {
5956 	// same source as 168, skip check defaults
5957 	this.runConformTest(
5958 		new String[] {
5959 			"X.java",
5960 			"public class X {\n" +
5961 			"  /**\n" +
5962 			"    @param\n" +
5963 			"  */\n" +
5964 			"  public void foo() {\n" +
5965 			"  }\n" +
5966 			"}",
5967 		},
5968 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5969 		+ " -warn:javadoc -warn:-allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
5970 		"",
5971 		"",
5972 		true);
5973 }
5974 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210521
5975 // -warn option - regression tests
test171_warn_options()5976 public void test171_warn_options() {
5977 	// same source as 168, skip check defaults
5978 	this.runConformTest(
5979 		new String[] {
5980 			"X.java",
5981 			"public class X {\n" +
5982 			"  /**\n" +
5983 			"    @param\n" +
5984 			"  */\n" +
5985 			"  public void foo() {\n" +
5986 			"  }\n" +
5987 			"}",
5988 		},
5989 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
5990 		+ " -warn:allJavadoc -warn:-javadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
5991 		"",
5992 		"----------\n" +
5993 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
5994 		"	public class X {\n" +
5995 		"	             ^\n" +
5996 		"Javadoc: Missing comment for public declaration\n" +
5997 		"----------\n" +
5998 		"1 problem (1 warning)\n",
5999 		true);
6000 }
6001 // -warn option - regression tests
test172_warn_options()6002 public void test172_warn_options() {
6003 	// check defaults
6004 	this.runConformTest(
6005 		new String[] {
6006 			"X.java",
6007 			"public class X {\n" +
6008 			"  Y f;\n" +
6009 			"  /** @deprecated */\n" +
6010 			"  void foo(Y p) {\n" +
6011 			"  }\n" +
6012 			"}",
6013 			"Y.java",
6014 			"/** @deprecated */\n" +
6015 			"public class Y {\n" +
6016 			"}",
6017 		},
6018 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6019 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
6020 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
6021 		"",
6022 		"----------\n" +
6023 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
6024 		"	Y f;\n" +
6025 		"	^\n" +
6026 		"The type Y is deprecated\n" +
6027 		"----------\n" +
6028 		"1 problem (1 warning)\n",
6029 		true);
6030 	// observe -warn options variations
6031 	this.runConformTest(
6032 		new String[] { },
6033 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6034 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
6035 		+ " -warn:allDeprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
6036 		"",
6037 		"----------\n" +
6038 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
6039 		"	Y f;\n" +
6040 		"	^\n" +
6041 		"The type Y is deprecated\n" +
6042 		"----------\n" +
6043 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6044 		"	void foo(Y p) {\n" +
6045 		"	         ^\n" +
6046 		"The type Y is deprecated\n" +
6047 		"----------\n" +
6048 		"2 problems (2 warnings)\n",
6049 		false);
6050 }
6051 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
6052 // -warn option - regression tests
_test173_warn_options()6053 public void _test173_warn_options() {
6054 	// same source as 172, skip check defaults
6055 	this.runConformTest(
6056 		new String[] {
6057 			"X.java",
6058 			"public class X {\n" +
6059 			"  Y f;\n" +
6060 			"  /** @deprecated */\n" +
6061 			"  void foo(Y p) {\n" +
6062 			"  }\n" +
6063 			"}",
6064 			"Y.java",
6065 			"/** @deprecated */\n" +
6066 			"public class Y {\n" +
6067 			"}",
6068 		},
6069 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6070 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
6071 		+ " -warn:allDeprecation -warn:-deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
6072 		"",
6073 		"----------\n" +
6074 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6075 		"	void foo(Y p) {\n" +
6076 		"	         ^\n" +
6077 		"The type Y is deprecated\n" +
6078 		"----------\n" +
6079 		"1 problem (1 warning)",
6080 		true);
6081 }
6082 // -warn option - regression tests
test174_warn_options()6083 public void test174_warn_options() {
6084 	// check defaults
6085 	this.runConformTest(
6086 		new String[] {
6087 			"X.java",
6088 			"public class X {\n" +
6089 			"  int i;\n" +
6090 			"  class XX {\n" +
6091 			"    int i;\n" +
6092 			"  }\n" +
6093 			"  void foo(int i) {\n" +
6094 			"    class XX {\n" +
6095 			"    }\n" +
6096 			"    if (i > 0) {\n" +
6097 			"      try {\n" +
6098 			"        bar();\n" +
6099 			"      } catch (E2 e2) {\n" +
6100 			"      } catch (E1 e1) {\n" +
6101 			"      }\n" +
6102 			"    }\n" +
6103 			"  }\n" +
6104 			"  void bar() throws E2 {\n" +
6105 			"    throw new E2();\n" +
6106 			"  }\n" +
6107 			"}\n" +
6108 			"class E1 extends Exception {\n" +
6109 			"  private static final long serialVersionUID = 1L;\n" +
6110 			"}\n" +
6111 			"class E2 extends E1 {\n" +
6112 			"  private static final long serialVersionUID = 1L;\n" +
6113 			"}"
6114 		},
6115 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6116 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
6117 		"",
6118 		"----------\n" +
6119 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6120 		"	class XX {\n" +
6121 		"	      ^^\n" +
6122 		"The type XX is hiding the type X.XX\n" +
6123 		"----------\n" +
6124 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6125 		"	class XX {\n" +
6126 		"	      ^^\n" +
6127 		"The type XX is never used locally\n" +
6128 		"----------\n" +
6129 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
6130 		"	} catch (E1 e1) {\n" +
6131 		"	         ^^\n" +
6132 		"Unreachable catch block for E1. Only more specific exceptions are thrown and they are handled by previous catch block(s).\n" +
6133 		"----------\n" +
6134 		"3 problems (3 warnings)\n",
6135 		true);
6136 	// observe -warn options variations
6137 	this.runConformTest(
6138 		new String[] { },
6139 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6140 		+ " -nowarn -proc:none -d \"" + OUTPUT_DIR + "\"",
6141 		"",
6142 		"",
6143 		false);
6144 }
6145 // -warn option - regression tests
test175_warn_options()6146 public void test175_warn_options() {
6147 	// same source as 174, skip check defaults
6148 	this.runConformTest(
6149 		new String[] {
6150 			"X.java",
6151 			"public class X {\n" +
6152 			"  int i;\n" +
6153 			"  class XX {\n" +
6154 			"    int i;\n" +
6155 			"  }\n" +
6156 			"  void foo(int i) {\n" +
6157 			"    class XX {\n" +
6158 			"    }\n" +
6159 			"    if (i > 0) {\n" +
6160 			"      try {\n" +
6161 			"        bar();\n" +
6162 			"      } catch (E2 e2) {\n" +
6163 			"      } catch (E1 e1) {\n" +
6164 			"      }\n" +
6165 			"    }\n" +
6166 			"  }\n" +
6167 			"  void bar() throws E2 {\n" +
6168 			"    throw new E2();\n" +
6169 			"  }\n" +
6170 			"}\n" +
6171 			"class E1 extends Exception {\n" +
6172 			"  private static final long serialVersionUID = 1L;\n" +
6173 			"}\n" +
6174 			"class E2 extends E1 {\n" +
6175 			"  private static final long serialVersionUID = 1L;\n" +
6176 			"}"
6177 		},
6178 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6179 		+ " -warn:hiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6180 		"",
6181 		"----------\n" +
6182 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6183 		"	int i;\n" +
6184 		"	    ^\n" +
6185 		"The field X.XX.i is hiding a field from type X\n" +
6186 		"----------\n" +
6187 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6188 		"	void foo(int i) {\n" +
6189 		"	             ^\n" +
6190 		"The parameter i is hiding a field from type X\n" +
6191 		"----------\n" +
6192 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6193 		"	class XX {\n" +
6194 		"	      ^^\n" +
6195 		"The type XX is hiding the type X.XX\n" +
6196 		"----------\n" +
6197 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
6198 		"	} catch (E1 e1) {\n" +
6199 		"	         ^^\n" +
6200 		"Unreachable catch block for E1. Only more specific exceptions are thrown and they are handled by previous catch block(s).\n" +
6201 		"----------\n" +
6202 		"4 problems (4 warnings)\n",
6203 		true);
6204 }
6205 // -warn option - regression tests
test176_warn_options()6206 public void test176_warn_options() {
6207 	// same source as 174, skip check defaults
6208 	this.runConformTest(
6209 		new String[] {
6210 			"X.java",
6211 			"public class X {\n" +
6212 			"  int i;\n" +
6213 			"  class XX {\n" +
6214 			"    int i;\n" +
6215 			"  }\n" +
6216 			"  void foo(int i) {\n" +
6217 			"    class XX {\n" +
6218 			"    }\n" +
6219 			"    if (i > 0) {\n" +
6220 			"      try {\n" +
6221 			"        bar();\n" +
6222 			"      } catch (E2 e2) {\n" +
6223 			"      } catch (E1 e1) {\n" +
6224 			"      }\n" +
6225 			"    }\n" +
6226 			"  }\n" +
6227 			"  void bar() throws E2 {\n" +
6228 			"    throw new E2();\n" +
6229 			"  }\n" +
6230 			"}\n" +
6231 			"class E1 extends Exception {\n" +
6232 			"  private static final long serialVersionUID = 1L;\n" +
6233 			"}\n" +
6234 			"class E2 extends E1 {\n" +
6235 			"  private static final long serialVersionUID = 1L;\n" +
6236 			"}"
6237 		},
6238 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6239 		+ " -warn:fieldHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6240 		"",
6241 		"----------\n" +
6242 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6243 		"	int i;\n" +
6244 		"	    ^\n" +
6245 		"The field X.XX.i is hiding a field from type X\n" +
6246 		"----------\n" +
6247 		"1 problem (1 warning)\n",
6248 		true);
6249 }
6250 // -warn option - regression tests
test177_warn_options()6251 public void test177_warn_options() {
6252 	// same source as 174, skip check defaults
6253 	this.runConformTest(
6254 		new String[] {
6255 			"X.java",
6256 			"public class X {\n" +
6257 			"  int i;\n" +
6258 			"  class XX {\n" +
6259 			"    int i;\n" +
6260 			"  }\n" +
6261 			"  void foo(int i) {\n" +
6262 			"    class XX {\n" +
6263 			"    }\n" +
6264 			"    if (i > 0) {\n" +
6265 			"      try {\n" +
6266 			"        bar();\n" +
6267 			"      } catch (E2 e2) {\n" +
6268 			"      } catch (E1 e1) {\n" +
6269 			"      }\n" +
6270 			"    }\n" +
6271 			"  }\n" +
6272 			"  void bar() throws E2 {\n" +
6273 			"    throw new E2();\n" +
6274 			"  }\n" +
6275 			"}\n" +
6276 			"class E1 extends Exception {\n" +
6277 			"  private static final long serialVersionUID = 1L;\n" +
6278 			"}\n" +
6279 			"class E2 extends E1 {\n" +
6280 			"  private static final long serialVersionUID = 1L;\n" +
6281 			"}"
6282 		},
6283 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6284 		+ " -warn:localHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6285 		"",
6286 		"----------\n" +
6287 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6288 		"	void foo(int i) {\n" +
6289 		"	             ^\n" +
6290 		"The parameter i is hiding a field from type X\n" +
6291 		"----------\n" +
6292 		"1 problem (1 warning)\n",
6293 		true);
6294 }
6295 // -warn option - regression tests
test178_warn_options()6296 public void test178_warn_options() {
6297 	// same source as 174, skip check defaults
6298 	this.runConformTest(
6299 		new String[] {
6300 			"X.java",
6301 			"public class X {\n" +
6302 			"  int i;\n" +
6303 			"  class XX {\n" +
6304 			"    int i;\n" +
6305 			"  }\n" +
6306 			"  void foo(int i) {\n" +
6307 			"    class XX {\n" +
6308 			"    }\n" +
6309 			"    if (i > 0) {\n" +
6310 			"      try {\n" +
6311 			"        bar();\n" +
6312 			"      } catch (E2 e2) {\n" +
6313 			"      } catch (E1 e1) {\n" +
6314 			"      }\n" +
6315 			"    }\n" +
6316 			"  }\n" +
6317 			"  void bar() throws E2 {\n" +
6318 			"    throw new E2();\n" +
6319 			"  }\n" +
6320 			"}\n" +
6321 			"class E1 extends Exception {\n" +
6322 			"  private static final long serialVersionUID = 1L;\n" +
6323 			"}\n" +
6324 			"class E2 extends E1 {\n" +
6325 			"  private static final long serialVersionUID = 1L;\n" +
6326 			"}"
6327 		},
6328 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6329 		+ " -warn:maskedCatchBlock -proc:none -d \"" + OUTPUT_DIR + "\"",
6330 		"",
6331 		"----------\n" +
6332 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
6333 		"	} catch (E1 e1) {\n" +
6334 		"	         ^^\n" +
6335 		"Unreachable catch block for E1. Only more specific exceptions are thrown and they are handled by previous catch block(s).\n" +
6336 		"----------\n" +
6337 		"1 problem (1 warning)\n",
6338 		true);
6339 }
6340 // -warn option - regression tests
test179_warn_options()6341 public void test179_warn_options() {
6342 	// same source as 174, skip check defaults
6343 	this.runConformTest(
6344 		new String[] {
6345 			"X.java",
6346 			"public class X {\n" +
6347 			"  int i;\n" +
6348 			"  class XX {\n" +
6349 			"    int i;\n" +
6350 			"  }\n" +
6351 			"  void foo(int i) {\n" +
6352 			"    class XX {\n" +
6353 			"    }\n" +
6354 			"    if (i > 0) {\n" +
6355 			"      try {\n" +
6356 			"        bar();\n" +
6357 			"      } catch (E2 e2) {\n" +
6358 			"      } catch (E1 e1) {\n" +
6359 			"      }\n" +
6360 			"    }\n" +
6361 			"  }\n" +
6362 			"  void bar() throws E2 {\n" +
6363 			"    throw new E2();\n" +
6364 			"  }\n" +
6365 			"}\n" +
6366 			"class E1 extends Exception {\n" +
6367 			"  private static final long serialVersionUID = 1L;\n" +
6368 			"}\n" +
6369 			"class E2 extends E1 {\n" +
6370 			"  private static final long serialVersionUID = 1L;\n" +
6371 			"}"
6372 		},
6373 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6374 		+ " -warn:typeHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6375 		"",
6376 		"----------\n" +
6377 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6378 		"	class XX {\n" +
6379 		"	      ^^\n" +
6380 		"The type XX is hiding the type X.XX\n" +
6381 		"----------\n" +
6382 		"1 problem (1 warning)\n",
6383 		true);
6384 }
6385 // -warn option - regression tests
test180_warn_options()6386 public void test180_warn_options() {
6387 	// same source as 174, skip check defaults
6388 	this.runConformTest(
6389 		new String[] {
6390 			"X.java",
6391 			"public class X {\n" +
6392 			"  int i;\n" +
6393 			"  class XX {\n" +
6394 			"    int i;\n" +
6395 			"  }\n" +
6396 			"  void foo(int i) {\n" +
6397 			"    class XX {\n" +
6398 			"    }\n" +
6399 			"    if (i > 0) {\n" +
6400 			"      try {\n" +
6401 			"        bar();\n" +
6402 			"      } catch (E2 e2) {\n" +
6403 			"      } catch (E1 e1) {\n" +
6404 			"      }\n" +
6405 			"    }\n" +
6406 			"  }\n" +
6407 			"  void bar() throws E2 {\n" +
6408 			"    throw new E2();\n" +
6409 			"  }\n" +
6410 			"}\n" +
6411 			"class E1 extends Exception {\n" +
6412 			"  private static final long serialVersionUID = 1L;\n" +
6413 			"}\n" +
6414 			"class E2 extends E1 {\n" +
6415 			"  private static final long serialVersionUID = 1L;\n" +
6416 			"}"
6417 		},
6418 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6419 		+ " -warn:hiding -warn:-fieldHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6420 		"",
6421 		"----------\n" +
6422 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6423 		"	void foo(int i) {\n" +
6424 		"	             ^\n" +
6425 		"The parameter i is hiding a field from type X\n" +
6426 		"----------\n" +
6427 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6428 		"	class XX {\n" +
6429 		"	      ^^\n" +
6430 		"The type XX is hiding the type X.XX\n" +
6431 		"----------\n" +
6432 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
6433 		"	} catch (E1 e1) {\n" +
6434 		"	         ^^\n" +
6435 		"Unreachable catch block for E1. Only more specific exceptions are thrown and they are handled by previous catch block(s).\n" +
6436 		"----------\n" +
6437 		"3 problems (3 warnings)\n",
6438 		true);
6439 }
6440 // -warn option - regression tests
test181_warn_options()6441 public void test181_warn_options() {
6442 	// same source as 174, skip check defaults
6443 	this.runConformTest(
6444 		new String[] {
6445 			"X.java",
6446 			"public class X {\n" +
6447 			"  int i;\n" +
6448 			"  class XX {\n" +
6449 			"    int i;\n" +
6450 			"  }\n" +
6451 			"  void foo(int i) {\n" +
6452 			"    class XX {\n" +
6453 			"    }\n" +
6454 			"    if (i > 0) {\n" +
6455 			"      try {\n" +
6456 			"        bar();\n" +
6457 			"      } catch (E2 e2) {\n" +
6458 			"      } catch (E1 e1) {\n" +
6459 			"      }\n" +
6460 			"    }\n" +
6461 			"  }\n" +
6462 			"  void bar() throws E2 {\n" +
6463 			"    throw new E2();\n" +
6464 			"  }\n" +
6465 			"}\n" +
6466 			"class E1 extends Exception {\n" +
6467 			"  private static final long serialVersionUID = 1L;\n" +
6468 			"}\n" +
6469 			"class E2 extends E1 {\n" +
6470 			"  private static final long serialVersionUID = 1L;\n" +
6471 			"}"
6472 		},
6473 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6474 		+ " -warn:hiding -warn:-localHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6475 		"",
6476 		"----------\n" +
6477 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6478 		"	int i;\n" +
6479 		"	    ^\n" +
6480 		"The field X.XX.i is hiding a field from type X\n" +
6481 		"----------\n" +
6482 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6483 		"	class XX {\n" +
6484 		"	      ^^\n" +
6485 		"The type XX is hiding the type X.XX\n" +
6486 		"----------\n" +
6487 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
6488 		"	} catch (E1 e1) {\n" +
6489 		"	         ^^\n" +
6490 		"Unreachable catch block for E1. Only more specific exceptions are thrown and they are handled by previous catch block(s).\n" +
6491 		"----------\n" +
6492 		"3 problems (3 warnings)\n",
6493 		true);
6494 }
6495 // -warn option - regression tests
test182_warn_options()6496 public void test182_warn_options() {
6497 	// same source as 174, skip check defaults
6498 	this.runConformTest(
6499 		new String[] {
6500 			"X.java",
6501 			"public class X {\n" +
6502 			"  int i;\n" +
6503 			"  class XX {\n" +
6504 			"    int i;\n" +
6505 			"  }\n" +
6506 			"  void foo(int i) {\n" +
6507 			"    class XX {\n" +
6508 			"    }\n" +
6509 			"    if (i > 0) {\n" +
6510 			"      try {\n" +
6511 			"        bar();\n" +
6512 			"      } catch (E2 e2) {\n" +
6513 			"      } catch (E1 e1) {\n" +
6514 			"      }\n" +
6515 			"    }\n" +
6516 			"  }\n" +
6517 			"  void bar() throws E2 {\n" +
6518 			"    throw new E2();\n" +
6519 			"  }\n" +
6520 			"}\n" +
6521 			"class E1 extends Exception {\n" +
6522 			"  private static final long serialVersionUID = 1L;\n" +
6523 			"}\n" +
6524 			"class E2 extends E1 {\n" +
6525 			"  private static final long serialVersionUID = 1L;\n" +
6526 			"}"
6527 		},
6528 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6529 		+ " -warn:hiding -warn:-maskedCatchBlock -proc:none -d \"" + OUTPUT_DIR + "\"",
6530 		"",
6531 		"----------\n" +
6532 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6533 		"	int i;\n" +
6534 		"	    ^\n" +
6535 		"The field X.XX.i is hiding a field from type X\n" +
6536 		"----------\n" +
6537 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6538 		"	void foo(int i) {\n" +
6539 		"	             ^\n" +
6540 		"The parameter i is hiding a field from type X\n" +
6541 		"----------\n" +
6542 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
6543 		"	class XX {\n" +
6544 		"	      ^^\n" +
6545 		"The type XX is hiding the type X.XX\n" +
6546 		"----------\n" +
6547 		"3 problems (3 warnings)\n",
6548 		true);
6549 }
6550 // -warn option - regression tests
test183_warn_options()6551 public void test183_warn_options() {
6552 	// same source as 174, skip check defaults
6553 	this.runConformTest(
6554 		new String[] {
6555 			"X.java",
6556 			"public class X {\n" +
6557 			"  int i;\n" +
6558 			"  class XX {\n" +
6559 			"    int i;\n" +
6560 			"  }\n" +
6561 			"  void foo(int i) {\n" +
6562 			"    class XX {\n" +
6563 			"    }\n" +
6564 			"    if (i > 0) {\n" +
6565 			"      try {\n" +
6566 			"        bar();\n" +
6567 			"      } catch (E2 e2) {\n" +
6568 			"      } catch (E1 e1) {\n" +
6569 			"      }\n" +
6570 			"    }\n" +
6571 			"  }\n" +
6572 			"  void bar() throws E2 {\n" +
6573 			"    throw new E2();\n" +
6574 			"  }\n" +
6575 			"}\n" +
6576 			"class E1 extends Exception {\n" +
6577 			"  private static final long serialVersionUID = 1L;\n" +
6578 			"}\n" +
6579 			"class E2 extends E1 {\n" +
6580 			"  private static final long serialVersionUID = 1L;\n" +
6581 			"}"
6582 		},
6583 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6584 		+ " -warn:hiding -warn:-typeHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
6585 		"",
6586 		"----------\n" +
6587 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6588 		"	int i;\n" +
6589 		"	    ^\n" +
6590 		"The field X.XX.i is hiding a field from type X\n" +
6591 		"----------\n" +
6592 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6593 		"	void foo(int i) {\n" +
6594 		"	             ^\n" +
6595 		"The parameter i is hiding a field from type X\n" +
6596 		"----------\n" +
6597 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
6598 		"	} catch (E1 e1) {\n" +
6599 		"	         ^^\n" +
6600 		"Unreachable catch block for E1. Only more specific exceptions are thrown and they are handled by previous catch block(s).\n" +
6601 		"----------\n" +
6602 		"3 problems (3 warnings)\n",
6603 		true);
6604 }
6605 // -warn option - regression tests
test184_warn_options()6606 public void test184_warn_options() {
6607 	// check defaults
6608 	this.runConformTest(
6609 		new String[] {
6610 			"X.java",
6611 			"public class X extends Y {\n" +
6612 			"  public static int i;\n" +
6613 			"  void foo() {\n" +
6614 			"    if (this.i > X.j) {\n" +
6615 			"    }\n" +
6616 			"  }\n" +
6617 			"}\n" +
6618 			"class Y {\n" +
6619 			"  static int j;\n" +
6620 			"}"
6621 		},
6622 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6623 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
6624 		"",
6625 		"----------\n" +
6626 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6627 		"	if (this.i > X.j) {\n" +
6628 		"	         ^\n" +
6629 		"The static field X.i should be accessed in a static way\n" +
6630 		"----------\n" +
6631 		"1 problem (1 warning)\n",
6632 		true);
6633 	// observe -warn options variations
6634 	this.runConformTest(
6635 		new String[] { },
6636 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6637 		+ " -nowarn -proc:none -d \"" + OUTPUT_DIR + "\"",
6638 		"",
6639 		"",
6640 		false);
6641 }
6642 // -warn option - regression tests
test185_warn_options()6643 public void test185_warn_options() {
6644 	// same source as 184, skip check defaults
6645 	this.runConformTest(
6646 		new String[] {
6647 			"X.java",
6648 			"public class X extends Y {\n" +
6649 			"  public static int i;\n" +
6650 			"  void foo() {\n" +
6651 			"    if (this.i > X.j) {\n" +
6652 			"    }\n" +
6653 			"  }\n" +
6654 			"}\n" +
6655 			"class Y {\n" +
6656 			"  static int j;\n" +
6657 			"}"
6658 		},
6659 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6660 		+ " -warn:staticReceiver -proc:none -d \"" + OUTPUT_DIR + "\"",
6661 		"",
6662 		"----------\n" +
6663 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6664 		"	if (this.i > X.j) {\n" +
6665 		"	         ^\n" +
6666 		"The static field X.i should be accessed in a static way\n" +
6667 		"----------\n" +
6668 		"1 problem (1 warning)\n",
6669 		true);
6670 }
6671 // -warn option - regression tests
test186_warn_options()6672 public void test186_warn_options() {
6673 	// same source as 184, skip check defaults
6674 	this.runConformTest(
6675 		new String[] {
6676 			"X.java",
6677 			"public class X extends Y {\n" +
6678 			"  public static int i;\n" +
6679 			"  void foo() {\n" +
6680 			"    if (this.i > X.j) {\n" +
6681 			"    }\n" +
6682 			"  }\n" +
6683 			"}\n" +
6684 			"class Y {\n" +
6685 			"  static int j;\n" +
6686 			"}"
6687 		},
6688 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6689 		+ " -warn:indirectStatic -proc:none -d \"" + OUTPUT_DIR + "\"",
6690 		"",
6691 		"----------\n" +
6692 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6693 		"	if (this.i > X.j) {\n" +
6694 		"	               ^\n" +
6695 		"The static field Y.j should be accessed directly\n" +
6696 		"----------\n" +
6697 		"1 problem (1 warning)\n",
6698 		true);
6699 }
6700 // -warn option - regression tests
test187_warn_options()6701 public void test187_warn_options() {
6702 	// same source as 184, skip check defaults
6703 	this.runConformTest(
6704 		new String[] {
6705 			"X.java",
6706 			"public class X extends Y {\n" +
6707 			"  public static int i;\n" +
6708 			"  void foo() {\n" +
6709 			"    if (this.i > X.j) {\n" +
6710 			"    }\n" +
6711 			"  }\n" +
6712 			"}\n" +
6713 			"class Y {\n" +
6714 			"  static int j;\n" +
6715 			"}"
6716 		},
6717 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6718 		+ " -warn:static-access -proc:none -d \"" + OUTPUT_DIR + "\"",
6719 		"",
6720 		"----------\n" +
6721 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6722 		"	if (this.i > X.j) {\n" +
6723 		"	         ^\n" +
6724 		"The static field X.i should be accessed in a static way\n" +
6725 		"----------\n" +
6726 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6727 		"	if (this.i > X.j) {\n" +
6728 		"	               ^\n" +
6729 		"The static field Y.j should be accessed directly\n" +
6730 		"----------\n" +
6731 		"2 problems (2 warnings)\n",
6732 		true);
6733 }
6734 // -warn option - regression tests
test188_warn_options()6735 public void test188_warn_options() {
6736 	// same source as 184, skip check defaults
6737 	this.runConformTest(
6738 		new String[] {
6739 			"X.java",
6740 			"public class X extends Y {\n" +
6741 			"  public static int i;\n" +
6742 			"  void foo() {\n" +
6743 			"    if (this.i > X.j) {\n" +
6744 			"    }\n" +
6745 			"  }\n" +
6746 			"}\n" +
6747 			"class Y {\n" +
6748 			"  static int j;\n" +
6749 			"}"
6750 		},
6751 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6752 		+ " -warn:static-access -warn:-staticReceiver -proc:none -d \"" + OUTPUT_DIR + "\"",
6753 		"",
6754 		"----------\n" +
6755 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6756 		"	if (this.i > X.j) {\n" +
6757 		"	               ^\n" +
6758 		"The static field Y.j should be accessed directly\n" +
6759 		"----------\n" +
6760 		"1 problem (1 warning)\n",
6761 		true);
6762 }
6763 // -warn option - regression tests
test189_warn_options()6764 public void test189_warn_options() {
6765 	// same source as 184, skip check defaults
6766 	this.runConformTest(
6767 		new String[] {
6768 			"X.java",
6769 			"public class X extends Y {\n" +
6770 			"  public static int i;\n" +
6771 			"  void foo() {\n" +
6772 			"    if (this.i > X.j) {\n" +
6773 			"    }\n" +
6774 			"  }\n" +
6775 			"}\n" +
6776 			"class Y {\n" +
6777 			"  static int j;\n" +
6778 			"}"
6779 		},
6780 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6781 		+ " -warn:static-access -warn:-indirectStatic -proc:none -d \"" + OUTPUT_DIR + "\"",
6782 		"",
6783 		"----------\n" +
6784 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6785 		"	if (this.i > X.j) {\n" +
6786 		"	         ^\n" +
6787 		"The static field X.i should be accessed in a static way\n" +
6788 		"----------\n" +
6789 		"1 problem (1 warning)\n",
6790 		true);
6791 }
6792 // -warn option - regression tests
test190_warn_options()6793 public void test190_warn_options() {
6794 	// check defaults
6795 	this.runConformTest(
6796 		new String[] {
6797 			"X.java",
6798 			"import java.util.ArrayList;\n" +
6799 			"public class X extends Y {\n" +
6800 			"  private void foo(int i) throws java.io.IOException {\n" +
6801 			"    int j;\n" +
6802 			"    this.<String>bar();\n" +
6803 			"    next: for (;;) {\n" +
6804 			"      return;\n" +
6805 			"    }\n" +
6806 			"  }\n" +
6807 			"  void bar() {\n" +
6808 			"  }\n" +
6809 			"}\n" +
6810 			"class Y {\n" +
6811 			"  <T> void bar() {\n" +
6812 			"  }\n" +
6813 			"}"
6814 		},
6815 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6816 		+ " -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
6817 		"",
6818 		"----------\n" +
6819 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
6820 		"	import java.util.ArrayList;\n" +
6821 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
6822 		"The import java.util.ArrayList is never used\n" +
6823 		"----------\n" +
6824 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
6825 		"	private void foo(int i) throws java.io.IOException {\n" +
6826 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
6827 		"The method foo(int) from the type X is never used locally\n" +
6828 		"----------\n" +
6829 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6830 		"	int j;\n" +
6831 		"	    ^\n" +
6832 		"The value of the local variable j is not used\n" +
6833 		"----------\n" +
6834 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
6835 		"	this.<String>bar();\n" +
6836 		"	      ^^^^^^\n" +
6837 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
6838 		"----------\n" +
6839 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6840 		"	next: for (;;) {\n" +
6841 		"	^^^^\n" +
6842 		"The label next is never explicitly referenced\n" +
6843 		"----------\n" +
6844 		"5 problems (5 warnings)\n",
6845 		true);
6846 	// observe -warn options variations
6847 	this.runConformTest(
6848 		new String[] { },
6849 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6850 		+ " -nowarn -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
6851 		"",
6852 		"",
6853 		false);
6854 }
6855 // -warn option - regression tests
test191_warn_options()6856 public void test191_warn_options() {
6857 	// same source as 190, skip check defaults
6858 	this.runConformTest(
6859 		new String[] {
6860 			"X.java",
6861 			"import java.util.ArrayList;\n" +
6862 			"public class X extends Y {\n" +
6863 			"  private void foo(int i) throws java.io.IOException {\n" +
6864 			"    int j;\n" +
6865 			"    this.<String>bar();\n" +
6866 			"    next: for (;;) {\n" +
6867 			"      return;\n" +
6868 			"    }\n" +
6869 			"  }\n" +
6870 			"  void bar() {\n" +
6871 			"  }\n" +
6872 			"}\n" +
6873 			"class Y {\n" +
6874 			"  <T> void bar() {\n" +
6875 			"  }\n" +
6876 			"}"
6877 		},
6878 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6879 		+ " -warn:unused -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
6880 		"",
6881 		"----------\n" +
6882 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
6883 		"	import java.util.ArrayList;\n" +
6884 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
6885 		"The import java.util.ArrayList is never used\n" +
6886 		"----------\n" +
6887 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
6888 		"	private void foo(int i) throws java.io.IOException {\n" +
6889 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
6890 		"The method foo(int) from the type X is never used locally\n" +
6891 		"----------\n" +
6892 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
6893 		"	private void foo(int i) throws java.io.IOException {\n" +
6894 		"	                     ^\n" +
6895 		"The value of the parameter i is not used\n" +
6896 		"----------\n" +
6897 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
6898 		"	private void foo(int i) throws java.io.IOException {\n" +
6899 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
6900 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
6901 		"----------\n" +
6902 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
6903 		"	int j;\n" +
6904 		"	    ^\n" +
6905 		"The value of the local variable j is not used\n" +
6906 		"----------\n" +
6907 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
6908 		"	this.<String>bar();\n" +
6909 		"	      ^^^^^^\n" +
6910 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
6911 		"----------\n" +
6912 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
6913 		"	next: for (;;) {\n" +
6914 		"	^^^^\n" +
6915 		"The label next is never explicitly referenced\n" +
6916 		"----------\n" +
6917 		"8. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
6918 		"	<T> void bar() {\n" +
6919 		"	 ^\n" +
6920 		"Unused type parameter T\n" +
6921 		"----------\n" +
6922 		"8 problems (8 warnings)\n",
6923 		true);
6924 }
6925 // -warn option - regression tests
test192_warn_options()6926 public void test192_warn_options() {
6927 	// same source as 190, skip check defaults
6928 	this.runConformTest(
6929 		new String[] {
6930 			"X.java",
6931 			"import java.util.ArrayList;\n" +
6932 			"public class X extends Y {\n" +
6933 			"  private void foo(int i) throws java.io.IOException {\n" +
6934 			"    int j;\n" +
6935 			"    this.<String>bar();\n" +
6936 			"    next: for (;;) {\n" +
6937 			"      return;\n" +
6938 			"    }\n" +
6939 			"  }\n" +
6940 			"  void bar() {\n" +
6941 			"  }\n" +
6942 			"}\n" +
6943 			"class Y {\n" +
6944 			"  <T> void bar() {\n" +
6945 			"  }\n" +
6946 			"}"
6947 		},
6948 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6949 		+ " -warn:unusedArgument -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
6950 		"",
6951 		"----------\n" +
6952 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
6953 		"	private void foo(int i) throws java.io.IOException {\n" +
6954 		"	                     ^\n" +
6955 		"The value of the parameter i is not used\n" +
6956 		"----------\n" +
6957 		"1 problem (1 warning)\n",
6958 		true);
6959 }
6960 // -warn option - regression tests
test193_warn_options()6961 public void test193_warn_options() {
6962 	// same source as 190, skip check defaults
6963 	this.runConformTest(
6964 		new String[] {
6965 			"X.java",
6966 			"import java.util.ArrayList;\n" +
6967 			"public class X extends Y {\n" +
6968 			"  private void foo(int i) throws java.io.IOException {\n" +
6969 			"    int j;\n" +
6970 			"    this.<String>bar();\n" +
6971 			"    next: for (;;) {\n" +
6972 			"      return;\n" +
6973 			"    }\n" +
6974 			"  }\n" +
6975 			"  void bar() {\n" +
6976 			"  }\n" +
6977 			"}\n" +
6978 			"class Y {\n" +
6979 			"  <T> void bar() {\n" +
6980 			"  }\n" +
6981 			"}"
6982 		},
6983 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
6984 		+ " -warn:unusedImport -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
6985 		"",
6986 		"----------\n" +
6987 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
6988 		"	import java.util.ArrayList;\n" +
6989 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
6990 		"The import java.util.ArrayList is never used\n" +
6991 		"----------\n" +
6992 		"1 problem (1 warning)\n",
6993 		true);
6994 }
6995 // -warn option - regression tests
test194_warn_options()6996 public void test194_warn_options() {
6997 	// same source as 190, skip check defaults
6998 	this.runConformTest(
6999 		new String[] {
7000 			"X.java",
7001 			"import java.util.ArrayList;\n" +
7002 			"public class X extends Y {\n" +
7003 			"  private void foo(int i) throws java.io.IOException {\n" +
7004 			"    int j;\n" +
7005 			"    this.<String>bar();\n" +
7006 			"    next: for (;;) {\n" +
7007 			"      return;\n" +
7008 			"    }\n" +
7009 			"  }\n" +
7010 			"  void bar() {\n" +
7011 			"  }\n" +
7012 			"}\n" +
7013 			"class Y {\n" +
7014 			"  <T> void bar() {\n" +
7015 			"  }\n" +
7016 			"}"
7017 		},
7018 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7019 		+ " -warn:unusedLabel -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7020 		"",
7021 		"----------\n" +
7022 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7023 		"	next: for (;;) {\n" +
7024 		"	^^^^\n" +
7025 		"The label next is never explicitly referenced\n" +
7026 		"----------\n" +
7027 		"1 problem (1 warning)\n",
7028 		true);
7029 }
7030 // -warn option - regression tests
test195_warn_options()7031 public void test195_warn_options() {
7032 	// same source as 190, skip check defaults
7033 	this.runConformTest(
7034 		new String[] {
7035 			"X.java",
7036 			"import java.util.ArrayList;\n" +
7037 			"public class X extends Y {\n" +
7038 			"  private void foo(int i) throws java.io.IOException {\n" +
7039 			"    int j;\n" +
7040 			"    this.<String>bar();\n" +
7041 			"    next: for (;;) {\n" +
7042 			"      return;\n" +
7043 			"    }\n" +
7044 			"  }\n" +
7045 			"  void bar() {\n" +
7046 			"  }\n" +
7047 			"}\n" +
7048 			"class Y {\n" +
7049 			"  <T> void bar() {\n" +
7050 			"  }\n" +
7051 			"}"
7052 		},
7053 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7054 		+ " -warn:unusedLocal -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7055 		"",
7056 		"----------\n" +
7057 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7058 		"	int j;\n" +
7059 		"	    ^\n" +
7060 		"The value of the local variable j is not used\n" +
7061 		"----------\n" +
7062 		"1 problem (1 warning)\n",
7063 		true);
7064 }
7065 // -warn option - regression tests
test196_warn_options()7066 public void test196_warn_options() {
7067 	// same source as 190, skip check defaults
7068 	this.runConformTest(
7069 		new String[] {
7070 			"X.java",
7071 			"import java.util.ArrayList;\n" +
7072 			"public class X extends Y {\n" +
7073 			"  private void foo(int i) throws java.io.IOException {\n" +
7074 			"    int j;\n" +
7075 			"    this.<String>bar();\n" +
7076 			"    next: for (;;) {\n" +
7077 			"      return;\n" +
7078 			"    }\n" +
7079 			"  }\n" +
7080 			"  void bar() {\n" +
7081 			"  }\n" +
7082 			"}\n" +
7083 			"class Y {\n" +
7084 			"  <T> void bar() {\n" +
7085 			"  }\n" +
7086 			"}"
7087 		},
7088 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7089 		+ " -warn:unusedPrivate -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7090 		"",
7091 		"----------\n" +
7092 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7093 		"	private void foo(int i) throws java.io.IOException {\n" +
7094 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7095 		"The method foo(int) from the type X is never used locally\n" +
7096 		"----------\n" +
7097 		"1 problem (1 warning)\n",
7098 		true);
7099 }
7100 // -warn option - regression tests
test197_warn_options()7101 public void test197_warn_options() {
7102 	// same source as 190, skip check defaults
7103 	this.runConformTest(
7104 		new String[] {
7105 			"X.java",
7106 			"import java.util.ArrayList;\n" +
7107 			"public class X extends Y {\n" +
7108 			"  private void foo(int i) throws java.io.IOException {\n" +
7109 			"    int j;\n" +
7110 			"    this.<String>bar();\n" +
7111 			"    next: for (;;) {\n" +
7112 			"      return;\n" +
7113 			"    }\n" +
7114 			"  }\n" +
7115 			"  void bar() {\n" +
7116 			"  }\n" +
7117 			"}\n" +
7118 			"class Y {\n" +
7119 			"  <T> void bar() {\n" +
7120 			"  }\n" +
7121 			"}"
7122 		},
7123 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7124 		+ " -warn:unusedTypeArgs -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7125 		"",
7126 		"----------\n" +
7127 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7128 		"	this.<String>bar();\n" +
7129 		"	      ^^^^^^\n" +
7130 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7131 		"----------\n" +
7132 		"1 problem (1 warning)\n",
7133 		true);
7134 }
7135 // -warn option - regression tests
test198_warn_options()7136 public void test198_warn_options() {
7137 	// same source as 190, skip check defaults
7138 	this.runConformTest(
7139 		new String[] {
7140 			"X.java",
7141 			"import java.util.ArrayList;\n" +
7142 			"public class X extends Y {\n" +
7143 			"  private void foo(int i) throws java.io.IOException {\n" +
7144 			"    int j;\n" +
7145 			"    this.<String>bar();\n" +
7146 			"    next: for (;;) {\n" +
7147 			"      return;\n" +
7148 			"    }\n" +
7149 			"  }\n" +
7150 			"  void bar() {\n" +
7151 			"  }\n" +
7152 			"}\n" +
7153 			"class Y {\n" +
7154 			"  <T> void bar() {\n" +
7155 			"  }\n" +
7156 			"}"
7157 		},
7158 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7159 		+ " -warn:unusedThrown -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7160 		"",
7161 		"----------\n" +
7162 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7163 		"	private void foo(int i) throws java.io.IOException {\n" +
7164 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7165 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7166 		"----------\n" +
7167 		"1 problem (1 warning)\n",
7168 		true);
7169 }
7170 // -warn option - regression tests
test199_warn_options()7171 public void test199_warn_options() {
7172 	// same source as 190, skip check defaults
7173 	this.runConformTest(
7174 		new String[] {
7175 			"X.java",
7176 			"import java.util.ArrayList;\n" +
7177 			"public class X extends Y {\n" +
7178 			"  private void foo(int i) throws java.io.IOException {\n" +
7179 			"    int j;\n" +
7180 			"    this.<String>bar();\n" +
7181 			"    next: for (;;) {\n" +
7182 			"      return;\n" +
7183 			"    }\n" +
7184 			"  }\n" +
7185 			"  void bar() {\n" +
7186 			"  }\n" +
7187 			"}\n" +
7188 			"class Y {\n" +
7189 			"  <T> void bar() {\n" +
7190 			"  }\n" +
7191 			"}"
7192 		},
7193 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7194 		+ " -warn:unused -warn:-unusedArgument -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7195 		"",
7196 		"----------\n" +
7197 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7198 		"	import java.util.ArrayList;\n" +
7199 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
7200 		"The import java.util.ArrayList is never used\n" +
7201 		"----------\n" +
7202 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7203 		"	private void foo(int i) throws java.io.IOException {\n" +
7204 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7205 		"The method foo(int) from the type X is never used locally\n" +
7206 		"----------\n" +
7207 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7208 		"	private void foo(int i) throws java.io.IOException {\n" +
7209 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7210 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7211 		"----------\n" +
7212 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7213 		"	int j;\n" +
7214 		"	    ^\n" +
7215 		"The value of the local variable j is not used\n" +
7216 		"----------\n" +
7217 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7218 		"	this.<String>bar();\n" +
7219 		"	      ^^^^^^\n" +
7220 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7221 		"----------\n" +
7222 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7223 		"	next: for (;;) {\n" +
7224 		"	^^^^\n" +
7225 		"The label next is never explicitly referenced\n" +
7226 		"----------\n" +
7227 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7228 		"	<T> void bar() {\n" +
7229 		"	 ^\n" +
7230 		"Unused type parameter T\n" +
7231 		"----------\n" +
7232 		"7 problems (7 warnings)\n",
7233 		true);
7234 }
7235 // -warn option - regression tests
test200_warn_options()7236 public void test200_warn_options() {
7237 	// same source as 190, skip check defaults
7238 	this.runConformTest(
7239 		new String[] {
7240 			"X.java",
7241 			"import java.util.ArrayList;\n" +
7242 			"public class X extends Y {\n" +
7243 			"  private void foo(int i) throws java.io.IOException {\n" +
7244 			"    int j;\n" +
7245 			"    this.<String>bar();\n" +
7246 			"    next: for (;;) {\n" +
7247 			"      return;\n" +
7248 			"    }\n" +
7249 			"  }\n" +
7250 			"  void bar() {\n" +
7251 			"  }\n" +
7252 			"}\n" +
7253 			"class Y {\n" +
7254 			"  <T> void bar() {\n" +
7255 			"  }\n" +
7256 			"}"
7257 		},
7258 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7259 		+ " -warn:unused -warn:-unusedImport -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7260 		"",
7261 		"----------\n" +
7262 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7263 		"	private void foo(int i) throws java.io.IOException {\n" +
7264 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7265 		"The method foo(int) from the type X is never used locally\n" +
7266 		"----------\n" +
7267 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7268 		"	private void foo(int i) throws java.io.IOException {\n" +
7269 		"	                     ^\n" +
7270 		"The value of the parameter i is not used\n" +
7271 		"----------\n" +
7272 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7273 		"	private void foo(int i) throws java.io.IOException {\n" +
7274 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7275 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7276 		"----------\n" +
7277 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7278 		"	int j;\n" +
7279 		"	    ^\n" +
7280 		"The value of the local variable j is not used\n" +
7281 		"----------\n" +
7282 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7283 		"	this.<String>bar();\n" +
7284 		"	      ^^^^^^\n" +
7285 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7286 		"----------\n" +
7287 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7288 		"	next: for (;;) {\n" +
7289 		"	^^^^\n" +
7290 		"The label next is never explicitly referenced\n" +
7291 		"----------\n" +
7292 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7293 		"	<T> void bar() {\n" +
7294 		"	 ^\n" +
7295 		"Unused type parameter T\n" +
7296 		"----------\n" +
7297 		"7 problems (7 warnings)\n",
7298 		true);
7299 }
7300 // -warn option - regression tests
test201_warn_options()7301 public void test201_warn_options() {
7302 	// same source as 190, skip check defaults
7303 	this.runConformTest(
7304 		new String[] {
7305 			"X.java",
7306 			"import java.util.ArrayList;\n" +
7307 			"public class X extends Y {\n" +
7308 			"  private void foo(int i) throws java.io.IOException {\n" +
7309 			"    int j;\n" +
7310 			"    this.<String>bar();\n" +
7311 			"    next: for (;;) {\n" +
7312 			"      return;\n" +
7313 			"    }\n" +
7314 			"  }\n" +
7315 			"  void bar() {\n" +
7316 			"  }\n" +
7317 			"}\n" +
7318 			"class Y {\n" +
7319 			"  <T> void bar() {\n" +
7320 			"  }\n" +
7321 			"}"
7322 		},
7323 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7324 		+ " -warn:unused -warn:-unusedLabel -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7325 		"",
7326 		"----------\n" +
7327 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7328 		"	import java.util.ArrayList;\n" +
7329 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
7330 		"The import java.util.ArrayList is never used\n" +
7331 		"----------\n" +
7332 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7333 		"	private void foo(int i) throws java.io.IOException {\n" +
7334 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7335 		"The method foo(int) from the type X is never used locally\n" +
7336 		"----------\n" +
7337 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7338 		"	private void foo(int i) throws java.io.IOException {\n" +
7339 		"	                     ^\n" +
7340 		"The value of the parameter i is not used\n" +
7341 		"----------\n" +
7342 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7343 		"	private void foo(int i) throws java.io.IOException {\n" +
7344 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7345 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7346 		"----------\n" +
7347 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7348 		"	int j;\n" +
7349 		"	    ^\n" +
7350 		"The value of the local variable j is not used\n" +
7351 		"----------\n" +
7352 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7353 		"	this.<String>bar();\n" +
7354 		"	      ^^^^^^\n" +
7355 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7356 		"----------\n" +
7357 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7358 		"	<T> void bar() {\n" +
7359 		"	 ^\n" +
7360 		"Unused type parameter T\n" +
7361 		"----------\n" +
7362 		"7 problems (7 warnings)\n",
7363 		true);
7364 }
7365 // -warn option - regression tests
test202_warn_options()7366 public void test202_warn_options() {
7367 	// same source as 190, skip check defaults
7368 	this.runConformTest(
7369 		new String[] {
7370 			"X.java",
7371 			"import java.util.ArrayList;\n" +
7372 			"public class X extends Y {\n" +
7373 			"  private void foo(int i) throws java.io.IOException {\n" +
7374 			"    int j;\n" +
7375 			"    this.<String>bar();\n" +
7376 			"    next: for (;;) {\n" +
7377 			"      return;\n" +
7378 			"    }\n" +
7379 			"  }\n" +
7380 			"  void bar() {\n" +
7381 			"  }\n" +
7382 			"}\n" +
7383 			"class Y {\n" +
7384 			"  <T> void bar() {\n" +
7385 			"  }\n" +
7386 			"}"
7387 		},
7388 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7389 		+ " -warn:unused -warn:-unusedLocal -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7390 		"",
7391 		"----------\n" +
7392 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7393 		"	import java.util.ArrayList;\n" +
7394 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
7395 		"The import java.util.ArrayList is never used\n" +
7396 		"----------\n" +
7397 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7398 		"	private void foo(int i) throws java.io.IOException {\n" +
7399 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7400 		"The method foo(int) from the type X is never used locally\n" +
7401 		"----------\n" +
7402 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7403 		"	private void foo(int i) throws java.io.IOException {\n" +
7404 		"	                     ^\n" +
7405 		"The value of the parameter i is not used\n" +
7406 		"----------\n" +
7407 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7408 		"	private void foo(int i) throws java.io.IOException {\n" +
7409 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7410 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7411 		"----------\n" +
7412 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7413 		"	this.<String>bar();\n" +
7414 		"	      ^^^^^^\n" +
7415 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7416 		"----------\n" +
7417 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7418 		"	next: for (;;) {\n" +
7419 		"	^^^^\n" +
7420 		"The label next is never explicitly referenced\n" +
7421 		"----------\n" +
7422 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7423 		"	<T> void bar() {\n" +
7424 		"	 ^\n" +
7425 		"Unused type parameter T\n" +
7426 		"----------\n" +
7427 		"7 problems (7 warnings)\n",
7428 		true);
7429 }
7430 // -warn option - regression tests
test203_warn_options()7431 public void test203_warn_options() {
7432 	// same source as 190, skip check defaults
7433 	this.runConformTest(
7434 		new String[] {
7435 			"X.java",
7436 			"import java.util.ArrayList;\n" +
7437 			"public class X extends Y {\n" +
7438 			"  private void foo(int i) throws java.io.IOException {\n" +
7439 			"    int j;\n" +
7440 			"    this.<String>bar();\n" +
7441 			"    next: for (;;) {\n" +
7442 			"      return;\n" +
7443 			"    }\n" +
7444 			"  }\n" +
7445 			"  void bar() {\n" +
7446 			"  }\n" +
7447 			"}\n" +
7448 			"class Y {\n" +
7449 			"  <T> void bar() {\n" +
7450 			"  }\n" +
7451 			"}"
7452 		},
7453 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7454 		+ " -warn:unused -warn:-unusedPrivate -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7455 		"",
7456 		"----------\n" +
7457 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7458 		"	import java.util.ArrayList;\n" +
7459 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
7460 		"The import java.util.ArrayList is never used\n" +
7461 		"----------\n" +
7462 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7463 		"	private void foo(int i) throws java.io.IOException {\n" +
7464 		"	                     ^\n" +
7465 		"The value of the parameter i is not used\n" +
7466 		"----------\n" +
7467 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7468 		"	private void foo(int i) throws java.io.IOException {\n" +
7469 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7470 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7471 		"----------\n" +
7472 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7473 		"	int j;\n" +
7474 		"	    ^\n" +
7475 		"The value of the local variable j is not used\n" +
7476 		"----------\n" +
7477 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7478 		"	this.<String>bar();\n" +
7479 		"	      ^^^^^^\n" +
7480 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7481 		"----------\n" +
7482 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7483 		"	next: for (;;) {\n" +
7484 		"	^^^^\n" +
7485 		"The label next is never explicitly referenced\n" +
7486 		"----------\n" +
7487 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7488 		"	<T> void bar() {\n" +
7489 		"	 ^\n" +
7490 		"Unused type parameter T\n" +
7491 		"----------\n" +
7492 		"7 problems (7 warnings)\n",
7493 		true);
7494 }
7495 // -warn option - regression tests
test204_warn_options()7496 public void test204_warn_options() {
7497 	// same source as 190, skip check defaults
7498 	this.runConformTest(
7499 		new String[] {
7500 			"X.java",
7501 			"import java.util.ArrayList;\n" +
7502 			"public class X extends Y {\n" +
7503 			"  private void foo(int i) throws java.io.IOException {\n" +
7504 			"    int j;\n" +
7505 			"    this.<String>bar();\n" +
7506 			"    next: for (;;) {\n" +
7507 			"      return;\n" +
7508 			"    }\n" +
7509 			"  }\n" +
7510 			"  void bar() {\n" +
7511 			"  }\n" +
7512 			"}\n" +
7513 			"class Y {\n" +
7514 			"  <T> void bar() {\n" +
7515 			"  }\n" +
7516 			"}"
7517 		},
7518 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7519 		+ " -warn:unused -warn:-unusedThrown -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7520 		"",
7521 		"----------\n" +
7522 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7523 		"	import java.util.ArrayList;\n" +
7524 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
7525 		"The import java.util.ArrayList is never used\n" +
7526 		"----------\n" +
7527 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7528 		"	private void foo(int i) throws java.io.IOException {\n" +
7529 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7530 		"The method foo(int) from the type X is never used locally\n" +
7531 		"----------\n" +
7532 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7533 		"	private void foo(int i) throws java.io.IOException {\n" +
7534 		"	                     ^\n" +
7535 		"The value of the parameter i is not used\n" +
7536 		"----------\n" +
7537 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7538 		"	int j;\n" +
7539 		"	    ^\n" +
7540 		"The value of the local variable j is not used\n" +
7541 		"----------\n" +
7542 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7543 		"	this.<String>bar();\n" +
7544 		"	      ^^^^^^\n" +
7545 		"Unused type arguments for the non generic method bar() of type X; it should not be parameterized with arguments <String>\n" +
7546 		"----------\n" +
7547 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7548 		"	next: for (;;) {\n" +
7549 		"	^^^^\n" +
7550 		"The label next is never explicitly referenced\n" +
7551 		"----------\n" +
7552 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7553 		"	<T> void bar() {\n" +
7554 		"	 ^\n" +
7555 		"Unused type parameter T\n" +
7556 		"----------\n" +
7557 		"7 problems (7 warnings)\n",
7558 		true);
7559 }
7560 // -warn option - regression tests
test205_warn_options()7561 public void test205_warn_options() {
7562 	// same source as 190, skip check defaults
7563 	this.runConformTest(
7564 		new String[] {
7565 			"X.java",
7566 			"import java.util.ArrayList;\n" +
7567 			"public class X extends Y {\n" +
7568 			"  private void foo(int i) throws java.io.IOException {\n" +
7569 			"    int j;\n" +
7570 			"    this.<String>bar();\n" +
7571 			"    next: for (;;) {\n" +
7572 			"      return;\n" +
7573 			"    }\n" +
7574 			"  }\n" +
7575 			"  void bar() {\n" +
7576 			"  }\n" +
7577 			"}\n" +
7578 			"class Y {\n" +
7579 			"  <T> void bar() {\n" +
7580 			"  }\n" +
7581 			"}"
7582 		},
7583 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7584 		+ " -warn:unused -warn:-unusedTypeArgs -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
7585 		"",
7586 		"----------\n" +
7587 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7588 		"	import java.util.ArrayList;\n" +
7589 		"	       ^^^^^^^^^^^^^^^^^^^\n" +
7590 		"The import java.util.ArrayList is never used\n" +
7591 		"----------\n" +
7592 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7593 		"	private void foo(int i) throws java.io.IOException {\n" +
7594 		"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
7595 		"The method foo(int) from the type X is never used locally\n" +
7596 		"----------\n" +
7597 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7598 		"	private void foo(int i) throws java.io.IOException {\n" +
7599 		"	                     ^\n" +
7600 		"The value of the parameter i is not used\n" +
7601 		"----------\n" +
7602 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7603 		"	private void foo(int i) throws java.io.IOException {\n" +
7604 		"	                               ^^^^^^^^^^^^^^^^^^^\n" +
7605 		"The declared exception IOException is not actually thrown by the method foo(int) from type X\n" +
7606 		"----------\n" +
7607 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
7608 		"	int j;\n" +
7609 		"	    ^\n" +
7610 		"The value of the local variable j is not used\n" +
7611 		"----------\n" +
7612 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
7613 		"	next: for (;;) {\n" +
7614 		"	^^^^\n" +
7615 		"The label next is never explicitly referenced\n" +
7616 		"----------\n" +
7617 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 14)\n" +
7618 		"	<T> void bar() {\n" +
7619 		"	 ^\n" +
7620 		"Unused type parameter T\n" +
7621 		"----------\n" +
7622 		"7 problems (7 warnings)\n",
7623 		true);
7624 }
7625 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7626 // -warn option - regression tests
test206_warn_options()7627 public void test206_warn_options() {
7628 	// same source as 168, skip check defaults
7629 	this.runConformTest(
7630 		new String[] {
7631 			"X.java",
7632 			"public class X {\n" +
7633 			"  /**\n" +
7634 			"    @param\n" +
7635 			"  */\n" +
7636 			"  public void foo() {\n" +
7637 			"  }\n" +
7638 			"}",
7639 		},
7640 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7641 		+ " -warn:allJavadoc -enableJavadoc -warn:-allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7642 		"",
7643 		"",
7644 		true);
7645 }
7646 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7647 // -warn option - regression tests
test207_warn_options()7648 public void test207_warn_options() {
7649 	// same source as 168, skip check defaults
7650 	this.runConformTest(
7651 		new String[] {
7652 			"X.java",
7653 			"public class X {\n" +
7654 			"  /**\n" +
7655 			"    @param\n" +
7656 			"  */\n" +
7657 			"  public void foo() {\n" +
7658 			"  }\n" +
7659 			"}",
7660 		},
7661 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7662 		+ " -warn:javadoc -enableJavadoc -warn:-javadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7663 		"",
7664 		"",
7665 		true);
7666 }
7667 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7668 // variant
test208_warn_options()7669 public void test208_warn_options() {
7670 	this.runConformTest(
7671 		new String[] {
7672 			"X.java",
7673 			"public class X {\n" +
7674 			"  /**\n" +
7675 			"    @param i explained\n" +
7676 			"  */\n" +
7677 			"  public void foo(int i) {\n" +
7678 			"  }\n" +
7679 			"}",
7680 		},
7681 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7682 		+ " -warn:unused -proc:none -d \"" + OUTPUT_DIR + "\"",
7683 		"",
7684 		"----------\n" +
7685 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7686 		"	public void foo(int i) {\n" +
7687 		"	                    ^\n" +
7688 		"The value of the parameter i is not used\n" +
7689 		"----------\n" +
7690 		"1 problem (1 warning)\n",
7691 		true);
7692 }
7693 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7694 // variant
test209_warn_options()7695 public void test209_warn_options() {
7696 	this.runConformTest(
7697 		new String[] {
7698 			"X.java",
7699 			"public class X {\n" +
7700 			"  /**\n" +
7701 			"    @param i explained\n" +
7702 			"  */\n" +
7703 			"  public void foo(int i) {\n" +
7704 			"  }\n" +
7705 			"}",
7706 		},
7707 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7708 		+ " -warn:unused -enableJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7709 		"",
7710 		"",
7711 		true);
7712 }
7713 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7714 // variant
test210_warn_options()7715 public void test210_warn_options() {
7716 	this.runConformTest(
7717 		new String[] {
7718 			"X.java",
7719 			"public class X {\n" +
7720 			"  /**\n" +
7721 			"    @param i explained\n" +
7722 			"  */\n" +
7723 			"  public void foo(int i) {\n" +
7724 			"  }\n" +
7725 			"}",
7726 		},
7727 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7728 		+ " -warn:unused -warn:-allJavadoc -enableJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7729 		"",
7730 		"",
7731 		true);
7732 }
7733 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7734 // variant
test211_warn_options()7735 public void test211_warn_options() {
7736 	this.runConformTest(
7737 		new String[] {
7738 			"X.java",
7739 			"public class X {\n" +
7740 			"  /**\n" +
7741 			"    @param i explained\n" +
7742 			"  */\n" +
7743 			"  public void foo(int i) {\n" +
7744 			"  }\n" +
7745 			"}",
7746 		},
7747 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7748 		+ " -warn:unused -enableJavadoc -warn:-allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7749 		"",
7750 		"",
7751 		true);
7752 }
7753 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7754 // variant - javadoc and allJavadoc mistakenly imply enableJavadoc
test212_warn_options()7755 public void test212_warn_options() {
7756 	this.runConformTest(
7757 		new String[] {
7758 			"X.java",
7759 			"public class X {\n" +
7760 			"  /**\n" +
7761 			"    @param i explained\n" +
7762 			"  */\n" +
7763 			"  public void foo(int i) {\n" +
7764 			"  }\n" +
7765 			"}",
7766 		},
7767 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7768 		+ " -warn:unused,allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7769 		"",
7770 		"----------\n" +
7771 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
7772 		"	public class X {\n" +
7773 		"	             ^\n" +
7774 		"Javadoc: Missing comment for public declaration\n" +
7775 		"----------\n" +
7776 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7777 		"	public void foo(int i) {\n" +
7778 		"	                    ^\n" +
7779 		"The value of the parameter i is not used\n" +
7780 		"----------\n" +
7781 		"2 problems (2 warnings)\n",
7782 		true);
7783 }
7784 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7785 // variant - javadoc and allJavadoc mistakenly imply enableJavadoc
test213_warn_options()7786 public void test213_warn_options() {
7787 	this.runConformTest(
7788 		new String[] {
7789 			"X.java",
7790 			"public class X {\n" +
7791 			"  /**\n" +
7792 			"    @param i explained\n" +
7793 			"  */\n" +
7794 			"  public void foo(int i) {\n" +
7795 			"  }\n" +
7796 			"}",
7797 		},
7798 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7799 		+ " -warn:unused,javadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
7800 		"",
7801 		"----------\n" +
7802 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
7803 		"	public void foo(int i) {\n" +
7804 		"	                    ^\n" +
7805 		"The value of the parameter i is not used\n" +
7806 		"----------\n" +
7807 		"1 problem (1 warning)\n",
7808 		true);
7809 }
7810 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7811 // variant - check impact of javadoc upon other warnings
_test216a_warn_options()7812 public void _test216a_warn_options() {
7813 	// check what if allJavadoc on
7814 	this.runConformTest(
7815 		new String[] {
7816 			"X.java",
7817 			"/** */" +
7818 			"public class X {\n" +
7819 			"  /**\n" +
7820 			"    {@link Y}\n" +
7821 			"  */\n" +
7822 			"  public void foo() {\n" +
7823 			"  }\n" +
7824 			"}\n",
7825 			"Y.java",
7826 			"/** @deprecated */" +
7827 			"public class Y {\n" +
7828 			"}",
7829 		},
7830 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7831 		+ " -warn:allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7832 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7833 		"",
7834 		"",
7835 		true);
7836 	// same sources, what if we add -warn:+javadoc
7837 	this.runConformTest(
7838 		new String[] { },
7839 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7840 		+ " -warn:allJavadoc -warn:+javadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7841 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7842 		"",
7843 		"",
7844 		false);
7845 	// same sources, what if we only have -warn:javadoc
7846 	this.runConformTest(
7847 		new String[] { },
7848 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7849 		+ " -warn:javadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7850 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7851 		"",
7852 		"",
7853 		false);
7854 }
7855 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7856 // variant - check impact of javadoc upon other warnings
test216b_warn_options()7857 public void test216b_warn_options() {
7858 	// check what if allJavadoc on
7859 	this.runConformTest(
7860 		new String[] {
7861 			"X.java",
7862 			"/** */" +
7863 			"public class X {\n" +
7864 			"  /**\n" +
7865 			"    {@link Y}\n" +
7866 			"  */\n" +
7867 			"  public void foo() {\n" +
7868 			"  }\n" +
7869 			"}\n",
7870 			"Y.java",
7871 			"/** @deprecated */" +
7872 			"public class Y {\n" +
7873 			"}",
7874 		},
7875 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7876 		+ " -warn:+allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7877 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7878 		"",
7879 		"----------\n" +
7880 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7881 		"	{@link Y}\n" +
7882 		"	       ^\n" +
7883 		"Javadoc: The type Y is deprecated\n" +
7884 		"----------\n" +
7885 		"1 problem (1 warning)\n",
7886 		true);
7887 	// same sources, what if we add -warn:+javadoc
7888 	this.runConformTest(
7889 		new String[] { },
7890 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7891 		+ " -warn:+allJavadoc -warn:+javadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7892 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7893 		"",
7894 		"----------\n" +
7895 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7896 		"	{@link Y}\n" +
7897 		"	       ^\n" +
7898 		"Javadoc: The type Y is deprecated\n" +
7899 		"----------\n" +
7900 		"1 problem (1 warning)\n",
7901 		false);
7902 	// same sources, what if we only have -warn:javadoc
7903 	this.runConformTest(
7904 		new String[] { },
7905 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7906 		+ " -warn:+javadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7907 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7908 		"",
7909 		"----------\n" +
7910 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7911 		"	{@link Y}\n" +
7912 		"	       ^\n" +
7913 		"Javadoc: The type Y is deprecated\n" +
7914 		"----------\n" +
7915 		"1 problem (1 warning)\n",
7916 		false);
7917 }
7918 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
7919 // variant - check impact of javadoc upon other warnings
test217_warn_options()7920 public void test217_warn_options() {
7921 	// check what if allJavadoc on
7922 	this.runConformTest(
7923 		new String[] {
7924 			"X.java",
7925 			"/** */" +
7926 			"public class X {\n" +
7927 			"  /**\n" +
7928 			"    @see #bar()\n" +
7929 			"  */\n" +
7930 			"  public void foo() {\n" +
7931 			"    bar();\n" +
7932 			"  }\n" +
7933 			"  private void bar() {\n" +
7934 			"  }\n" +
7935 			"}\n"
7936 		},
7937 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7938 		+ " -warn:allJavadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7939 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7940 		"",
7941 		"----------\n" +
7942 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7943 		"	@see #bar()\n" +
7944 		"	     ^^^^^^\n" +
7945 		"Javadoc: \'public\' visibility for malformed doc comments hides this \'private\' reference\n" +
7946 		"----------\n" +
7947 		"1 problem (1 warning)\n",
7948 		true);
7949 	// same sources, what if we add -warn:+javadoc
7950 	this.runConformTest(
7951 		new String[] { },
7952 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7953 		+ " -warn:allJavadoc -warn:+javadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7954 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7955 		"",
7956 		"----------\n" +
7957 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7958 		"	@see #bar()\n" +
7959 		"	     ^^^^^^\n" +
7960 		"Javadoc: \'public\' visibility for malformed doc comments hides this \'private\' reference\n" +
7961 		"----------\n" +
7962 		"1 problem (1 warning)\n",
7963 		false);
7964 	// same sources, what if we only have -warn:javadoc
7965 	this.runConformTest(
7966 		new String[] { },
7967 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
7968 		+ " -warn:javadoc -proc:none -d \"" + OUTPUT_DIR + "\""
7969 		+ " -sourcepath \"" + OUTPUT_DIR + "\"",
7970 		"",
7971 		"----------\n" +
7972 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
7973 		"	@see #bar()\n" +
7974 		"	     ^^^^^^\n" +
7975 		"Javadoc: \'public\' visibility for malformed doc comments hides this \'private\' reference\n" +
7976 		"----------\n" +
7977 		"1 problem (1 warning)\n",
7978 		false);
7979 }
7980 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=214731
7981 // white-box test for internal API
test218_batch_classpath_apis()7982 public void test218_batch_classpath_apis() {
7983 	assertFalse("path should be absolute",
7984 		new ClasspathJar(new File("relative.jar"), true, null, null).
7985 		getPath().indexOf(File.separator) == -1);
7986 }
7987 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=214731
7988 // white-box test for internal API
test219_batch_classpath_apis()7989 public void test219_batch_classpath_apis() {
7990 	assertFalse("path should be absolute",
7991 		CharOperation.indexOf('/',
7992 			new ClasspathJar(new File("relative.jar"), true, null, null).
7993 			normalizedPath()) == -1);
7994 }
7995 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
7996 // -warn option - regression tests
7997 // variant
_test220_warn_options()7998 public void _test220_warn_options() {
7999 	// same source as 172, skip check defaults
8000 	this.runConformTest(
8001 		new String[] {
8002 			"X.java",
8003 			"public class X {\n" +
8004 			"  Y f;\n" +
8005 			"  /** @deprecated */\n" +
8006 			"  void foo(Y p) {\n" +
8007 			"  }\n" +
8008 			"}",
8009 			"Y.java",
8010 			"/** @deprecated */\n" +
8011 			"public class Y {\n" +
8012 			"}",
8013 		},
8014 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8015 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
8016 		+ " -warn:allDeprecation -warn:+deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
8017 		"",
8018 		"----------\n" +
8019 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
8020 		"	Y f;\n" +
8021 		"	^\n" +
8022 		"The type Y is deprecated\n" +
8023 		"----------\n" +
8024 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
8025 		"	void foo(Y p) {\n" +
8026 		"	         ^\n" +
8027 		"The type Y is deprecated\n" +
8028 		"----------\n" +
8029 		"2 problems (2 warnings)",
8030 		true);
8031 }
8032 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
8033 // -warn option - regression tests
8034 // variant
test221_warn_options()8035 public void test221_warn_options() {
8036 	// same source as 172, skip check defaults
8037 	this.runConformTest(
8038 		new String[] {
8039 			"X.java",
8040 			"public class X {\n" +
8041 			"  Y f;\n" +
8042 			"  /** @deprecated */\n" +
8043 			"  void foo(Y p) {\n" +
8044 			"  }\n" +
8045 			"}",
8046 			"Y.java",
8047 			"/** @deprecated */\n" +
8048 			"public class Y {\n" +
8049 			"}",
8050 		},
8051 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8052 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
8053 		+ " -warn:allDeprecation -warn:deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
8054 		"",
8055 		"----------\n" +
8056 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
8057 		"	Y f;\n" +
8058 		"	^\n" +
8059 		"The type Y is deprecated\n" +
8060 		"----------\n" +
8061 		"1 problem (1 warning)\n",
8062 		true);
8063 }
8064 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
8065 // -warn option - regression tests
8066 // variant
test222_warn_options()8067 public void test222_warn_options() {
8068 	// same source as 172, skip check defaults
8069 	this.runConformTest(
8070 		new String[] {
8071 			"X.java",
8072 			"public class X {\n" +
8073 			"  Y f;\n" +
8074 			"  /** @deprecated */\n" +
8075 			"  void foo(Y p) {\n" +
8076 			"  }\n" +
8077 			"}",
8078 			"Y.java",
8079 			"/** @deprecated */\n" +
8080 			"public class Y {\n" +
8081 			"}",
8082 		},
8083 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8084 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
8085 		+ " -warn:allDeprecation -deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
8086 		// according to the documentation, equivalent to -warn:allDeprecation -warn:+deprecation
8087 		"",
8088 		"----------\n" +
8089 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
8090 		"	Y f;\n" +
8091 		"	^\n" +
8092 		"The type Y is deprecated\n" +
8093 		"----------\n" +
8094 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
8095 		"	void foo(Y p) {\n" +
8096 		"	         ^\n" +
8097 		"The type Y is deprecated\n" +
8098 		"----------\n" +
8099 		"2 problems (2 warnings)\n",
8100 		true);
8101 }
8102 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
8103 // -warn option - regression tests
8104 // variant
test223_warn_options()8105 public void test223_warn_options() {
8106 	// same source as 172, skip check defaults
8107 	this.runConformTest(
8108 		new String[] {
8109 			"X.java",
8110 			"public class X {\n" +
8111 			"  Y f;\n" +
8112 			"  /** @deprecated */\n" +
8113 			"  void foo(Y p) {\n" +
8114 			"  }\n" +
8115 			"}",
8116 			"Y.java",
8117 			"/** @deprecated */\n" +
8118 			"public class Y {\n" +
8119 			"}",
8120 		},
8121 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8122 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
8123 		+ " -deprecation -warn:-allDeprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
8124 		"",
8125 		"",
8126 		true);
8127 }
8128 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
8129 // -warn option - regression tests
8130 // variant
_test224_warn_options()8131 public void _test224_warn_options() {
8132 	this.runConformTest(
8133 		new String[] {
8134 			"X.java",
8135 			"public class X {\n" +
8136 			"  int i;\n" +
8137 			"  X(int i) {\n" +
8138 			"  }\n" +
8139 			"}"
8140 		},
8141 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8142 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
8143 		+ " -warn:+localHiding,specialParamHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
8144 		"",
8145 		"----------\n" +
8146 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
8147 		"	X(int i) {\n" +
8148 		"	      ^\n" +
8149 		"The parameter i is hiding a field from type X\n" +
8150 		"----------\n" +
8151 		"1 problem (1 warning)",
8152 		true);
8153 	// deprecation should erase whatever warnings have been set previously
8154 	this.runConformTest(
8155 		new String[] {},
8156 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8157 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
8158 		+ " -warn:+localHiding,specialParamHiding -warn:deprecation -warn:+localHiding -proc:none -d \"" + OUTPUT_DIR + "\"",
8159 		"",
8160 		"",
8161 		false);
8162 }
8163 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
8164 // -warn option - regression tests
8165 // variant
test225_warn_options()8166 public void test225_warn_options() {
8167 	this.runConformTest(
8168 		new String[] {
8169 			"X.java",
8170 			"@SuppressWarnings(\"deprecation\")\n" +
8171 			"public class X {\n" +
8172 			"  Y f;\n" +
8173 			"  /** @deprecated */\n" +
8174 			"  void foo(Y p) {\n" +
8175 			"  }\n" +
8176 			"}",
8177 			"Y.java",
8178 			"/** @deprecated */\n" +
8179 			"public class Y {\n" +
8180 			"}",
8181 		},
8182 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8183 		+ " -1.5 -sourcepath \"" + OUTPUT_DIR + "\""
8184 		+ " -deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
8185 		"",
8186 		"",
8187 		true);
8188 }
8189 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
8190 // -warn option - regression tests
8191 // variant
_test226_warn_options()8192 public void _test226_warn_options() {
8193 	this.runConformTest(
8194 		new String[] {
8195 			"X.java",
8196 			"@SuppressWarnings(\"deprecation\")\n" +
8197 			"public class X {\n" +
8198 			"  Y f;\n" +
8199 			"  /** @deprecated */\n" +
8200 			"  void foo(Y p) {\n" +
8201 			"  }\n" +
8202 			"}",
8203 			"Y.java",
8204 			"/** @deprecated */\n" +
8205 			"public class Y {\n" +
8206 			"}",
8207 		},
8208 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8209 		+ " -1.5 -sourcepath \"" + OUTPUT_DIR + "\""
8210 		// default -warn:+suppress gets overriden
8211 		+ " -warn:deprecation -proc:none -d \"" + OUTPUT_DIR + "\"",
8212 		"",
8213 		"----------\n" +
8214 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
8215 		"	Y f;\n" +
8216 		"	^\n" +
8217 		"The type Y is deprecated\n" +
8218 		"----------\n" +
8219 		"1 problem (1 warning)",
8220 		true);
8221 }
8222 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
8223 // -warn option - regression tests
8224 // variant detected while exploring:
8225 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=210524
test227_warn_options()8226 public void test227_warn_options() {
8227 	this.runConformTest(
8228 		new String[] {
8229 			"X.java",
8230 			"public class X {\n" +
8231 			"  /**\n" +
8232 			"    @param i explained\n" +
8233 			"  */\n" +
8234 			"  public void foo(int i) {\n" +
8235 			"  }\n" +
8236 			"}",
8237 		},
8238 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8239 		+ " -warn:unused -proc:none -d \"" + OUTPUT_DIR + "\"",
8240 		"",
8241 		"----------\n" +
8242 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
8243 		"	public void foo(int i) {\n" +
8244 		"	                    ^\n" +
8245 		"The value of the parameter i is not used\n" +
8246 		"----------\n" +
8247 		"1 problem (1 warning)\n",
8248 		true);
8249 }
8250 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
8251 // -warn option - regression tests
8252 // variant
test228_warn_options()8253 public void test228_warn_options() {
8254 	this.runConformTest(
8255 		new String[] {
8256 			"X.java",
8257 			"import java.io.IOException;\n" +
8258 			"public class X {\n" +
8259 			"/** @throws IOException mute warning **/\n" +
8260 			"  public void foo() throws IOException {\n" +
8261 			"  }\n" +
8262 			"}\n",
8263 		},
8264 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8265 		+ " -warn:unusedThrown -enableJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
8266 		"",
8267 		"",
8268 		true);
8269 }
8270 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588
8271 // -warn option - regression tests
8272 // variant
test229_warn_options()8273 public void test229_warn_options() {
8274 	this.runConformTest(
8275 		new String[] {
8276 			"X.java",
8277 			"import java.io.IOException;\n" +
8278 			"public class X {\n" +
8279 			"/** @throws IOException mute warning **/\n" +
8280 			"  public void foo() throws IOException {\n" +
8281 			"  }\n" +
8282 			"}\n",
8283 		},
8284 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8285 		+ " -warn:unusedThrown -proc:none -d \"" + OUTPUT_DIR + "\"",
8286 		"",
8287 		"----------\n" +
8288 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
8289 		"	public void foo() throws IOException {\n" +
8290 		"	                         ^^^^^^^^^^^\n" +
8291 		"The declared exception IOException is not actually thrown by the method foo() from type X\n" +
8292 		"----------\n" +
8293 		"1 problem (1 warning)\n",
8294 		true);
8295 }
8296 //-warn option - regression tests
test230_warn_options()8297 public void test230_warn_options() {
8298 	// same source as 190, skip check defaults
8299 	this.runConformTest(
8300 		new String[] {
8301 			"X.java",
8302 			"import java.util.ArrayList;\n" +
8303 			"public class X<T>{\n" +
8304 			"  public X() {\n" +
8305 			"  }\n" +
8306 			"  public X(T t){}\n" +
8307 			"  void foo() {\n" +
8308 			"      X<String> x = new X<String>();\n" +
8309 			"	   X<Number> x1 = new X<Number>(1);\n" +
8310 			"  }\n" +
8311 			"}\n"
8312 		},
8313 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
8314 		+ " -warn:unusedTypeArgs -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
8315 		"",
8316 		"----------\n" +
8317 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
8318 		"	X<String> x = new X<String>();\n" +
8319 		"	                  ^\n" +
8320 		"Redundant specification of type arguments <String>\n" +
8321 		"----------\n" +
8322 		"1 problem (1 warning)\n",
8323 		true);
8324 }
8325 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8326 // .java/.class files precedence depending on sourcepath and other conditions
8327 // ecj always selects source files from the sourcepath over class files
8328 // javac selects the class file over the source file when the class file is
8329 // newer than the source file, unless option -Xprefer:source is used (available
8330 // since 1.6)
test230_sourcepath_vs_classpath()8331 public void test230_sourcepath_vs_classpath() throws IOException, InterruptedException {
8332 	runTest(
8333 		true /* shouldCompileOK*/,
8334 		new String[] { /* testFiles */
8335 			"src1/X.java",
8336 			"public class X {\n" +
8337 			"  public static final int CONST = 1;\n" +
8338 			"}\n",
8339 			"src2/X.java",
8340 			"public class X {\n" +
8341 			"  public static final int CONST = 2;\n" +
8342 			"}\n",
8343 		},
8344 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
8345 		+ " -verbose -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8346 		"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #1/1]\n" + /* expectedOutOutputString */
8347 		"[reading    java/lang/Object.class]\n" +
8348 		"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #1/1]\n" +
8349 		"[writing    X.class - #1]\n" +
8350 		"[completed  ---OUTPUT_DIR_PLACEHOLDER---/src1/X.java - #1/1]\n" +
8351 		"[1 unit compiled]\n" +
8352 		"[1 .class file generated]\n",
8353 		"" /* expectedErrOutputString */,
8354 		true /* shouldFlushOutputDirectory */,
8355 		null /* progress */);
8356 	// ensure that class file is newer than source file (some file systems
8357 	// store the modification time at a second precision)
8358 	File sourceFile = new File(OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java"),
8359 	  classFile = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class");
8360 	while (classFile.lastModified() <= sourceFile.lastModified()) {
8361 		runConformTest(
8362 			null,
8363 			"\"" + OUTPUT_DIR +  File.separator + "src1" + File.separator + "X.java\""
8364 			+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8365 			"",
8366 			"",
8367 			false);
8368 	}
8369 	// compile with classpath only: X.class gets selected
8370 	runConformTest(
8371 		new String[] {
8372 			"Y.java",
8373 			"public class Y {\n" +
8374 			"  public static void main (String[] args) {\n" +
8375 			"    System.out.println(X.CONST);\n" +
8376 			"  }\n" +
8377 			"}\n",
8378 		},
8379 		"\"" + OUTPUT_DIR +  File.separator + "Y.java\""
8380 		+ " -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + "\""
8381 		+ " -verbose -proc:none -d \"" + OUTPUT_DIR + "\"",
8382 		"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" +
8383 		"[reading    java/lang/Object.class]\n" +
8384 		"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" +
8385 		"[reading    java/lang/String.class]\n" +
8386 		"[reading    java/lang/System.class]\n" +
8387 		"[reading    java/io/PrintStream.class]\n" +
8388 		"[reading    X.class]\n" +
8389 		"[writing    Y.class - #1]\n" +
8390 		"[completed  ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" +
8391 		"[1 unit compiled]\n" +
8392 		"[1 .class file generated]\n",
8393 		"",
8394 		false);
8395 	// compile with sourcepath and classpath: src2/X.java is preferred
8396 	// this matches -Xprefer:source option of javac - except that
8397 	// javac then does it for classpath too; by default, javac would select
8398 	// bin1/X.class (as shown below)
8399 	String sourceFilePath = "\"" + OUTPUT_DIR +  File.separator + "Y.java\"";
8400 	String commonOptions =
8401 		" -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + "\""
8402 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src2" + "\""
8403 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin2" + "\"";
8404 	String setting= System.getProperty("jdt.compiler.useSingleThread");
8405 	try {
8406 		System.setProperty("jdt.compiler.useSingleThread", "true");
8407 		runConformTest(
8408 			null,
8409 			sourceFilePath + commonOptions + " -verbose -proc:none",
8410 			"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" +
8411 			"[reading    java/lang/Object.class]\n" +
8412 			"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" +
8413 			"[reading    java/lang/String.class]\n" +
8414 			"[reading    java/lang/System.class]\n" +
8415 			"[reading    java/io/PrintStream.class]\n" +
8416 			"[parsing    ---OUTPUT_DIR_PLACEHOLDER---/src2/X.java - #2/2]\n" +
8417 			"[writing    Y.class - #1]\n" +
8418 			"[completed  ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/2]\n" +
8419 			"[analyzing  ---OUTPUT_DIR_PLACEHOLDER---/src2/X.java - #2/2]\n" +
8420 			"[writing    X.class - #2]\n" +
8421 			"[completed  ---OUTPUT_DIR_PLACEHOLDER---/src2/X.java - #2/2]\n" +
8422 			"[2 units compiled]\n" +
8423 			"[2 .class files generated]\n",
8424 			"",
8425 			false);
8426 	} finally {
8427 		System.setProperty("jdt.compiler.useSingleThread", setting == null ? "false" : setting);
8428 	}
8429 	if (RUN_JAVAC) {
8430 		// run ecj result
8431 		this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin2"});
8432 		assertTrue(this.verifier.getExecutionOutput().startsWith("2")); // skip trailing newline
8433 		// 2 means we selected src2
8434 		// recompile and run result using various levels of javac
8435 		Iterator javacCompilersIterator = javacCompilers.iterator();
8436 		String specialOptions = commonOptions + " -Xprefer:source ";
8437 		String sourceFileNames[] = new String[] {sourceFilePath};
8438 		File outputDir = new File(OUTPUT_DIR);
8439 		while (javacCompilersIterator.hasNext()) {
8440 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8441 			assertTrue(javacCompiler.compile(
8442 					outputDir, /* directory */
8443 					commonOptions /* options */,
8444 					sourceFileNames /* source file names */,
8445 					null /* log */) == 0);
8446 			this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin2"});
8447 			assertEquals('1', this.verifier.getExecutionOutput().charAt(0)); // skip trailing newline
8448 			// 1 means javac selected bin1 by default
8449 			if (javacCompiler.version.compareTo(JavaCore.VERSION_1_6) >= 0) {
8450 				assertTrue(javacCompiler.compile(
8451 						outputDir, /* directory */
8452 						specialOptions /* options */,
8453 						sourceFileNames /* source file names */,
8454 						null /* log */) == 0);
8455 				this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin2"});
8456 				assertEquals('2', this.verifier.getExecutionOutput().charAt(0)); // skip trailing newline
8457 				// 2 means javac selected src2
8458 			}
8459 		}
8460 	}
8461 }
8462 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8463 // .java/.class files precedence depending on sourcepath
8464 // ecj always selects sourcepath over classpath
8465 // javac takes the source file if it is more recent than the class file
test231_sourcepath_vs_classpath()8466 public void test231_sourcepath_vs_classpath() throws IOException, InterruptedException {
8467 	// compile into bin1
8468 	runConformTest(
8469 		new String[] {
8470 			"src1/X.java",
8471 			"public class X {\n" +
8472 			"  public static final int CONST = 1;\n" +
8473 			"}\n",
8474 		},
8475 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\""
8476 		+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8477 		"",
8478 		"",
8479 		true);
8480 	// ensure that source file is newer than class file (some file systems
8481 	// store the modification time at a second precision)
8482 	File sourceFile = new File(OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java"),
8483 	  classFile = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class");
8484 	new File(OUTPUT_DIR + File.separator + "src2").mkdirs();
8485 	do {
8486 		Util.writeToFile(
8487 			"public class X {\n" +
8488 			"}\n",
8489 			sourceFile.getPath());
8490 	} while (classFile.lastModified() >= sourceFile.lastModified());
8491 	// compile with sourcepath and classpath: src2/X.java is preferred
8492 	String sourceFilePath = "\"" + OUTPUT_DIR +  File.separator + "Y.java\"";
8493 	String commonOptions =
8494 		" -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + "\""
8495 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src2" + "\""
8496 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin2" + "\"";
8497 	// sourcepath preferred over classpath
8498 	runTest(
8499 		false /* shouldCompileOK */,
8500 		new String[] { /* testFiles */
8501 			"Y.java",
8502 			"public class Y {\n" +
8503 			"  public static void main (String[] args) {\n" +
8504 			"    System.out.println(X.CONST);\n" +
8505 			"  }\n" +
8506 			"}\n",
8507 		},
8508 		sourceFilePath + commonOptions + " -proc:none " /* commandLine */,
8509 		"" /* expectedOutOutputString */,
8510 		"----------\n" +  /* expectedErrOutputString */
8511 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 3)\n" +
8512 		"	System.out.println(X.CONST);\n" +
8513 		"	                     ^^^^^\n" +
8514 		"CONST cannot be resolved or is not a field\n" +
8515 		"----------\n" +
8516 		"1 problem (1 error)\n",
8517 		false /* shouldFlushOutputDirectory */,
8518 		null /* progress */);
8519 	if (RUN_JAVAC) {
8520 		Iterator javacCompilersIterator = javacCompilers.iterator();
8521 		String sourceFileNames[] = new String[] {sourceFilePath};
8522 		File outputDir = new File(OUTPUT_DIR);
8523 		while (javacCompilersIterator.hasNext()) {
8524 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8525 			assertFalse(javacCompiler.compile(
8526 					outputDir /* directory */,
8527 					commonOptions /* options */,
8528 					sourceFileNames /* source file names */,
8529 					null /* log */) == 0);
8530 			// compile fails as well
8531 		}
8532 		assertFalse(runJavac(commonOptions, new String[] {sourceFilePath}, OUTPUT_DIR));
8533 	}
8534 }
8535 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8536 // ecj different from javac: repeated -classpath concatenates entries, while javac
8537 // only keeps the last one (and swallows the others silently)
test232_repeated_classpath()8538 public void test232_repeated_classpath() throws IOException, InterruptedException {
8539 	String commonOptions = " -d \"" + OUTPUT_DIR + File.separator + "bin"
8540 		+ "\" -classpath \"" + OUTPUT_DIR + File.separator + "src1";
8541 	String combinedClasspathOptions = commonOptions + File.pathSeparator
8542 		+ OUTPUT_DIR + File.separator + "src2\" ";
8543 	String splitClasspathOptions = commonOptions
8544 		+ "\" -classpath \"" + OUTPUT_DIR + File.separator + "src2\" ";
8545 	String sourceFilePath = "\"" + OUTPUT_DIR + File.separator + "src3" + File.separator + "Z.java\"";
8546 	// ecj considers repeated classpath entries as if they were concatenated
8547 	// into one
8548 	runTest(
8549 		true /* shouldCompileOK*/,
8550 		new String[] { /* testFiles */
8551 			"src1/X.java",
8552 			"public class X {\n" +
8553 			"}\n",
8554 			"src2/Y.java",
8555 			"public class Y {\n" +
8556 			"}\n",
8557 			"src3/Z.java",
8558 			"public class Z {\n" +
8559 			"  X x;\n" +
8560 			"  Y y;\n" +
8561 			"}\n",
8562 		},
8563 		sourceFilePath + " -proc:none " + combinedClasspathOptions /* commandLine */,
8564 		"" /* expectedOutOutputString */,
8565 		"" /* expectedErrOutputString */,
8566 		true /* shouldFlushOutputDirectory */,
8567 		null /* progress */);
8568 	runTest(
8569 		true /* shouldCompileOK*/,
8570 		null /* testFiles */,
8571 		sourceFilePath + " -proc:none " + splitClasspathOptions /* commandLine */,
8572 		"" /* expectedOutOutputString */,
8573 		"" /* expectedErrOutputString */,
8574 		false /* shouldFlushOutputDirectory */,
8575 		null /* progress */);
8576 	if (RUN_JAVAC) {
8577 		// javac skips all but the last classpath entry (which results into an
8578 		// error in the split case here)
8579 		Iterator javacCompilersIterator = javacCompilers.iterator();
8580 		String sourceFileNames[] = new String[] {sourceFilePath};
8581 		File outputDir = new File(OUTPUT_DIR);
8582 		while (javacCompilersIterator.hasNext()) {
8583 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8584 			assertTrue(javacCompiler.compile(
8585 					outputDir /* directory */,
8586 					combinedClasspathOptions /* options */,
8587 					sourceFileNames,
8588 					null /* log */) == 0);
8589 			assertFalse(javacCompiler.compile(
8590 					outputDir /* directory */,
8591 					splitClasspathOptions /* options */,
8592 					sourceFileNames,
8593 					null /* log */) == 0);
8594 		}
8595 	}
8596 }
8597 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8598 // ecj different from javac: repeated -sourcepath yields an error, while javac
8599 // only keeps the last one (and swallows the others silently)
test233_repeated_sourcepath()8600 public void test233_repeated_sourcepath() throws IOException, InterruptedException {
8601 	String commonOptions = " -d \"" + OUTPUT_DIR + "\""
8602 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src1\""
8603 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src2\"";
8604 	String sourceFilePathZ = "\"" + OUTPUT_DIR + File.separator + "src3" + File.separator + "Z.java\"";
8605 	String sourceFilePathW = "\"" + OUTPUT_DIR + File.separator + "src3" + File.separator + "W.java\"";
8606 	runTest(
8607 		false /* shouldCompileOK */,
8608 		new String[] { /* testFiles */
8609 			"src1/X.java",
8610 			"public class X {\n" +
8611 			"}\n",
8612 			"src2/Y.java",
8613 			"public class Y {\n" +
8614 			"}\n",
8615 			"src3/Z.java",
8616 			"public class Z {\n" +
8617 			"  Y y;\n" +
8618 			"}\n",
8619 			"src3/W.java",
8620 			"public class W {\n" +
8621 			"  X x;\n" +
8622 			"  Y y;\n" +
8623 			"}\n",
8624 		},
8625 		sourceFilePathZ + " -proc:none " + commonOptions /* commandLine */,
8626 		"" /* expectedOutOutputString */,
8627 		"duplicate sourcepath specification: -sourcepath ---OUTPUT_DIR_PLACEHOLDER---/src2\n" /* expectedErrOutputString */,
8628 		true /* shouldFlushOutputDirectory */,
8629 		null /* progress */);
8630 	if (RUN_JAVAC) {
8631 		Iterator javacCompilersIterator = javacCompilers.iterator();
8632 		String sourceFileNamesZ[] = new String[] {sourceFilePathZ};
8633 		String sourceFileNamesW[] = new String[] {sourceFilePathW};
8634 		File outputDir = new File(OUTPUT_DIR);
8635 		while (javacCompilersIterator.hasNext()) {
8636 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8637 			// succeeds because it picks src2 up
8638 			assertTrue(javacCompiler.compile(
8639 					outputDir /* directory */,
8640 					commonOptions /* options */,
8641 					sourceFileNamesZ /* source file names */,
8642 					null /* log */) == 0);
8643 			// fails because it misses src1
8644 			assertFalse(javacCompiler.compile(
8645 					outputDir /* directory */,
8646 					commonOptions /* options */,
8647 					sourceFileNamesW /* source file names */,
8648 					null /* log */) == 0);
8649 		}
8650 	}
8651 }
8652 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8653 // different from javac: javac sourcepath inhibits compile in classpath, while
8654 // ecj goes on finding source files there
test234_sourcepath_vs_classpath()8655 public void test234_sourcepath_vs_classpath() throws IOException, InterruptedException {
8656 	String commonOptions = " -d \"" + OUTPUT_DIR + File.separator + "bin\""
8657 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src1\""
8658 		+ " -classpath \"" + OUTPUT_DIR + File.separator + "src2\" ";
8659 	String sourceFilePath = "\"" + OUTPUT_DIR + File.separator + "src3" + File.separator + "Z.java\"";
8660 	// ecj compiles src1 and src2 source files as needed, regardless of their
8661 	// being on the sourcepath or the classpath
8662 	runTest(
8663 		true /* shouldCompileOK*/,
8664 		new String[] { /* testFiles */
8665 			"src1/X.java",
8666 			"public class X {\n" +
8667 			"}\n",
8668 			"src2/Y.java",
8669 			"public class Y {\n" +
8670 			"}\n",
8671 			"src3/Z.java",
8672 			"public class Z {\n" +
8673 			"  X x;\n" +
8674 			"  Y y;\n" +
8675 			"}\n",
8676 		},
8677 		sourceFilePath + " -proc:none " + commonOptions /* commandLine */,
8678 		"" /* expectedOutOutputString */,
8679 		"" /* expectedErrOutputString */,
8680 		true /* shouldFlushOutputDirectory */,
8681 		null /* progress */);
8682 	if (RUN_JAVAC) {
8683 		// in contrast with test#232 when src1 is on the classpath, javac fails
8684 		// to find src1/X.java; this is because -sourcepath inhibits source files
8685 		// search in classpath directories
8686 		Iterator javacCompilersIterator = javacCompilers.iterator();
8687 		String sourceFileNames[] = new String[] {sourceFilePath};
8688 		File outputDir = new File(OUTPUT_DIR);
8689 		while (javacCompilersIterator.hasNext()) {
8690 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8691 			assertFalse(javacCompiler.compile(
8692 					outputDir, /* directory */
8693 					commonOptions /* options */,
8694 					sourceFileNames /* source file names */,
8695 					null /* log */) == 0);
8696 		}
8697 	}
8698 }
8699 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8700 // different from javac: with javac, newer class file down the classpath wins
8701 // over source file upstream, while ecj selects the first source or binary found
8702 // in classpath order (no sourcepath involved here)
test235_classpath()8703 public void test235_classpath() throws IOException, InterruptedException {
8704 	runTest(
8705 		true /* shouldCompileOK*/,
8706 		new String[] { /* testFiles */
8707 			"src1/X.java",
8708 			"public class X {\n" +
8709 			"  public static final int CONST = 1;\n" +
8710 			"}\n",
8711 			"src2/X.java",
8712 			"public class X {\n" +
8713 			"}\n",
8714 		},
8715 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
8716 		+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8717 		"" /* expectedOutOutputString */,
8718 		"" /* expectedErrOutputString */,
8719 		true /* shouldFlushOutputDirectory */,
8720 		null /* progress */);
8721 	// ensure that class file is newer than source file (some file systems
8722 	// store the modification time at a second precision)
8723 	File sourceFile = new File(OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java"),
8724 	  classFile = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class");
8725 	while (classFile.lastModified() <= sourceFile.lastModified()) {
8726 		runTest(
8727 			true /* shouldCompileOK*/,
8728 			null /* testFiles */,
8729 			"\"" + OUTPUT_DIR +  File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
8730 			+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8731 			"" /* expectedOutOutputString */,
8732 			"" /* expectedErrOutputString */,
8733 			false /* shouldFlushOutputDirectory */,
8734 			null /* progress */);
8735 	}
8736 	// compile with (buggy) src2 before (correct) bin1 in the classpath
8737 	String sourceFilePath =
8738 		"\"" + OUTPUT_DIR + File.separator + "Y.java\"";
8739 	String commonOptions =
8740 		" -classpath \"" + OUTPUT_DIR + File.separator + "src2"
8741 		+ File.pathSeparator + OUTPUT_DIR + File.separator + "bin1\""
8742 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin2" + "\"";
8743 	runTest(
8744 		false /* shouldCompileOK*/,
8745 		new String[] { /* testFiles */
8746 			"Y.java",
8747 			"public class Y {\n" +
8748 			"  public static void main (String[] args) {\n" +
8749 			"    System.out.println(X.CONST);\n" +
8750 			"  }\n" +
8751 			"}\n",
8752 		},
8753 		sourceFilePath /* commandLine */
8754 		+ " -proc:none " + commonOptions,
8755 		"" /* expectedOutOutputString */,
8756 		"----------\n" +
8757 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 3)\n" +
8758 		"	System.out.println(X.CONST);\n" +
8759 		"	                     ^^^^^\n" +
8760 		"CONST cannot be resolved or is not a field\n" +
8761 		"----------\n" +
8762 		"1 problem (1 error)\n",
8763 		false /* shouldFlushOutputDirectory */,
8764 		null /* progress */);
8765 	// javac passes, using the most recent file amongst source and class files
8766 	// present on the classpath
8767 	if (RUN_JAVAC) {
8768 		Iterator javacCompilersIterator = javacCompilers.iterator();
8769 		String sourceFileNames[] = new String[] {sourceFilePath};
8770 		File outputDir = new File(OUTPUT_DIR);
8771 		while (javacCompilersIterator.hasNext()) {
8772 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8773 			assertTrue(javacCompiler.compile(
8774 					outputDir /* directory */,
8775 					commonOptions /* options */,
8776 					sourceFileNames /* source file names */,
8777 					null /* log */) == 0);
8778 		}
8779 	}
8780 }
8781 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8782 // when class files are ready in all classpath entries, ecj and javac pick
8783 // the first available class file up, regardless of which is newer  (no sourcepath here)
test236_classpath()8784 public void test236_classpath() throws IOException, InterruptedException {
8785 	runTest(
8786 		true /* shouldCompileOK*/,
8787 		new String[] { /* testFiles */
8788 			"src1/X.java",
8789 			"public class X {\n" +
8790 			"  public static final int CONST = 1;\n" +
8791 			"}\n",
8792 		},
8793 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
8794 		+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8795 		"" /* expectedOutOutputString */,
8796 		"" /* expectedErrOutputString */,
8797 		true /* shouldFlushOutputDirectory */,
8798 		null /* progress */);
8799 	File bin1File = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class"),
8800 	  bin2File = new File(OUTPUT_DIR + File.separator + "bin2" + File.separator + "X.class");
8801 	do {
8802 		runTest(
8803 			true /* shouldCompileOK*/,
8804 			new String[] { /* testFiles */
8805 				"src2/X.java",
8806 				"public class X {\n" +
8807 				"  public static final int CONST = 2;\n" +
8808 				"}\n",
8809 			},
8810 			"\"" + OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java\"" /* commandLine */
8811 			+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin2" + "\"",
8812 			"" /* expectedOutOutputString */,
8813 			"" /* expectedErrOutputString */,
8814 			false /* shouldFlushOutputDirectory */,
8815 			null /* progress */);
8816 	} while (bin2File.lastModified() <= bin1File.lastModified());
8817 	String sourceFilePath = "\"" + OUTPUT_DIR +  File.separator + "Y.java\"";
8818 	String commonOptions =
8819 		" -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + File.pathSeparator
8820 		+ OUTPUT_DIR + File.separator + "bin2" + "\""
8821 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin" + "\"";
8822 	runTest(
8823 		true /* shouldCompileOK*/,
8824 		new String[] { /* testFiles */
8825 			"Y.java",
8826 			"public class Y {\n" +
8827 			"  public static void main (String[] args) {\n" +
8828 			"    System.out.println(X.CONST);\n" +
8829 			"  }\n" +
8830 			"}\n",
8831 		},
8832 		sourceFilePath + commonOptions	+ " -proc:none " /* commandLine */,
8833 		"" /* expectedOutOutputString */,
8834 		"" /* expectedErrOutputString */,
8835 		false /* shouldFlushOutputDirectory */,
8836 		null /* progress */);
8837 	this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin"});
8838 	assertTrue(this.verifier.getExecutionOutput().startsWith("1")); // skip trailing newline
8839 	if (RUN_JAVAC) {
8840 		Iterator javacCompilersIterator = javacCompilers.iterator();
8841 		String sourceFileNames[] = new String[] {sourceFilePath};
8842 		File outputDir = new File(OUTPUT_DIR);
8843 		while (javacCompilersIterator.hasNext()) {
8844 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8845 			assertTrue(javacCompiler.compile(
8846 					outputDir /* directory */,
8847 					commonOptions /* options */,
8848 					sourceFileNames,
8849 					null /* log */) == 0);
8850 			this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin"});
8851 			assertEquals('1', this.verifier.getExecutionOutput().charAt(0)); // skip trailing newline
8852 		}
8853 	}
8854 }
8855 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8856 // when a source file is more recent than a class file in a former
8857 // classpath entry, ecj picks the class file up, while javac choses the
8858 // source file (no sourcepath here)
test237_classpath()8859 public void test237_classpath() throws IOException, InterruptedException {
8860 	runTest(
8861 		true /* shouldCompileOK*/,
8862 		new String[] { /* testFiles */
8863 			"src1/X.java",
8864 			"public class X {\n" +
8865 			"  public static final int CONST = 1;\n" +
8866 			"}\n",
8867 		},
8868 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
8869 		+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
8870 		"" /* expectedOutOutputString */,
8871 		"" /* expectedErrOutputString */,
8872 		true /* shouldFlushOutputDirectory */,
8873 		null /* progress */);
8874 	File sourceFile = new File(OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java"),
8875 	  classFile = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class");
8876 	new File(OUTPUT_DIR + File.separator + "src2").mkdirs();
8877 	do {
8878 		Util.writeToFile(
8879 			"public class X {\n" +
8880 			"  public static final int CONST = 2;\n" +
8881 			"}\n",
8882 			sourceFile.getPath());
8883 	} while (classFile.lastModified() >= sourceFile.lastModified());
8884 	String sourceFilePath = "\"" + OUTPUT_DIR +  File.separator + "Y.java\"";
8885 	String commonOptions =
8886 		" -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + File.pathSeparator
8887 		+ OUTPUT_DIR + File.separator + "src2" + "\""
8888 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin" + "\"";
8889 	runTest(
8890 		true /* shouldCompileOK*/,
8891 		new String[] { /* testFiles */
8892 			"Y.java",
8893 			"public class Y {\n" +
8894 			"  public static void main (String[] args) {\n" +
8895 			"    System.out.println(X.CONST);\n" +
8896 			"  }\n" +
8897 			"}\n",
8898 		},
8899 		sourceFilePath + commonOptions	+ " -proc:none " /* commandLine */,
8900 		"" /* expectedOutOutputString */,
8901 		"" /* expectedErrOutputString */,
8902 		false /* shouldFlushOutputDirectory */,
8903 		null /* progress */);
8904 	this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin"});
8905 	assertTrue(this.verifier.getExecutionOutput().startsWith("1")); // skip trailing newline
8906 	if (RUN_JAVAC) {
8907 		Iterator javacCompilersIterator = javacCompilers.iterator();
8908 		String sourceFileNames[] = new String[] {sourceFilePath};
8909 		File outputDir = new File(OUTPUT_DIR);
8910 		while (javacCompilersIterator.hasNext()) {
8911 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8912 			assertTrue(javacCompiler.compile(
8913 					outputDir /* directory */,
8914 					commonOptions /* options */,
8915 					sourceFileNames /* source file names */,
8916 					null /* log */) == 0);
8917 			this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin"});
8918 			assertEquals('2', this.verifier.getExecutionOutput().charAt(0)); // skip trailing newline
8919 			// 2 means javac selected src2 (because the source file was more recent than bin1/X.class)
8920 		}
8921 	}
8922 }
8923 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
8924 // when a source file is more recent than another source file in a former
8925 // classpath entry, ecj and javac pick the latter file up (in other words, if
8926 // only source files are involved, the classpath entries order prevails - no sourcepath here)
test238_classpath()8927 public void test238_classpath() throws IOException, InterruptedException {
8928 	new File(OUTPUT_DIR + File.separator + "src1").mkdirs();
8929 	File sourceFile1 = new File(OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java");
8930 	File sourceFile2 = new File(OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java");
8931 	Util.writeToFile(
8932 		"public class X {\n" +
8933 		"  public static final int CONST = 1;\n" +
8934 		"}\n",
8935 		sourceFile1.getPath());
8936 	new File(OUTPUT_DIR + File.separator + "src2").mkdirs();
8937 	do {
8938 		Util.writeToFile(
8939 			"public class X {\n" +
8940 			"  public static final int CONST = 2;\n" +
8941 			"}\n",
8942 			sourceFile2.getPath());
8943 	} while (sourceFile1.lastModified() >= sourceFile2.lastModified());
8944 	String sourceFilePath = "\"" + OUTPUT_DIR +  File.separator + "Y.java\"";
8945 	String commonOptions =
8946 		" -classpath \"" + OUTPUT_DIR + File.separator + "src1" + File.pathSeparator
8947 		+ OUTPUT_DIR + File.separator + "src2" + "\""
8948 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin" + "\"";
8949 	runTest(
8950 		true /* shouldCompileOK*/,
8951 		new String[] { /* testFiles */
8952 			"Y.java",
8953 			"public class Y {\n" +
8954 			"  public static void main (String[] args) {\n" +
8955 			"    System.out.println(X.CONST);\n" +
8956 			"  }\n" +
8957 			"}\n",
8958 		},
8959 		sourceFilePath + commonOptions	+ " -proc:none " /* commandLine */,
8960 		"" /* expectedOutOutputString */,
8961 		"" /* expectedErrOutputString */,
8962 		false /* shouldFlushOutputDirectory */,
8963 		null /* progress */);
8964 	this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin"});
8965 	assertTrue(this.verifier.getExecutionOutput().startsWith("1")); // skip trailing newline
8966 	if (RUN_JAVAC) {
8967 		Iterator javacCompilersIterator = javacCompilers.iterator();
8968 		String sourceFileNames[] = new String[] {sourceFilePath};
8969 		File outputDir = new File(OUTPUT_DIR);
8970 		while (javacCompilersIterator.hasNext()) {
8971 			JavacCompiler javacCompiler = (JavacCompiler) javacCompilersIterator.next();
8972 			assertTrue(javacCompiler.compile(
8973 					outputDir /* directory */,
8974 					commonOptions /* options */,
8975 					sourceFileNames /* source file names */,
8976 					null /* log */) == 0);
8977 			this.verifier.execute("Y", new String[] {OUTPUT_DIR + File.separator + "bin"});
8978 			assertEquals('1', this.verifier.getExecutionOutput().charAt(0)); // skip trailing newline
8979 			// 1 means javac selected src1 (because src1/X.java comes ahead of src2/X.java on the classpath)
8980 		}
8981 	}
8982 }
8983 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
8984 // basic link: a jar only referenced in the manifest of the first one is found
test239_jar_ref_in_jar()8985 public void test239_jar_ref_in_jar(){
8986 	createCascadedJars();
8987 	this.runConformTest(
8988 		new String[] {
8989 			"src/p/X.java",
8990 			"package p;\n" +
8991 			"/** */\n" +
8992 			"public class X {\n" +
8993 			"  A a;\n" +
8994 			"  B b;\n" +
8995 			"}",
8996 		},
8997      "\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
8998 		+ " -cp \"" + LIB_DIR + File.separator + "lib1.jar\""
8999 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9000      + " -1.5 -g -preserveAllLocals"
9001      + " -proceedOnError -referenceInfo"
9002      + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9003      "",
9004      "",
9005      true);
9006 }
9007 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9008 // links are followed recursively, eliminating dupes
test240_jar_ref_in_jar()9009 public void test240_jar_ref_in_jar(){
9010 	createCascadedJars();
9011 	this.runConformTest(
9012 		new String[] {
9013 			"src/p/X.java",
9014 			"package p;\n" +
9015 			"/** */\n" +
9016 			"public class X {\n" +
9017 			"  A a;\n" +
9018 			"  B b;\n" +
9019 			"  C c;\n" +
9020 			"  D d;\n" +
9021 			"}",
9022 		},
9023 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9024 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar\""
9025 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9026 		+ " -1.5 -g -preserveAllLocals"
9027 		+ " -proceedOnError -referenceInfo"
9028 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9029 		"",
9030 		"",
9031 		true);
9032 }
9033 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9034 // at first level, this is depth first, masking tailing libs
test241_jar_ref_in_jar()9035 public void test241_jar_ref_in_jar(){
9036 	createCascadedJars();
9037 	this.runNegativeTest(
9038 			new String[] {
9039 					"src/p/X.java",
9040 					"package p;\n" +
9041 					"/** */\n" +
9042 					"public class X {\n" +
9043 					"  int i = R.R2;\n" +
9044 					"  int j = R.R3;\n" +
9045 					"}",
9046 			},
9047 			"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9048 			+ " -cp \"" + LIB_DIR + File.separator + "lib1.jar\""
9049 			+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar\""
9050 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9051 			+ " -1.5 -g -preserveAllLocals"
9052 			+ " -proceedOnError -referenceInfo"
9053 			+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9054 			"",
9055 			"----------\n" +
9056 			"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" +
9057 			"	int j = R.R3;\n" +
9058 			"	          ^^\n" +
9059 			"R3 cannot be resolved or is not a field\n" +
9060 			"----------\n" +
9061 			"1 problem (1 error)\n",
9062 			true);
9063 }
9064 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9065 // using only links, we adopt a depth first algorithm
test242_jar_ref_in_jar()9066 public void test242_jar_ref_in_jar(){
9067 	createCascadedJars();
9068 	this.runNegativeTest(
9069 			new String[] {
9070 					"src/p/X.java",
9071 					"package p;\n" +
9072 					"/** */\n" +
9073 					"public class X {\n" +
9074 					"  int i = R.R2;\n" +
9075 					"  int j = R.R3;\n" +
9076 					"}",
9077 			},
9078 			"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9079 			+ " -cp \"" + LIB_DIR + File.separator + "lib4.jar\""
9080 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9081 			+ " -1.5 -g -preserveAllLocals"
9082 			+ " -proceedOnError -referenceInfo"
9083 			+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9084 			"",
9085 			"----------\n" +
9086 			"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" +
9087 			"	int j = R.R3;\n" +
9088 			"	          ^^\n" +
9089 			"R3 cannot be resolved or is not a field\n" +
9090 			"----------\n" +
9091 			"1 problem (1 error)\n",
9092 			true);
9093 }
9094 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9095 // managing subdirectories and .. properly
test243_jar_ref_in_jar()9096 public void test243_jar_ref_in_jar(){
9097 	createCascadedJars();
9098 	this.runConformTest(
9099 		new String[] {
9100 			"src/p/X.java",
9101 			"package p;\n" +
9102 			"/** */\n" +
9103 			"public class X {\n" +
9104 			"  A a;\n" +
9105 			"  B b;\n" +
9106 			"  C c;\n" +
9107 			"  D d;\n" +
9108 			"}",
9109 		},
9110 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9111 		+ " -cp \"" + LIB_DIR + File.separator + "lib5.jar\""
9112 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9113 		+ " -1.5 -g -preserveAllLocals"
9114 		+ " -proceedOnError -referenceInfo"
9115 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9116 		"",
9117 		"",
9118 		true);
9119 }
9120 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9121 // variant: the second jar on a line is found as well
test244_jar_ref_in_jar()9122 public void test244_jar_ref_in_jar(){
9123 	createCascadedJars();
9124 	this.runConformTest(
9125 		new String[] {
9126 			"src/p/X.java",
9127 			"package p;\n" +
9128 			"/** */\n" +
9129 			"public class X {\n" +
9130 			"  C c;\n" +
9131 			"}",
9132 		},
9133   "\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9134 		+ " -cp \"" + LIB_DIR + File.separator + "lib4.jar\""
9135 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9136   + " -1.5 -g -preserveAllLocals"
9137   + " -proceedOnError -referenceInfo"
9138   + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9139   "",
9140   "",
9141   true);
9142 }
9143 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9144 // we eat up absolute links silently
test245_jar_ref_in_jar()9145 public void test245_jar_ref_in_jar(){
9146 	createCascadedJars();
9147 	this.runConformTest(
9148 		new String[] {
9149 			"src/p/X.java",
9150 			"package p;\n" +
9151 			"/** */\n" +
9152 			"public class X {\n" +
9153 			"  F f;\n" +
9154 			"}",
9155 		},
9156 	"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9157 			+ " -cp \"" + LIB_DIR + File.separator + "lib8.jar\""
9158 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9159 	+ " -1.5 -g -preserveAllLocals"
9160 	+ " -proceedOnError -referenceInfo"
9161 	+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9162 	"",
9163 	"",
9164 	true);
9165 }
9166 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9167 // absolute links do not mask following relative links
test246_jar_ref_in_jar()9168 public void test246_jar_ref_in_jar(){
9169 	createCascadedJars();
9170 	this.runConformTest(
9171 		new String[] {
9172 			"src/p/X.java",
9173 			"package p;\n" +
9174 			"/** */\n" +
9175 			"public class X {\n" +
9176 			"  A a;\n" +
9177 			"  F f;\n" +
9178 			"}",
9179 		},
9180 	"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9181 			+ " -cp \"" + LIB_DIR + File.separator + "lib8.jar\""
9182 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9183 	+ " -1.5 -g -preserveAllLocals"
9184 	+ " -proceedOnError -referenceInfo"
9185 	+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9186 	"",
9187 	"",
9188 	true);
9189 }
9190 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9191 // absolute links are not followed
test247_jar_ref_in_jar()9192 public void test247_jar_ref_in_jar(){
9193 	createCascadedJars();
9194 	this.runNegativeTest(
9195 		new String[] {
9196 			"src/p/X.java",
9197 			"package p;\n" +
9198 			"/** */\n" +
9199 			"public class X {\n" +
9200 			"  C c;\n" +
9201 			"}",
9202 		},
9203 	"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9204 			+ " -cp \"" + LIB_DIR + File.separator + "lib8.jar\""
9205 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9206 	+ " -1.5 -g -preserveAllLocals"
9207 	+ " -proceedOnError -referenceInfo"
9208 	+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9209 	"",
9210 	"----------\n" +
9211 	"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9212 	"	C c;\n" +
9213 	"	^\n" +
9214 	"C cannot be resolved to a type\n" +
9215 	"----------\n" +
9216 	"1 problem (1 error)\n",
9217 	true);
9218 }
9219 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9220 // we accept duplicate classpath lines in manifest and we follow the jars of the
9221 // second and following lines as well as the first line (emit a warning as javac does)
test248_jar_ref_in_jar()9222 public void test248_jar_ref_in_jar(){
9223 	createCascadedJars();
9224 	this.runConformTest(
9225 		new String[] {
9226 			"src/p/X.java",
9227 			"package p;\n" +
9228 			"/** */\n" +
9229 			"public class X {\n" +
9230 			"  A a;\n" +
9231 			"  G g;\n" +
9232 			"}",
9233 		},
9234 	"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9235 			+ " -cp \"" + LIB_DIR + File.separator + "lib9.jar\""
9236 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9237 	+ " -1.5 -g -preserveAllLocals"
9238 	+ " -proceedOnError -referenceInfo"
9239 	+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9240 	"",
9241 	"multiple Class-Path headers in manifest of jar file: ---LIB_DIR_PLACEHOLDER---/lib9.jar\n",
9242 	true);
9243 }
9244 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9245 // we accept duplicate classpath lines in manifest and we follow the jars of the
9246 // second and following lines as well as the first line (emit a warning as javac does)
test249_jar_ref_in_jar()9247 public void test249_jar_ref_in_jar(){
9248 	createCascadedJars();
9249 	this.runConformTest(
9250 		new String[] {
9251 			"src/p/X.java",
9252 			"package p;\n" +
9253 			"/** */\n" +
9254 			"public class X {\n" +
9255 			"  C c;\n" +
9256 			"  G g;\n" +
9257 			"}",
9258 		},
9259 	"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9260 			+ " -cp \"" + LIB_DIR + File.separator + "lib9.jar\""
9261 			+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9262 	+ " -1.5 -g -preserveAllLocals"
9263 	+ " -proceedOnError -referenceInfo"
9264 	+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9265 	"",
9266 	"multiple Class-Path headers in manifest of jar file: ---LIB_DIR_PLACEHOLDER---/lib9.jar\n",
9267 	true);
9268 }
9269 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9270 // bootclasspath does not get expanded with linked files
test250_jar_ref_in_jar()9271 public void test250_jar_ref_in_jar(){
9272 	createCascadedJars();
9273 	this.runNegativeTest(
9274 		new String[] {
9275 			"src/p/X.java",
9276 			"package p;\n" +
9277 			"/** */\n" +
9278 			"public class X {\n" +
9279 			"  A a;\n" +
9280 			"  B b;\n" +
9281 			"}",
9282 		},
9283 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9284 	  	+ " -bootclasspath " + getLibraryClassesAsQuotedString()
9285 	  	+ File.pathSeparator + "\"" + LIB_DIR + File.separator + "lib1.jar\""
9286 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9287 		+ " -1.5 -g -preserveAllLocals"
9288 		+ " -proceedOnError -referenceInfo"
9289 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9290 		"",
9291 		"----------\n" +
9292 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" +
9293 		"	B b;\n" +
9294 		"	^\n" +
9295 		"B cannot be resolved to a type\n" +
9296 		"----------\n" +
9297 		"1 problem (1 error)\n",
9298 		true);
9299 }
9300 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9301 // jar files reached indirectly bear the access rules of the entry that
9302 // references them
test251_jar_ref_in_jar()9303 public void test251_jar_ref_in_jar(){
9304 	createCascadedJars();
9305 	this.runConformTest(
9306 		new String[] {
9307 			"src/p/X.java",
9308 			"package p;\n" +
9309 			"/** */\n" +
9310 			"public class X {\n" +
9311 			"  A a;\n" +
9312 			"}",
9313 		},
9314 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9315 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar[~p/A]\""
9316 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9317 		+ " -1.5 -g -preserveAllLocals"
9318 		+ " -proceedOnError -referenceInfo"
9319 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9320 		"",
9321 		"----------\n" +
9322 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9323 		"	A a;\n" +
9324 		"	^\n" +
9325 		"Discouraged access: The type \'A\' is not API (restriction on classpath entry \'---LIB_DIR_PLACEHOLDER---/lib3.jar\')\n" +
9326 		"----------\n" +
9327 		"1 problem (1 warning)\n",
9328 		true);
9329 }
9330 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=217233
9331 // compiler progress test (1 unit)
test252_progress()9332 public void test252_progress() {
9333 	runProgressTest(
9334 		new String[] {
9335 			"X.java",
9336 			"public class X {\n" +
9337 			"}\n",
9338 		},
9339 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
9340 		+ " -d \"" + OUTPUT_DIR + "\"",
9341 		""/*out output*/,
9342 		""/*err output*/,
9343 		"----------\n" +
9344 		"[worked: 0 - remaining: 1]\n" +
9345 		"Beginning to compile\n" +
9346 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" +
9347 		"[worked: 1 - remaining: 0]\n" +
9348 		"----------\n"
9349 	);
9350 }
9351 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=217233
9352 // compiler progress test (2 units)
test253_progress()9353 public void test253_progress() {
9354 	runProgressTest(
9355 		new String[] {
9356 			"Y.java",
9357 			"public class Y {\n" +
9358 			"}\n",
9359 			"X.java",
9360 			"public class X extends Y {\n" +
9361 			"}\n",
9362 		},
9363 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
9364         + " -cp " + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
9365 		+ " -d \"" + OUTPUT_DIR + "\"",
9366 		""/*out output*/,
9367 		""/*err output*/,
9368 		"----------\n" +
9369 		"[worked: 0 - remaining: 1]\n" +
9370 		"Beginning to compile\n" +
9371 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" +
9372 		"[worked: 1 - remaining: 1]\n" +
9373 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" +
9374 		"[worked: 2 - remaining: 0]\n" +
9375 		"----------\n"
9376 	);
9377 }
9378 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=217233
9379 // compiler progress test (multiple iterations)
test254_progress()9380 public void test254_progress() {
9381 	runProgressTest(
9382 		new String[] {
9383 			"X.java",
9384 			"public class X {\n" +
9385 			"}\n",
9386 			"Y.java",
9387 			"public class Y {\n" +
9388 			"}\n",
9389 		},
9390 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
9391 		+ " \"" + OUTPUT_DIR +  File.separator + "Y.java\""
9392         + " -cp " + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
9393 		+ " -d \"" + OUTPUT_DIR + "\""
9394 		+ " -repeat 3",
9395 		"[repetition 1/3]\n" +
9396 		"[repetition 2/3]\n" +
9397 		"[repetition 3/3]\n"/*out output*/,
9398 		""/*err output*/,
9399 		"----------\n" +
9400 		"[worked: 0 - remaining: 6]\n" +
9401 		"Beginning to compile\n" +
9402 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" +
9403 		"[worked: 1 - remaining: 5]\n" +
9404 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" +
9405 		"[worked: 2 - remaining: 4]\n" +
9406 		"Beginning to compile\n" +
9407 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" +
9408 		"[worked: 3 - remaining: 3]\n" +
9409 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" +
9410 		"[worked: 4 - remaining: 2]\n" +
9411 		"Beginning to compile\n" +
9412 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" +
9413 		"[worked: 5 - remaining: 1]\n" +
9414 		"Processing ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" +
9415 		"[worked: 6 - remaining: 0]\n" +
9416 		"----------\n"
9417 	);
9418 }
9419 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=217233
9420 // compiler progress test (cancellation)
test255_progress()9421 public void test255_progress() {
9422 	TestCompilationProgress progress = new TestCompilationProgress() {
9423 		@Override
9424 		public void worked(int workIncrement, int remainingWork) {
9425 			if (remainingWork == 1)
9426 				this.isCanceled = true;
9427 			super.worked(workIncrement, remainingWork);
9428 		}
9429 	};
9430 	String setting= System.getProperty("jdt.compiler.useSingleThread");
9431 	try {
9432 		System.setProperty("jdt.compiler.useSingleThread", "true");
9433 		runProgressTest(
9434 			false/*shouldCompileOK*/,
9435 			new String[] {
9436 				"Y.java",
9437 				"public class Y {\n" +
9438 				"}\n",
9439 				"X.java",
9440 				"public class X extends Y {\n" +
9441 				"}\n",
9442 			},
9443 			"\"" + OUTPUT_DIR +  File.separator + "X.java\""
9444 	        + " -cp " + File.pathSeparator + File.pathSeparator + "\"" + OUTPUT_DIR + "\""
9445 			+ " -d \"" + OUTPUT_DIR + "\"",
9446 			""/*out output*/,
9447 			""/*err output*/,
9448 			progress,
9449 			"----------\n" +
9450 			"[worked: 0 - remaining: 1]\n" +
9451 			"Beginning to compile\n" +
9452 			"Processing ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" +
9453 			"[worked: 1 - remaining: 1]\n" +
9454 			"----------\n"
9455 		);
9456 	} finally {
9457 		System.setProperty("jdt.compiler.useSingleThread", setting == null ? "false" : setting);
9458 	}
9459 }
9460 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9461 // jar files reached indirectly bear the access rules of the entry that
9462 // references them - this hides the access rules of further instances of the
9463 // same jar on the classpath
test256_jar_ref_in_jar()9464 public void test256_jar_ref_in_jar(){
9465 	createCascadedJars();
9466 	this.runConformTest(
9467 		new String[] {
9468 			"src/p/X.java",
9469 			"package p;\n" +
9470 			"/** */\n" +
9471 			"public class X {\n" +
9472 			"  A a;\n" +
9473 			"}",
9474 		},
9475 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9476 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar[~p/A]\""
9477 		+ " -cp \"" + LIB_DIR + File.separator + "lib1.jar[-p/A]\""
9478 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9479 		+ " -1.5 -g -preserveAllLocals"
9480 		+ " -proceedOnError -referenceInfo"
9481 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9482 		"",
9483 		"----------\n" +
9484 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9485 		"	A a;\n" +
9486 		"	^\n" +
9487 		"Discouraged access: The type \'A\' is not API (restriction on classpath entry \'---LIB_DIR_PLACEHOLDER---/lib3.jar\')\n" +
9488 		"----------\n" +
9489 		"1 problem (1 warning)\n",
9490 		true);
9491 }
9492 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9493 // jar files reached indirectly bear the access rules of the entry that
9494 // references them - this hides the access rules of further instances of the
9495 // same jar on the classpath
test257_jar_ref_in_jar()9496 public void test257_jar_ref_in_jar(){
9497 	createCascadedJars();
9498 	this.runConformTest(
9499 		new String[] {
9500 			"src/p/X.java",
9501 			"package p;\n" +
9502 			"/** */\n" +
9503 			"public class X {\n" +
9504 			"  A a;\n" +
9505 			"}",
9506 		},
9507 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9508 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar[-DUMMY]\""
9509 		+ " -cp \"" + LIB_DIR + File.separator + "lib1.jar[-p/A]\""
9510 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9511 		+ " -1.5 -g -preserveAllLocals"
9512 		+ " -proceedOnError -referenceInfo"
9513 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9514 		"",
9515 		"",
9516 		true);
9517 }
9518 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9519 // jar files reached indirectly bear the access rules of the entry that
9520 // references them - this hides the access rules of further instances of the
9521 // same jar on the classpath, to the point of absorbing it if none is specified
test258_jar_ref_in_jar()9522 public void test258_jar_ref_in_jar(){
9523 	createCascadedJars();
9524 	this.runConformTest(
9525 		new String[] {
9526 			"src/p/X.java",
9527 			"package p;\n" +
9528 			"/** */\n" +
9529 			"public class X {\n" +
9530 			"  A a;\n" +
9531 			"}",
9532 		},
9533 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9534 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar\""
9535 		+ " -cp \"" + LIB_DIR + File.separator + "lib1.jar[-p/A]\""
9536 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9537 		+ " -1.5 -g -preserveAllLocals"
9538 		+ " -proceedOnError -referenceInfo"
9539 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9540 		"",
9541 		"",
9542 		true);
9543 }
9544 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9545 // -sourcepath is OK at first level
test259_jar_ref_in_jar()9546 public void test259_jar_ref_in_jar(){
9547 	createCascadedJars();
9548 	this.runConformTest(
9549 		new String[] {
9550 			"src/p/X.java",
9551 			"package p;\n" +
9552 			"/** */\n" +
9553 			"public class X {\n" +
9554 			"  S1 s;\n" +
9555 			"}",
9556 		},
9557 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9558 		+ " -sourcepath \"" + LIB_DIR + File.separator + "lib1.jar\""
9559 		+ " -1.5 -g -preserveAllLocals"
9560 		+ " -proceedOnError -referenceInfo"
9561 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9562 		"",
9563 		"",
9564 		true);
9565 }
9566 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9567 // -sourcepath is KO at second level (that is, it does not leverage the links
9568 // at all)
test260_jar_ref_in_jar()9569 public void test260_jar_ref_in_jar(){
9570 	createCascadedJars();
9571 	this.runNegativeTest(
9572 		new String[] {
9573 			"src/p/X.java",
9574 			"package p;\n" +
9575 			"/** */\n" +
9576 			"public class X {\n" +
9577 			"  S2 s;\n" +
9578 			"}",
9579 		},
9580 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9581 		+ " -sourcepath \"" + LIB_DIR + File.separator + "lib1.jar\""
9582 		+ " -1.5 -g -preserveAllLocals"
9583 		+ " -proceedOnError -referenceInfo"
9584 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9585 		"",
9586 		"----------\n" +
9587 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9588 		"	S2 s;\n" +
9589 		"	^^\n" +
9590 		"S2 cannot be resolved to a type\n" +
9591 		"----------\n" +
9592 		"1 problem (1 error)\n",
9593 		true);
9594 }
9595 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9596 // error case: the MANIFEST.MF is a directory; should fail gracefully
test261_jar_ref_in_jar()9597 public void test261_jar_ref_in_jar(){
9598 	createCascadedJars();
9599 	this.runNegativeTest(
9600 		new String[] {
9601 			"src/p/X.java",
9602 			"package p;\n" +
9603 			"/** */\n" +
9604 			"public class X {\n" +
9605 			"  A a;\n" +
9606 			"  B b;\n" +
9607 			"}",
9608 		},
9609 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9610 				+ " -cp \"" + LIB_DIR + File.separator + "lib10.jar\""
9611 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9612 		+ " -1.5 -g -preserveAllLocals"
9613 		+ " -proceedOnError -referenceInfo"
9614 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9615 		"",
9616 		"----------\n" +
9617 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" +
9618 		"	B b;\n" +
9619 		"	^\n" +
9620 		"B cannot be resolved to a type\n" +
9621 		"----------\n" +
9622 		"1 problem (1 error)\n",
9623 		true);
9624 }
9625 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9626 // using relative paths for libs
test262_jar_ref_in_jar()9627 public void test262_jar_ref_in_jar(){
9628 	String currentWorkingDirectoryPath = System.getProperty("user.dir");
9629 	if (currentWorkingDirectoryPath == null) {
9630 		System.err.println("BatchCompilerTest#235 could not access the current working directory " + currentWorkingDirectoryPath);
9631 	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
9632 		System.err.println("BatchCompilerTest#235 current working directory is not a directory " + currentWorkingDirectoryPath);
9633 	} else {
9634 		String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar";
9635 		String lib2Path = currentWorkingDirectoryPath + File.separator + "lib2.jar";
9636 		try {
9637 			Util.createJar(
9638 				null,
9639 				new String[] {
9640 					"META-INF/MANIFEST.MF",
9641 					"Manifest-Version: 1.0\n" +
9642 					"Created-By: Eclipse JDT Test Harness\n" +
9643 					"Class-Path: lib2.jar\n",
9644 				},
9645 				lib1Path,
9646 				JavaCore.VERSION_1_4);
9647 			Util.createJar(
9648 				new String[] {
9649 					"p/A.java",
9650 					"package p;\n" +
9651 					"public class A {\n" +
9652 					"}",
9653 				},
9654 				null,
9655 				lib2Path,
9656 				JavaCore.VERSION_1_4);
9657 			this.runConformTest(
9658 				new String[] {
9659 					"src/p/X.java",
9660 					"package p;\n" +
9661 					"/** */\n" +
9662 					"public class X {\n" +
9663 					"  A a;\n" +
9664 					"}",
9665 				},
9666 		        "\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9667 				+ " -cp lib1.jar" // relative
9668 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9669 		        + " -1.5 -g -preserveAllLocals"
9670 		        + " -proceedOnError -referenceInfo"
9671 		        + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9672 		        "",
9673 		        "",
9674 		        true);
9675 		} catch (IOException e) {
9676 			System.err.println("BatchCompilerTest#235 could not write to current working directory " + currentWorkingDirectoryPath);
9677 		} finally {
9678 			new File(lib1Path).delete();
9679 			new File(lib2Path).delete();
9680 		}
9681 	}
9682 }
9683 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9684 // empty Class-Path header
9685 // javac 1.4.2 passes, later versions fail in error
9686 // java accepts the same jar (which makes the compiler responsible for the
9687 // error detection)
9688 // design: will issue a warning
test263_jar_ref_in_jar()9689 public void test263_jar_ref_in_jar(){
9690 	createCascadedJars();
9691 	this.runTest(
9692 		true,
9693 		new String[] {
9694 			"src/p/X.java",
9695 			"package p;\n" +
9696 			"/** */\n" +
9697 			"public class X {\n" +
9698 			"  A a;\n" +
9699 			"}",
9700 		},
9701 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9702 		+ " -classpath \"" + LIB_DIR + File.separator + "lib11.jar\""
9703 		+ " -1.5 -g -preserveAllLocals"
9704 		+ " -verbose -proceedOnError -referenceInfo"
9705 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9706 		ONE_FILE_GENERATED_MATCHER,
9707 		new StringMatcher(
9708 			"invalid Class-Path header in manifest of jar file: ---LIB_DIR_PLACEHOLDER---/lib11.jar\n",
9709 			outputDirNormalizer),
9710 		true);
9711 }
9712 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9713 // missing space after ClassPath:
test264_jar_ref_in_jar()9714 public void test264_jar_ref_in_jar(){
9715 	createCascadedJars();
9716 	this.runTest(
9717 		false,
9718 		new String[] {
9719 			"src/p/X.java",
9720 			"package p;\n" +
9721 			"/** */\n" +
9722 			"public class X {\n" +
9723 			"  A a;\n" +
9724 			"}",
9725 		},
9726 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9727 		+ " -classpath \"" + LIB_DIR + File.separator + "lib12.jar\""
9728 		+ " -1.5 -g -preserveAllLocals"
9729 		+ " -referenceInfo"
9730 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9731 		"",
9732 		"invalid Class-Path header in manifest of jar file: ---LIB_DIR_PLACEHOLDER---/lib12.jar\n" +
9733 		"----------\n" +
9734 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9735 		"	A a;\n" +
9736 		"	^\n" +
9737 		"A cannot be resolved to a type\n" +
9738 		"----------\n" +
9739 		"1 problem (1 error)\n",
9740 		true,
9741 		null /* progress */);
9742 }
9743 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9744 // missing space after ClassPath
9745 // javac reports an error (including an explicit manifest header error since
9746 // version 1.5); moreover, it stops interpreting the said header
9747 // design: we report a warning and eat up the remainding of the line
test265_jar_ref_in_jar()9748 public void test265_jar_ref_in_jar(){
9749 	createCascadedJars();
9750 	this.runTest(
9751 		false,
9752 		new String[] {
9753 			"src/p/X.java",
9754 			"package p;\n" +
9755 			"/** */\n" +
9756 			"public class X {\n" +
9757 			"  A a;\n" +
9758 			"}",
9759 		},
9760 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9761 		+ " -classpath \"" + LIB_DIR + File.separator + "lib13.jar\""
9762 		+ " -1.5 -g -preserveAllLocals"
9763 		+ " -proceedOnError -referenceInfo"
9764 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9765 		"",
9766 		"invalid Class-Path header in manifest of jar file: ---LIB_DIR_PLACEHOLDER---/lib13.jar\n" +
9767 		"----------\n" +
9768 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9769 		"	A a;\n" +
9770 		"	^\n" +
9771 		"A cannot be resolved to a type\n" +
9772 		"----------\n" +
9773 		"1 problem (1 error)\n",
9774 		true,
9775 		null /* progress */);
9776 }
9777 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9778 // extra space before Class-Path header
9779 // the net result is that the line is part of the value of the previous header
9780 // we then simply don't see the remainding of the line as jars
test266_jar_ref_in_jar()9781 public void test266_jar_ref_in_jar(){
9782 	createCascadedJars();
9783 	this.runTest(
9784 		false,
9785 		new String[] {
9786 			"src/p/X.java",
9787 			"package p;\n" +
9788 			"/** */\n" +
9789 			"public class X {\n" +
9790 			"  A a;\n" +
9791 			"}",
9792 		},
9793 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9794 		+ " -classpath \"" + LIB_DIR + File.separator + "lib14.jar\""
9795 		+ " -1.5 -g -preserveAllLocals"
9796 		+ " -proceedOnError -referenceInfo"
9797 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9798 		"",
9799 		"----------\n" +
9800 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9801 		"	A a;\n" +
9802 		"	^\n" +
9803 		"A cannot be resolved to a type\n" +
9804 		"----------\n" +
9805 		"1 problem (1 error)\n",
9806 		true,
9807 		null /* progress */);
9808 }
9809 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9810 // missing newline at the end of the line
9811 // javac eats the line silently, which results into not finding A
9812 // design: we report a warning and eat up the remainding of the line
test267_jar_ref_in_jar()9813 public void test267_jar_ref_in_jar(){
9814 	createCascadedJars();
9815 	this.runTest(
9816 		false,
9817 		new String[] {
9818 			"src/p/X.java",
9819 			"package p;\n" +
9820 			"/** */\n" +
9821 			"public class X {\n" +
9822 			"  A a;\n" +
9823 			"}",
9824 		},
9825 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9826 		+ " -classpath \"" + LIB_DIR + File.separator + "lib15.jar\""
9827 		+ " -1.5 -g -preserveAllLocals"
9828 		+ " -proceedOnError -referenceInfo"
9829 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9830 		"",
9831 		"invalid Class-Path header in manifest of jar file: ---LIB_DIR_PLACEHOLDER---/lib15.jar\n" +
9832 		"----------\n" +
9833 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
9834 		"	A a;\n" +
9835 		"	^\n" +
9836 		"A cannot be resolved to a type\n" +
9837 		"----------\n" +
9838 		"1 problem (1 error)\n",
9839 		true,
9840 		null /* progress */);
9841 }
9842 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9843 // white-box test for duplicate classpath lines variant (empty line between the
9844 // entries)
test268_jar_ref_in_jar()9845 public void test268_jar_ref_in_jar(){
9846 	try {
9847 		ManifestAnalyzer analyzer = new ManifestAnalyzer();
9848 		assertTrue(analyzeManifestContents(
9849 			analyzer,
9850 			"Manifest-Version: 1.0\n" +
9851 			"Created-By: Eclipse JDT Test Harness\n" +
9852 			"Class-Path: lib1.jar\n" +
9853 			"\n" +
9854 			"Class-Path: lib3.jar\n"));
9855 		assertEquals(2, analyzer.getClasspathSectionsCount());
9856 		assertEquals(2, analyzer.getCalledFileNames().size());
9857 	} catch (IOException e) {
9858 		e.printStackTrace();
9859 		fail();
9860 	}
9861 }
9862 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9863 // white-box test for duplicate classpath lines variant (other header between the
9864 // entries - note that since we are not doing a full-fledged manifest analysis,
9865 // a dummy header passes)
test269_jar_ref_in_jar()9866 public void test269_jar_ref_in_jar(){
9867 	try {
9868 		ManifestAnalyzer analyzer = new ManifestAnalyzer();
9869 		assertTrue(analyzeManifestContents(
9870 			analyzer,
9871 			"Manifest-Version: 1.0\n" +
9872 			"Created-By: Eclipse JDT Test Harness\n" +
9873 			"Class-Path: lib1.jar\n" +
9874 			"Dummy:\n" +
9875 			"Class-Path: lib3.jar\n"));
9876 		assertEquals(2, analyzer.getClasspathSectionsCount());
9877 		assertEquals(2, analyzer.getCalledFileNames().size());
9878 	} catch (IOException e) {
9879 		e.printStackTrace();
9880 		fail();
9881 	}
9882 }
9883 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9884 // white-box test: tabs are not seen as URI separator, but as parts of URI instead
9885 // will trigger downstream errors if the jars are really needed
test270_jar_ref_in_jar()9886 public void test270_jar_ref_in_jar(){
9887 	try {
9888 		ManifestAnalyzer analyzer = new ManifestAnalyzer();
9889 		assertTrue(analyzeManifestContents(
9890 			analyzer,
9891 			"Manifest-Version: 1.0\n" +
9892 			"Created-By: Eclipse JDT Test Harness\n" +
9893 			"Class-Path: lib1.jar\tlib2.jar\n"));
9894 		assertEquals(1, analyzer.getClasspathSectionsCount());
9895 		assertEquals(1, analyzer.getCalledFileNames().size());
9896 	} catch (IOException e) {
9897 		e.printStackTrace();
9898 		fail();
9899 	}
9900 }
9901 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9902 // managing continuations properly
test271_jar_ref_in_jar()9903 public void test271_jar_ref_in_jar(){
9904 	createCascadedJars();
9905 	this.runConformTest(
9906 		new String[] {
9907 			"src/p/X.java",
9908 			"package p;\n" +
9909 			"/** */\n" +
9910 			"public class X {\n" +
9911 			"  A a;\n" +
9912 			"  B b;\n" +
9913 			"}",
9914 		},
9915 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
9916 				+ " -cp \"" + LIB_DIR + File.separator + "lib16.jar\""
9917 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
9918 		+ " -1.5 -g -preserveAllLocals"
9919 		+ " -proceedOnError -referenceInfo"
9920 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
9921 		"",
9922 		"",
9923 		true);
9924 }
9925 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9926 // white-box test: variants on continuations
test272_jar_ref_in_jar()9927 public void test272_jar_ref_in_jar(){
9928 	try {
9929 		ManifestAnalyzer analyzer = new ManifestAnalyzer();
9930 		assertTrue(analyzeManifestContents(
9931 			analyzer,
9932 			"Manifest-Version: 1.0\n" +
9933 			"Created-By: Eclipse JDT Test Harness\n" +
9934 			"Class-Path: \n" +
9935 			"            lib1.jar       \n" +
9936 			"\n"));
9937 		assertEquals(1, analyzer.getClasspathSectionsCount());
9938 		assertEquals(1, analyzer.getCalledFileNames().size());
9939 	} catch (IOException e) {
9940 		e.printStackTrace();
9941 		fail();
9942 	}
9943 }
9944 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9945 // white-box test: variants on continuations
test273_jar_ref_in_jar()9946 public void test273_jar_ref_in_jar(){
9947 	try {
9948 		ManifestAnalyzer analyzer = new ManifestAnalyzer();
9949 		assertTrue(analyzeManifestContents(
9950 			analyzer,
9951 			"Manifest-Version: 1.0\n" +
9952 			"Created-By: Eclipse JDT Test Harness\n" +
9953 			"Class-Path: \n" +
9954 			" \n" +
9955 			"            lib1.jar       \n" +
9956 			" \n" +
9957 			"            lib1.jar       \n" +
9958 			"\n"));
9959 		assertEquals(1, analyzer.getClasspathSectionsCount());
9960 		assertEquals(2, analyzer.getCalledFileNames().size());
9961 	} catch (IOException e) {
9962 		e.printStackTrace();
9963 		fail();
9964 	}
9965 }
9966 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9967 // white-box test: variants on continuations
test274_jar_ref_in_jar()9968 public void test274_jar_ref_in_jar(){
9969 	try {
9970 		ManifestAnalyzer analyzer = new ManifestAnalyzer();
9971 		assertFalse(analyzeManifestContents(
9972 			analyzer,
9973 			"Manifest-Version: 1.0\n" +
9974 			"Created-By: Eclipse JDT Test Harness\n" +
9975 			"Class-Path: \n" +
9976 			"            lib1.jar"));
9977 	} catch (IOException e) {
9978 		e.printStackTrace();
9979 		fail();
9980 	}
9981 }
9982 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
9983 // white-box test: variants on continuations
test275_jar_ref_in_jar()9984 public void test275_jar_ref_in_jar(){
9985 	try {
9986 		assertFalse(analyzeManifestContents(
9987 			new ManifestAnalyzer(),
9988 			"Manifest-Version: 1.0\n" +
9989 			"Created-By: Eclipse JDT Test Harness\n" +
9990 			"Class-Path: \n" +
9991 			" \n" +
9992 			"            lib1.jar"));
9993 	} catch (IOException e) {
9994 		e.printStackTrace();
9995 		fail();
9996 	}
9997 }
analyzeManifestContents(ManifestAnalyzer manifestAnalyzer, String string)9998 private boolean analyzeManifestContents(ManifestAnalyzer manifestAnalyzer,
9999 		String string) throws IOException {
10000 	InputStream stream = new ByteArrayInputStream(string.getBytes());
10001 	try {
10002 		return manifestAnalyzer.analyzeManifestContents(stream);
10003 	} finally {
10004 		stream.close();
10005 	}
10006 }
10007 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
10008 // white-box test: variants on continuations
test276_jar_ref_in_jar()10009 public void test276_jar_ref_in_jar(){
10010 	try {
10011 		assertFalse(analyzeManifestContents(
10012 			new ManifestAnalyzer(),
10013 			"Manifest-Version: 1.0\n" +
10014 			"Created-By: Eclipse JDT Test Harness\n" +
10015 			"Class-Path:      \n" +
10016 			"lib1.jar"));
10017 	} catch (IOException e) {
10018 		e.printStackTrace();
10019 		fail();
10020 	}
10021 }
10022 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
10023 // extdirs jars do not follow links
test277_jar_ref_in_jar()10024 public void test277_jar_ref_in_jar(){
10025 	createCascadedJars();
10026 	this.runNegativeTest(
10027 		new String[] {
10028 			"src/p/X.java",
10029 			"package p;\n" +
10030 			"/** */\n" +
10031 			"public class X {\n" +
10032 			"  A a;\n" +
10033 			"  B b;\n" +
10034 			"}",
10035 		},
10036 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
10037 	  	+ " -extdirs \"" + LIB_DIR + File.separator + "dir\""
10038 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
10039 		+ " -1.5 -g -preserveAllLocals"
10040 		+ " -proceedOnError -referenceInfo"
10041 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
10042 		"",
10043 		"----------\n" +
10044 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" +
10045 		"	B b;\n" +
10046 		"	^\n" +
10047 		"B cannot be resolved to a type\n" +
10048 		"----------\n" +
10049 		"1 problem (1 error)\n",
10050 		true);
10051 }
10052 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars
10053 // endorseddirs does not get expanded with linked files
test278_jar_ref_in_jar()10054 public void test278_jar_ref_in_jar(){
10055 	createCascadedJars();
10056 	this.runNegativeTest(
10057 		new String[] {
10058 			"src/p/X.java",
10059 			"package p;\n" +
10060 			"/** */\n" +
10061 			"public class X {\n" +
10062 			"  A a;\n" +
10063 			"  B b;\n" +
10064 			"}",
10065 		},
10066 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
10067 	  	+ " -endorseddirs \"" + LIB_DIR + File.separator + "dir\""
10068 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
10069 		+ " -1.5 -g -preserveAllLocals"
10070 		+ " -proceedOnError -referenceInfo"
10071 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
10072 		"",
10073 		"----------\n" +
10074 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" +
10075 		"	B b;\n" +
10076 		"	^\n" +
10077 		"B cannot be resolved to a type\n" +
10078 		"----------\n" +
10079 		"1 problem (1 error)\n",
10080 		true);
10081 }
10082 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
10083 // looking at access rules: ignore if better makes the class file selected if
10084 // it is newer, but see test#280 for what happens when it is not
test279_sourcepath_vs_classpath()10085 public void test279_sourcepath_vs_classpath() throws IOException, InterruptedException {
10086 	runTest(
10087 		true /* shouldCompileOK*/,
10088 		new String[] { /* testFiles */
10089 			"src1/X.java",
10090 			"public class X {\n" +
10091 			"  public static final int CONST = 1;\n" +
10092 			"}\n",
10093 			"src2/X.java",
10094 			"public class X {\n" +
10095 			"  public static final int CONST = 2;\n" +
10096 			"}\n",
10097 		},
10098 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
10099 		+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
10100 		"" /* expectedOutOutputString */,
10101 		"" /* expectedErrOutputString */,
10102 		true /* shouldFlushOutputDirectory */,
10103 		null /* progress */);
10104 	// ensure that bin1/X.class file is newer than src2/X.java (some file systems
10105 	// store the modification time at a second precision)
10106 	File sourceFile = new File(OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java"),
10107 	  classFile = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class");
10108 	while (classFile.lastModified() <= sourceFile.lastModified()) {
10109 		runConformTest(
10110 			null,
10111 			"\"" + OUTPUT_DIR +  File.separator + "src1" + File.separator + "X.java\""
10112 			+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
10113 			"",
10114 			"",
10115 			false);
10116 	}
10117 	// the ignore if better rule upon src2 leads to bin1 being selected
10118 	runConformTest(
10119 		new String[] {
10120 			"Y.java",
10121 			"public class Y {\n" +
10122 			"  public static void main (String[] args) {\n" +
10123 			"    System.out.println(X.CONST);\n" +
10124 			"  }\n" +
10125 			"}\n",
10126 		},
10127 		"\"" + OUTPUT_DIR +  File.separator + "Y.java\""
10128 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src2[?**/*]" + "\""
10129 		+ " -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + "\""
10130 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
10131 		"",
10132 		"",
10133 		false);
10134 	this.verifier.execute("Y", new String[] {OUTPUT_DIR });
10135 	assertTrue(this.verifier.getExecutionOutput().startsWith("1")); // skip trailing newline
10136 }
10137 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684
10138 // looking at access rules: ignore if better makes the class file selected even
10139 // if it is older (in test#279 it was newer); access rules are thus no work
10140 // around since they ignore modification dates
test280_sourcepath_vs_classpath()10141 public void test280_sourcepath_vs_classpath() throws IOException, InterruptedException {
10142 	runTest(
10143 		true /* shouldCompileOK*/,
10144 		new String[] { /* testFiles */
10145 			"src1/X.java",
10146 			"public class X {\n" +
10147 			"  public static final int CONST = 1;\n" +
10148 			"}\n",
10149 		},
10150 		"\"" + OUTPUT_DIR + File.separator + "src1" + File.separator + "X.java\"" /* commandLine */
10151 		+ " -proc:none -d \"" + OUTPUT_DIR + File.separator + "bin1" + "\"",
10152 		"" /* expectedOutOutputString */,
10153 		"" /* expectedErrOutputString */,
10154 		true /* shouldFlushOutputDirectory */,
10155 		null /* progress */);
10156 	// ensure that bin1/X.class file is older than src2/X.java (some file systems
10157 	// store the modification time at a second precision)
10158 	File sourceFile = new File(OUTPUT_DIR + File.separator + "src2" + File.separator + "X.java"),
10159 	  classFile = new File(OUTPUT_DIR + File.separator + "bin1" + File.separator + "X.class");
10160 	new File(OUTPUT_DIR + File.separator + "src2").mkdirs();
10161 	do {
10162 		Util.writeToFile(
10163 			"public class X {\n" +
10164 			"  public static final int CONST = 2;\n" +
10165 			"}\n",
10166 			sourceFile.getPath());
10167 	} while (classFile.lastModified() >= sourceFile.lastModified());
10168 	// the ignore if better rule upon src2 leads to bin1 being selected even if
10169 	// src2/X.java is newer
10170 	runConformTest(
10171 		new String[] {
10172 			"Y.java",
10173 			"public class Y {\n" +
10174 			"  public static void main (String[] args) {\n" +
10175 			"    System.out.println(X.CONST);\n" +
10176 			"  }\n" +
10177 			"}\n",
10178 		},
10179 		"\"" + OUTPUT_DIR +  File.separator + "Y.java\""
10180 		+ " -sourcepath \"" + OUTPUT_DIR + File.separator + "src2[?**/*]" + "\""
10181 		+ " -classpath \"" + OUTPUT_DIR + File.separator + "bin1" + "\""
10182 		+ " -proc:none -d \"" + OUTPUT_DIR + "\"",
10183 		"",
10184 		"",
10185 		false);
10186 	this.verifier.execute("Y", new String[] {OUTPUT_DIR });
10187 	assertTrue(this.verifier.getExecutionOutput().startsWith("1")); // skip trailing newline
10188 }
10189 
10190 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360
test281_classpath()10191 public void test281_classpath() {
10192 	runConformTest(
10193 		new String[] {
10194 			"src1/X.java",
10195 			"public class X {\n" +
10196 			"}",
10197 		},
10198         "\"" + OUTPUT_DIR +  File.separator + "src1/X.java\" -cp Y.java",
10199         "" /* expectedOutOutputString */,
10200         "incorrect classpath: Y.java\n",
10201         false/*shouldFlushOutput*/);
10202 }
10203 
10204 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360
test282_classpath()10205 public void test282_classpath() {
10206 	runConformTest(
10207 		new String[] {
10208 			"src1/X.java",
10209 			"public class X {\n" +
10210 			"}",
10211 		},
10212         "\"" + OUTPUT_DIR +  File.separator + "src1/X.java\" -cp p/Y.java",
10213         "" /* expectedOutOutputString */,
10214         "incorrect classpath: p/Y.java\n",
10215         false/*shouldFlushOutput*/);
10216 }
10217 
10218 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360
test283_classpath()10219 public void test283_classpath() {
10220 	runConformTest(
10221 		new String[] {
10222 			"src1/X.java",
10223 			"public class X {\n" +
10224 			"}",
10225 		},
10226         "\"" + OUTPUT_DIR +  File.separator + "src1/X.java\" -cp Y.class",
10227         "" /* expectedOutOutputString */,
10228         "incorrect classpath: Y.class\n",
10229         false/*shouldFlushOutput*/);
10230 }
10231 
10232 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360
test284_classpath()10233 public void test284_classpath() {
10234 	runConformTest(
10235 		new String[] {
10236 			"src1/X.java",
10237 			"public class X {\n" +
10238 			"}",
10239 		},
10240         "\"" + OUTPUT_DIR +  File.separator + "src1/X.java\" -cp p/Y.class",
10241         "" /* expectedOutOutputString */,
10242         "incorrect classpath: p/Y.class\n",
10243         false/*shouldFlushOutput*/);
10244 }
10245 
10246 // command-line expansion
test285_option_files()10247 public void test285_option_files() {
10248 	runConformTest(
10249 		new String[] {
10250 			"X.java",
10251 			"public @interface X {\n" +
10252 			"}",
10253 			"options.txt",
10254 			"-source 1.5"
10255 		},
10256         "\"" + OUTPUT_DIR +  File.separator + "X.java\" " +
10257         "\"@" + OUTPUT_DIR +  File.separator + "options.txt\"",
10258         "" /* expectedOutOutputString */,
10259         "" /* stderr */,
10260         true /*shouldFlushOutput*/);
10261 }
10262 
10263 // command-line expansion
test286_option_files()10264 public void test286_option_files() {
10265 	runNegativeTest(
10266 		new String[] {
10267 			"X.java",
10268 			"public @interface X {\n" +
10269 			"}",
10270 			"options.txt",
10271 			"-source 1.4"
10272 		},
10273         "\"" + OUTPUT_DIR +  File.separator + "X.java\" " +
10274         "\"@" + OUTPUT_DIR +  File.separator + "options.txt\"",
10275         "" /* expectedOutOutputString */,
10276         "----------\n" + /* stderr */
10277         "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
10278         "	public @interface X {\n" +
10279         "	                  ^\n" +
10280         "Syntax error, annotation declarations are only available if source level is 1.5 or greater\n" +
10281         "----------\n" +
10282         "1 problem (1 error)\n",
10283         true /*shouldFlushOutput*/);
10284 }
10285 // command-line expansion
10286 // shows that we don't recurse
test287_option_files()10287 public void test287_option_files() {
10288 	runNegativeTest(
10289 		new String[] {
10290 			"X.java",
10291 			"public @interface X {\n" +
10292 			"}",
10293 			"options1.txt",
10294 			"@options2.txt",
10295 			"options2.txt",
10296 			"@options1.txt"
10297 		},
10298         "\"" + OUTPUT_DIR +  File.separator + "X.java\" " +
10299         "\"@" + OUTPUT_DIR +  File.separator + "options1.txt\"",
10300         "" /* expectedOutOutputString */,
10301         "Unrecognized option : @options2.txt\n" /* stderr */,
10302         true /*shouldFlushOutput*/);
10303 }
10304 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=246066
test288_warn_options()10305 public void test288_warn_options() {
10306 	this.runConformTest(
10307 		new String[] {
10308 			"X.java",
10309 			"interface IX {}\n" +
10310 			"class BaseX implements IX {}\n" +
10311 			"public class X extends BaseX implements IX {\n" +
10312 			"}\n",
10313 		},
10314 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10315 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10316 		+ " -warn:+intfRedundant -proc:none -d \"" + OUTPUT_DIR + "\"",
10317 		"",
10318 		"----------\n" +
10319 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10320 		"	public class X extends BaseX implements IX {\n" +
10321 		"	                                        ^^\n" +
10322 		"Redundant superinterface IX for the type X, already defined by BaseX\n" +
10323 		"----------\n" +
10324 		"1 problem (1 warning)\n",
10325 		true);
10326 }
10327 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=246066 - variation
test289_warn_options()10328 public void test289_warn_options() {
10329 	this.runConformTest(
10330 		new String[] {
10331 			"X.java",
10332 			"interface IX {}\n" +
10333 			"class BaseX implements IX {}\n" +
10334 			"public class X extends BaseX implements IX {\n" +
10335 			"}\n",
10336 		},
10337 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10338 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10339 		+ " -warn:+redundantSuperinterface -proc:none -d \"" + OUTPUT_DIR + "\"",
10340 		"",
10341 		"----------\n" +
10342 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10343 		"	public class X extends BaseX implements IX {\n" +
10344 		"	                                        ^^\n" +
10345 		"Redundant superinterface IX for the type X, already defined by BaseX\n" +
10346 		"----------\n" +
10347 		"1 problem (1 warning)\n",
10348 		true);
10349 }
10350 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=246066 - variation
test290_warn_options()10351 public void test290_warn_options() {
10352 	this.runConformTest(
10353 		new String[] {
10354 			"X.java",
10355 			"interface IX {}\n" +
10356 			"class BaseX implements IX {}\n" +
10357 			"public class X extends BaseX implements IX {\n" +
10358 			"}\n",
10359 		},
10360 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10361 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10362 		+ " -warn:+intfRedundant -warn:-intfRedundant -proc:none -d \"" + OUTPUT_DIR + "\"",
10363 		"",
10364 		"",
10365 		true);
10366 }
10367 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=251079
test291_jar_ref_in_jar()10368 public void test291_jar_ref_in_jar() throws Exception {
10369 	ManifestAnalyzer analyzer = new ManifestAnalyzer();
10370 	assertTrue(analyzeManifestContents(
10371 		analyzer,
10372 		"Manifest-Version: 1.0\r\n" +
10373 		"Created-By: Eclipse JDT Test Harness\r\n" +
10374 		"Class-Path: \r\n" +
10375 		"\r\n"
10376 		));
10377 	List calledFileNames = analyzer.getCalledFileNames();
10378 	String actual = calledFileNames == null ? "<null>" : Util.toString((String[]) calledFileNames.toArray(new String[calledFileNames.size()]), false/*don't add extra new lines*/);
10379 	assertStringEquals(
10380 		"<null>",
10381 		actual,
10382 		true/*show line serators*/);
10383 }
10384 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=163194
10385 // -warn option - regression tests to check option allOver-ann
test292_warn_options()10386 public void test292_warn_options() {
10387 	this.runConformTest(
10388 		new String[] {
10389 			"X.java",
10390 			"interface A {\n" +
10391 			"  void m();\n" +
10392 			"}" +
10393 			"interface B extends A{\n" +
10394 			"  void m();\n" +
10395 			"}" +
10396 			"public class X implements A{\n" +
10397 			"  public void m(){}\n" +
10398 			"  public String toString(){return \"HelloWorld\";}\n" +
10399 			"}",
10400 		},
10401 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10402 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10403 		+ " -warn:allOver-ann -1.6 -proc:none -d \"" + OUTPUT_DIR + "\"",
10404 		"",
10405 		"----------\n" +
10406 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
10407 		"	void m();\n" +
10408 		"	     ^^^\n" +
10409 		"The method m() of type B should be tagged with @Override since it actually overrides a superinterface method\n" +
10410 		"----------\n" +
10411 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
10412 		"	public void m(){}\n" +
10413 		"	            ^^^\n"+
10414 		"The method m() of type X should be tagged with @Override since it actually overrides a superinterface method\n" +
10415 		"----------\n" +
10416 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
10417 		"	public String toString(){return \"HelloWorld\";}\n" +
10418 		"	              ^^^^^^^^^^\n" +
10419 		"The method toString() of type X should be tagged with @Override since it actually overrides a superclass method\n" +
10420 		"----------\n" +
10421 		"3 problems (3 warnings)\n",
10422 		true);
10423 }
10424 
10425 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342
10426 // -warn option - regression tests to check option includeAssertNull
10427 // Null problems arising from asserts should be reported here
10428 // since includeAssertNull is enabled
test293_warn_options()10429 public void test293_warn_options() {
10430 	this.runConformTest(
10431 		new String[] {
10432 			"X.java",
10433 			"public class X {\n" +
10434 			"	void foo(Object a, Object b, Object c) {\n" +
10435 			"		assert a == null;\n " +
10436 			"		if (a!=null) {\n" +
10437 			"			System.out.println(\"a is not null\");\n" +
10438 			"		 } else{\n" +
10439 			"			System.out.println(\"a is null\");\n" +
10440 			"		 }\n" +
10441 			"		a = null;\n" +
10442 			"		if (a== null) {}\n" +
10443 			"		assert b != null;\n " +
10444 			"		if (b!=null) {\n" +
10445 			"			System.out.println(\"b is not null\");\n" +
10446 			"		 } else{\n" +
10447 			"			System.out.println(\"b is null\");\n" +
10448 			"		 }\n" +
10449 			"		assert c == null;\n" +
10450 			"		if (c.equals(a)) {\n" +
10451 			"			System.out.println(\"\");\n" +
10452 			"		 } else{\n" +
10453 			"			System.out.println(\"\");\n" +
10454 			"		 }\n" +
10455 			"	}\n" +
10456 			"	public static void main(String[] args){\n" +
10457 			"		X test = new X();\n" +
10458 			"		test.foo(null,null, null);\n" +
10459 			"	}\n" +
10460 			"}\n",
10461 		},
10462 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10463 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10464 		+ " -warn:null,includeAssertNull -1.5 -proc:none -d \"" + OUTPUT_DIR + "\"",
10465 		"",
10466 		"----------\n" +
10467 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
10468 		"	if (a!=null) {\n" +
10469 		"	    ^\n" +
10470 		"Null comparison always yields false: The variable a can only be null at this location\n" +
10471 		"----------\n" +
10472 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 9)\n" +
10473 		"	a = null;\n" +
10474 		"	^\n" +
10475 		"Redundant assignment: The variable a can only be null at this location\n" +
10476 		"----------\n" +
10477 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 10)\n" +
10478 		"	if (a== null) {}\n" +
10479 		"	    ^\n" +
10480 		"Redundant null check: The variable a can only be null at this location\n" +
10481 		"----------\n" +
10482 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 12)\n" +
10483 		"	if (b!=null) {\n" +
10484 		"	    ^\n" +
10485 		"Redundant null check: The variable b cannot be null at this location\n" +
10486 		"----------\n" +
10487 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 18)\n" +
10488 		"	if (c.equals(a)) {\n" +
10489 		"	    ^\n" +
10490 		"Null pointer access: The variable c can only be null at this location\n" +
10491 		"----------\n" +
10492 		"5 problems (5 warnings)\n",
10493 		true);
10494 }
10495 
10496 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
10497 // -warn option - regression test to check option static-method
10498 // Method can be static warning should be given
test294_warn_options()10499 public void test294_warn_options() {
10500 	this.runConformTest(
10501 		new String[] {
10502 			"X.java",
10503 			"public class X {\n" +
10504 			"	public static int field1;\n" +
10505 			"	public static int field2;\n" +
10506 			"	public void bar(int i) {\n" +
10507 			"		System.out.println(foo());\n" +
10508 			"		foo();" +
10509 			"		System.out.println(X.field1);\n" +
10510 			"		System.out.println(field2);\n" +
10511 			"		field2 = 1;\n" +
10512 			"	}\n" +
10513 			"	private static String foo() {\n" +
10514 			"		return null;\n" +
10515 			"	}\n" +
10516 			"	private void foo1() {\n" +
10517 			"		System.out.println();\n" +
10518 			"	}\n" +
10519 			"	public final void foo2() {\n" +
10520 			"		System.out.println();\n" +
10521 			"	}\n" +
10522 			"}\n" +
10523 			"final class A {" +
10524 			"	public void foo() {\n" +
10525 			"		System.out.println();\n" +
10526 			"	}\n" +
10527 			"}\n",
10528 		},
10529 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10530 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10531 		+ " -warn:static-method -proc:none -d \"" + OUTPUT_DIR + "\"",
10532 		"",
10533 		"----------\n" +
10534 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
10535 		"	private void foo1() {\n" +
10536 		"	             ^^^^^^\n" +
10537 		"The method foo1() from the type X can be declared as static\n" +
10538 		"----------\n" +
10539 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 16)\n" +
10540 		"	public final void foo2() {\n" +
10541 		"	                  ^^^^^^\n" +
10542 		"The method foo2() from the type X can be declared as static\n" +
10543 		"----------\n" +
10544 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 20)\n" +
10545 		"	final class A {	public void foo() {\n" +
10546 		"	               	            ^^^^^\n" +
10547 		"The method foo() from the type A can be declared as static\n" +
10548 		"----------\n" +
10549 		"3 problems (3 warnings)\n",
10550 		true);
10551 }
10552 
10553 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
10554 // -warn option - regression test to check option all-static-method
10555 // Method can be static warning should be given
test295_warn_options()10556 public void test295_warn_options() {
10557 	this.runConformTest(
10558 		new String[] {
10559 			"X.java",
10560 			"public class X {\n" +
10561 			"	public static int field1;\n" +
10562 			"	public static int field2;\n" +
10563 			"	public void bar(int i) {\n" +
10564 			"		System.out.println(foo());\n" +
10565 			"		foo();" +
10566 			"		System.out.println(X.field1);\n" +
10567 			"		System.out.println(field2);\n" +
10568 			"		field2 = 1;\n" +
10569 			"	}\n" +
10570 			"	private static String foo() {\n" +
10571 			"		return null;\n" +
10572 			"	}\n" +
10573 			"	private void foo1() {\n" +
10574 			"		System.out.println();\n" +
10575 			"	}\n" +
10576 			"	public final void foo2() {\n" +
10577 			"		System.out.println();\n" +
10578 			"	}\n" +
10579 			"}\n" +
10580 			"final class A {" +
10581 			"	public void foo() {\n" +
10582 			"		System.out.println();\n" +
10583 			"	}\n" +
10584 			"}\n",
10585 		},
10586 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
10587 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
10588 		+ " -warn:all-static-method -proc:none -d \"" + OUTPUT_DIR + "\"",
10589 		"",
10590 		"----------\n" +
10591 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
10592 		"	public void bar(int i) {\n" +
10593 		"	            ^^^^^^^^^^\n" +
10594 		"The method bar(int) from the type X can potentially be declared as static\n" +
10595 		"----------\n" +
10596 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 13)\n" +
10597 		"	private void foo1() {\n" +
10598 		"	             ^^^^^^\n" +
10599 		"The method foo1() from the type X can be declared as static\n" +
10600 		"----------\n" +
10601 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 16)\n" +
10602 		"	public final void foo2() {\n" +
10603 		"	                  ^^^^^^\n" +
10604 		"The method foo2() from the type X can be declared as static\n" +
10605 		"----------\n" +
10606 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 20)\n" +
10607 		"	final class A {	public void foo() {\n" +
10608 		"	               	            ^^^^^\n" +
10609 		"The method foo() from the type A can be declared as static\n" +
10610 		"----------\n" +
10611 		"4 problems (4 warnings)\n",
10612 		true);
10613 }
10614 
10615 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784
test293()10616 public void test293(){
10617 	createCascadedJars();
10618 	this.runNegativeTest(
10619 		new String[] {
10620 			"src/p/X.java",
10621 			"package p;\n" +
10622 			"/** */\n" +
10623 			"public class X {\n" +
10624 			"  A a;\n" +
10625 			"}",
10626 		},
10627 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
10628 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar[~p/A]\""
10629 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
10630 		+ " -1.5 -g -preserveAllLocals"
10631 		+ " -proceedOnError -referenceInfo -err:+discouraged"
10632 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
10633 		"",
10634 		"----------\n" +
10635 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
10636 		"	A a;\n" +
10637 		"	^\n" +
10638 		"Discouraged access: The type \'A\' is not API (restriction on classpath entry \'---LIB_DIR_PLACEHOLDER---/lib3.jar\')\n" +
10639 		"----------\n" +
10640 		"1 problem (1 error)\n",
10641 		true);
10642 }
10643 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784
test294()10644 public void test294(){
10645 	this.runConformTest(
10646 		new String[] {
10647 			"src/X.java",
10648 			"public class X {\n" +
10649 			"}",
10650 		},
10651 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
10652 		+ " -cp \"" + LIB_DIR + "\""
10653 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
10654 		+ " -1.5 -g -preserveAllLocals"
10655 		+ " -proceedOnError -referenceInfo -err:+discouraged2"
10656 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
10657 		"",
10658 		"invalid error token: \'discouraged2\'. Ignoring this error token and compiling\n",
10659 		true);
10660 }
10661 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784
test296()10662 public void test296(){
10663 	this.runNegativeTest(
10664 		new String[] {
10665 			"src/X.java",
10666 			"public class X {\n" +
10667 			"}",
10668 		},
10669 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
10670 		+ " -cp \"" + LIB_DIR + "\""
10671 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
10672 		+ " -1.5 -g -preserveAllLocals"
10673 		+ " -proceedOnError -referenceInfo -err:"
10674 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
10675 		"",
10676 		"invalid error configuration: \'-err:\'\n",
10677 		true);
10678 }
10679 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784
test297()10680 public void test297(){
10681 	this.runNegativeTest(
10682 		new String[] {
10683 			"src/X.java",
10684 			"public class X {\n" +
10685 			"}",
10686 		},
10687 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
10688 		+ " -cp \"" + LIB_DIR + "\""
10689 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
10690 		+ " -1.5 -g -preserveAllLocals"
10691 		+ " -proceedOnError -referenceInfo -err"
10692 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
10693 		"",
10694 		"invalid error configuration: \'-err\'\n",
10695 		true);
10696 }
10697 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test298()10698 public void test298(){
10699 	this.runConformTest(
10700 		new String[] {
10701 			"X.java",
10702 			"public class X {\n" +
10703 			"	@SuppressWarnings(\"unused\")\n" +
10704 			"	private int i;\n" +
10705 			"}",
10706 		},
10707 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10708 		+ " -1.5 -g -preserveAllLocals"
10709 		+ " -proceedOnError -err:+unused,suppress -d \"" + OUTPUT_DIR + "\"",
10710 		"",
10711 		"",
10712 		true);
10713 }
10714 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test299()10715 public void test299(){
10716 	this.runNegativeTest(
10717 		new String[] {
10718 			"X.java",
10719 			"public class X {\n" +
10720 			"	@SuppressWarnings(\"unused\")\n" +
10721 			"	private int i;\n" +
10722 			"}",
10723 		},
10724 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10725 		+ " -1.5 -g -preserveAllLocals"
10726 		+ " -proceedOnError -err:+unused -d \"" + OUTPUT_DIR + "\"",
10727 		"",
10728 		"----------\n" +
10729 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
10730 		"	@SuppressWarnings(\"unused\")\n" +
10731 		"	                  ^^^^^^^^\n" +
10732 		"Unnecessary @SuppressWarnings(\"unused\")\n" +
10733 		"----------\n" +
10734 		"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10735 		"	private int i;\n" +
10736 		"	            ^\n" +
10737 		"The value of the field X.i is not used\n" +
10738 		"----------\n" +
10739 		"2 problems (1 error, 1 warning)\n",
10740 		true);
10741 }
10742 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test300()10743 public void test300(){
10744 	this.runConformTest(
10745 		new String[] {
10746 			"X.java",
10747 			"public class X {\n" +
10748 			"	@SuppressWarnings(\"unused\")\n" +
10749 			"	private int i;\n" +
10750 			"}",
10751 		},
10752 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10753 		+ " -1.5 -g -preserveAllLocals"
10754 		+ " -proceedOnError -warn:-suppress -err:+suppress,unused -d \"" + OUTPUT_DIR + "\"",
10755 		"",
10756 		"",
10757 		true);
10758 }
10759 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test301()10760 public void test301(){
10761 	this.runNegativeTest(
10762 		new String[] {
10763 			"X.java",
10764 			"public class X {\n" +
10765 			"	@SuppressWarnings(\"unused\")\n" +
10766 			"	private int i;\n" +
10767 			"}",
10768 		},
10769 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10770 		+ " -1.5 -g -preserveAllLocals"
10771 		+ " -proceedOnError -warn:-suppress -err:+unused -d \"" + OUTPUT_DIR + "\"",
10772 		"",
10773 		"----------\n" +
10774 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10775 		"	private int i;\n" +
10776 		"	            ^\n" +
10777 		"The value of the field X.i is not used\n" +
10778 		"----------\n" +
10779 		"1 problem (1 error)\n",
10780 		true);
10781 }
10782 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test302()10783 public void test302(){
10784 	this.runNegativeTest(
10785 		new String[] {
10786 			"X.java",
10787 			"public class X {\n" +
10788 			"	@SuppressWarnings(\"unused\")\n" +
10789 			"	private int i;\n" +
10790 			"}",
10791 		},
10792 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10793 		+ " -1.5 -g -preserveAllLocals"
10794 		+ " -proceedOnError -warn:-suppress -err:+suppress,unused -warn:-suppress -d \"" + OUTPUT_DIR + "\"",
10795 		"",
10796 		"----------\n" +
10797 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10798 		"	private int i;\n" +
10799 		"	            ^\n" +
10800 		"The value of the field X.i is not used\n" +
10801 		"----------\n" +
10802 		"1 problem (1 error)\n",
10803 		true);
10804 }
10805 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test303()10806 public void test303(){
10807 	this.runNegativeTest(
10808 		new String[] {
10809 			"X.java",
10810 			"public class X {\n" +
10811 			"	@SuppressWarnings(\"unused\")\n" +
10812 			"	private int i;\n" +
10813 			"}",
10814 		},
10815 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10816 		+ " -1.5 -g -preserveAllLocals"
10817 		+ " -proceedOnError -warn:-suppress -err:+suppress,unused -warn:+suppress -d \"" + OUTPUT_DIR + "\"",
10818 		"",
10819 		"----------\n" +
10820 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
10821 		"	@SuppressWarnings(\"unused\")\n" +
10822 		"	                  ^^^^^^^^\n" +
10823 		"Unnecessary @SuppressWarnings(\"unused\")\n" +
10824 		"----------\n" +
10825 		"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10826 		"	private int i;\n" +
10827 		"	            ^\n" +
10828 		"The value of the field X.i is not used\n" +
10829 		"----------\n" +
10830 		"2 problems (1 error, 1 warning)\n",
10831 		true);
10832 }
10833 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551
test304()10834 public void test304(){
10835 	this.runNegativeTest(
10836 		new String[] {
10837 			"X.java",
10838 			"public class X {\n" +
10839 			"	@SuppressWarnings(\"unused\")\n" +
10840 			"	private int i;\n" +
10841 			"}",
10842 		},
10843 		"\"" + OUTPUT_DIR + File.separator + "X.java\""
10844 		+ " -1.5 -g -preserveAllLocals"
10845 		+ " -proceedOnError -err:+suppress,unused -warn:-suppress -d \"" + OUTPUT_DIR + "\"",
10846 		"",
10847 		"----------\n" +
10848 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10849 		"	private int i;\n" +
10850 		"	            ^\n" +
10851 		"The value of the field X.i is not used\n" +
10852 		"----------\n" +
10853 		"1 problem (1 error)\n",
10854 		true);
10855 }
10856 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=310330
test305()10857 public void test305(){
10858 	this.runConformTest(
10859 		new String[] {
10860 			"src/X.java",
10861 			"public class X {}",
10862 		},
10863 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
10864 		+ " -encoding UTF-8 -1.5 -g -encoding ISO-8859-1",
10865 		"Found encoding ISO-8859-1. A different encoding was specified: UTF-8\n" +
10866 		"Multiple encoding specified: ISO-8859-1, UTF-8. The default encoding has been set to ISO-8859-1\n",
10867 		"",
10868 		true);
10869 }
10870 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=310330
test306()10871 public void test306(){
10872 	this.runConformTest(
10873 		new String[] {
10874 			"src/X.java",
10875 			"public class X {}",
10876 		},
10877 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
10878 		+ " -encoding UTF-8 -1.5 -encoding Cp1252 -g -encoding ISO-8859-1",
10879 		"Found encoding Cp1252. A different encoding was specified: UTF-8\n" +
10880 		"Found encoding ISO-8859-1. Different encodings were specified: Cp1252, UTF-8\n" +
10881 		"Multiple encoding specified: Cp1252, ISO-8859-1, UTF-8. The default encoding has been set to ISO-8859-1\n",
10882 		"",
10883 		true);
10884 }
10885 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115
test0307()10886 public void test0307(){
10887 	String os= System.getProperty("os.name");
10888     if (!os.startsWith("Windows")) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558
10889     	return;
10890 
10891 	final String javaClassspath = System.getProperty("java.class.path");
10892 	final String javaUserDir = System.getProperty("user.dir");
10893 	try {
10894 		System.setProperty("user.dir", OUTPUT_DIR);
10895 		this.runConformTest(
10896 			new String[] {
10897 				"p/Y.java",
10898 				"package p;\n" +
10899 				"public class Y { public class I {}; }",
10900 			},
10901 	        "\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "Y.java\""
10902 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
10903 	        "",
10904 	        "",
10905 	        true);
10906 		System.setProperty("java.class.path", "");
10907 		this.runConformTest(
10908 				new String[] {
10909 					"X.java",
10910 					"import p.Y.I;\n" +
10911 					"public class X {\n" +
10912 					"   I i;\n" +
10913 					"	public static void main(String[] args) {\n" +
10914 					"		System.out.print(\"\");\n" +
10915 					"	}\n" +
10916 					"}",
10917 				},
10918 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
10919 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
10920 		        "",// this is not the runtime output
10921 		        "no classpath defined, using default directory instead\n",
10922 		        false);
10923 		final String userDir = System.getProperty("user.dir");
10924 		File f = new File(userDir, "X.java");
10925 		if (!Util.delete(f)) {
10926 			System.out.println("Could not delete X");
10927 		}
10928 		f = new File(userDir, "p" + File.separator + "Y.java");
10929 		if (!Util.delete(f)) {
10930 			System.out.println("Could not delete Y");
10931 		}
10932 
10933 	} finally {
10934 		System.setProperty("java.class.path", javaClassspath);
10935 		System.setProperty("user.dir", javaUserDir);
10936 	}
10937 }
10938 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115
test0307a()10939 public void test0307a(){
10940 	String os= System.getProperty("os.name");
10941     if (!os.startsWith("Windows")) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558
10942     	return;
10943 
10944 	final String javaClassspath = System.getProperty("java.class.path");
10945 	final String javaUserDir = System.getProperty("user.dir");
10946 	try {
10947 		System.setProperty("user.dir", OUTPUT_DIR);
10948 		this.runConformTest(
10949 			new String[] {
10950 				"P/Y.java",
10951 				"package P;\n" +
10952 				"public class Y { public class I {}; }",
10953 			},
10954 	        "\"" + OUTPUT_DIR +  File.separator + "P" + File.separator + "Y.java\""
10955 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
10956 	        "",
10957 	        "",
10958 	        true);
10959 		System.setProperty("java.class.path", "");
10960 		this.runNegativeTest(
10961 				new String[] {
10962 					"X.java",
10963 					"import p.Y.I;\n" +
10964 					"public class X {\n" +
10965 					"   I i;\n" +
10966 					"	public static void main(String[] args) {\n" +
10967 					"		System.out.print(\"\");\n" +
10968 					"	}\n" +
10969 					"}",
10970 				},
10971 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
10972 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
10973 		        "",// this is not the runtime output
10974 		        "no classpath defined, using default directory instead\n" +
10975 		        "----------\n" +
10976 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
10977 		        "	import p.Y.I;\n" +
10978 		        "	       ^^^\n" +
10979 		        "The import p.Y cannot be resolved\n" +
10980 		        "----------\n" +
10981 		        "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
10982 		        "	I i;\n" +
10983 		        "	^\n" +
10984 		        "I cannot be resolved to a type\n" +
10985 		        "----------\n" +
10986 		        "2 problems (2 errors)\n",
10987 		        false);
10988 		final String userDir = System.getProperty("user.dir");
10989 		File f = new File(userDir, "X.java");
10990 		if (!Util.delete(f)) {
10991 			System.out.println("Could not delete X");
10992 		}
10993 		f = new File(userDir, "p" + File.separator + "Y.java");
10994 		if (!Util.delete(f)) {
10995 			System.out.println("Could not delete Y");
10996 		}
10997 
10998 	} finally {
10999 		System.setProperty("java.class.path", javaClassspath);
11000 		System.setProperty("user.dir", javaUserDir);
11001 	}
11002 }
11003 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115
test0307b()11004 public void test0307b(){
11005 	String os= System.getProperty("os.name");
11006     if (!os.startsWith("Windows")) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558
11007     	return;
11008 
11009 	final String javaClassspath = System.getProperty("java.class.path");
11010 	final String javaUserDir = System.getProperty("user.dir");
11011 	try {
11012 		System.setProperty("user.dir", OUTPUT_DIR);
11013 		this.runConformTest(
11014 			new String[] {
11015 				"p/y.java",
11016 				"package p;\n" +
11017 				"public class y { public class I {}; }",
11018 			},
11019 	        "\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "y.java\""
11020 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11021 	        "",
11022 	        "",
11023 	        true);
11024 		System.setProperty("java.class.path", "");
11025 		this.runNegativeTest(
11026 				new String[] {
11027 					"X.java",
11028 					"import p.Y.I;\n" +
11029 					"public class X {\n" +
11030 					"   I i;\n" +
11031 					"	public static void main(String[] args) {\n" +
11032 					"		System.out.print(\"\");\n" +
11033 					"	}\n" +
11034 					"}",
11035 				},
11036 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
11037 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11038 		        "",// this is not the runtime output
11039 		        "no classpath defined, using default directory instead\n" +
11040 		        "----------\n" +
11041 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
11042 		        "	import p.Y.I;\n" +
11043 		        "	       ^^^\n" +
11044 		        "The import p.Y cannot be resolved\n" +
11045 		        "----------\n" +
11046 		        "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
11047 		        "	I i;\n" +
11048 		        "	^\n" +
11049 		        "I cannot be resolved to a type\n" +
11050 		        "----------\n" +
11051 		        "2 problems (2 errors)\n",
11052 		        false);
11053 		final String userDir = System.getProperty("user.dir");
11054 		File f = new File(userDir, "X.java");
11055 		if (!Util.delete(f)) {
11056 			System.out.println("Could not delete X");
11057 		}
11058 		f = new File(userDir, "p" + File.separator + "Y.java");
11059 		if (!Util.delete(f)) {
11060 			System.out.println("Could not delete Y");
11061 		}
11062 
11063 	} finally {
11064 		System.setProperty("java.class.path", javaClassspath);
11065 		System.setProperty("user.dir", javaUserDir);
11066 	}
11067 }
11068 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115
test0307c()11069 public void test0307c(){
11070 	String os= System.getProperty("os.name");
11071     if (!os.startsWith("Windows")) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558
11072     	return;
11073 
11074 	final String javaClassspath = System.getProperty("java.class.path");
11075 	final String javaUserDir = System.getProperty("user.dir");
11076 	try {
11077 		System.setProperty("user.dir", OUTPUT_DIR);
11078 		this.runConformTest(
11079 			new String[] {
11080 				"p/Y.java",
11081 				"package p;\n" +
11082 				"public class Y { public class i {}; }",
11083 			},
11084 	        "\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "Y.java\""
11085 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11086 	        "",
11087 	        "",
11088 	        true);
11089 		System.setProperty("java.class.path", "");
11090 		this.runNegativeTest(
11091 				new String[] {
11092 					"X.java",
11093 					"import p.Y.I;\n" +
11094 					"public class X {\n" +
11095 					"   I i;\n" +
11096 					"	public static void main(String[] args) {\n" +
11097 					"		System.out.print(\"\");\n" +
11098 					"	}\n" +
11099 					"}",
11100 				},
11101 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
11102 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11103 		        "",// this is not the runtime output
11104 		        "no classpath defined, using default directory instead\n" +
11105 		        "----------\n" +
11106 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
11107 		        "	import p.Y.I;\n" +
11108 		        "	       ^^^^^\n" +
11109 		        "The import p.Y.I cannot be resolved\n" +
11110 		        "----------\n" +
11111 		        "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
11112 		        "	I i;\n" +
11113 		        "	^\n" +
11114 		        "I cannot be resolved to a type\n" +
11115 		        "----------\n" +
11116 		        "2 problems (2 errors)\n",
11117 		        false);
11118 		final String userDir = System.getProperty("user.dir");
11119 		File f = new File(userDir, "X.java");
11120 		if (!Util.delete(f)) {
11121 			System.out.println("Could not delete X");
11122 		}
11123 		f = new File(userDir, "p" + File.separator + "Y.java");
11124 		if (!Util.delete(f)) {
11125 			System.out.println("Could not delete Y");
11126 		}
11127 
11128 	} finally {
11129 		System.setProperty("java.class.path", javaClassspath);
11130 		System.setProperty("user.dir", javaUserDir);
11131 	}
11132 }
11133 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115
test0307d()11134 public void test0307d(){
11135 	String os= System.getProperty("os.name");
11136     if (!os.startsWith("Windows")) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558
11137     	return;
11138 
11139 	final String javaClassspath = System.getProperty("java.class.path");
11140 	final String javaUserDir = System.getProperty("user.dir");
11141 	try {
11142 		System.setProperty("user.dir", OUTPUT_DIR);
11143 		this.runConformTest(
11144 			new String[] {
11145 				"p/Y.java",
11146 				"package P;\n" +
11147 				"public class Y { public class I {}; }",
11148 			},
11149 	        "\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "Y.java\""
11150 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11151 	        "",
11152 	        "",
11153 	        true);
11154 		System.setProperty("java.class.path", "");
11155 		this.runNegativeTest(
11156 				new String[] {
11157 					"X.java",
11158 					"import p.Y.I;\n" +
11159 					"public class X {\n" +
11160 					"   I i;\n" +
11161 					"	public static void main(String[] args) {\n" +
11162 					"		System.out.print(\"\");\n" +
11163 					"	}\n" +
11164 					"}",
11165 				},
11166 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
11167 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11168 		        "",// this is not the runtime output
11169 		        "no classpath defined, using default directory instead\n" +
11170 		        "----------\n" +
11171 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
11172 		        "	import p.Y.I;\n" +
11173 		        "	       ^^^\n" +
11174 		        "The import p.Y cannot be resolved\n" +
11175 		        "----------\n" +
11176 		        "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
11177 		        "	I i;\n" +
11178 		        "	^\n" +
11179 		        "I cannot be resolved to a type\n" +
11180 		        "----------\n" +
11181 		        "2 problems (2 errors)\n",
11182 		        false);
11183 		final String userDir = System.getProperty("user.dir");
11184 		File f = new File(userDir, "X.java");
11185 		if (!Util.delete(f)) {
11186 			System.out.println("Could not delete X");
11187 		}
11188 		f = new File(userDir, "p" + File.separator + "Y.java");
11189 		if (!Util.delete(f)) {
11190 			System.out.println("Could not delete Y");
11191 		}
11192 
11193 	} finally {
11194 		System.setProperty("java.class.path", javaClassspath);
11195 		System.setProperty("user.dir", javaUserDir);
11196 	}
11197 }
11198 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115
test0307e()11199 public void test0307e(){
11200 	String os= System.getProperty("os.name");
11201     if (!os.startsWith("Windows")) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558
11202     	return;
11203 
11204 	final String javaClassspath = System.getProperty("java.class.path");
11205 	final String javaUserDir = System.getProperty("user.dir");
11206 	try {
11207 		System.setProperty("user.dir", OUTPUT_DIR);
11208 		this.runConformTest(
11209 			new String[] {
11210 				"p/Y.java",
11211 				"package P;\n" +
11212 				"public class Y { public class I {}; }",
11213 			},
11214 	        "\"" + OUTPUT_DIR +  File.separator + "P" + File.separator + "Y.java\""
11215 	        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11216 	        "",
11217 	        "",
11218 	        true);
11219 		System.setProperty("java.class.path", "");
11220 		this.runNegativeTest(
11221 				new String[] {
11222 					"X.java",
11223 					"import p.Y.I;\n" +
11224 					"public class X {\n" +
11225 					"   I i;\n" +
11226 					"	public static void main(String[] args) {\n" +
11227 					"		System.out.print(\"\");\n" +
11228 					"	}\n" +
11229 					"}",
11230 				},
11231 		        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
11232 		        + " -1.5 -g -preserveAllLocals -proceedOnError -referenceInfo ",
11233 		        "",// this is not the runtime output
11234 		        "no classpath defined, using default directory instead\n" +
11235 		        "----------\n" +
11236 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
11237 		        "	import p.Y.I;\n" +
11238 		        "	       ^^^\n" +
11239 		        "The import p.Y cannot be resolved\n" +
11240 		        "----------\n" +
11241 		        "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
11242 		        "	I i;\n" +
11243 		        "	^\n" +
11244 		        "I cannot be resolved to a type\n" +
11245 		        "----------\n" +
11246 		        "2 problems (2 errors)\n",
11247 		        false);
11248 		final String userDir = System.getProperty("user.dir");
11249 		File f = new File(userDir, "X.java");
11250 		if (!Util.delete(f)) {
11251 			System.out.println("Could not delete X");
11252 		}
11253 		f = new File(userDir, "p" + File.separator + "Y.java");
11254 		if (!Util.delete(f)) {
11255 			System.out.println("Could not delete Y");
11256 		}
11257 
11258 	} finally {
11259 		System.setProperty("java.class.path", javaClassspath);
11260 		System.setProperty("user.dir", javaUserDir);
11261 	}
11262 }
11263 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775 - Compiler fails to warn about invalid cast in 1.4 mode.
testInferenceIn14Project()11264 public void testInferenceIn14Project(){
11265 	String currentWorkingDirectoryPath = System.getProperty("user.dir");
11266 	if (currentWorkingDirectoryPath == null) {
11267 		fail("BatchCompilerTest#testInference14 could not access the current working directory " + currentWorkingDirectoryPath);
11268 	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
11269 		fail("BatchCompilerTest#testInference14 current working directory is not a directory " + currentWorkingDirectoryPath);
11270 	}
11271 	String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar";
11272 	try {
11273 		Util.createJar(
11274 				new String[] {
11275 						"Bundle.java",
11276 						"public class Bundle {\n" +
11277 						"    static <A> A adapt(Class<A> type) {\n" +
11278 						"        return null;\n" +
11279 						"    }\n" +
11280 						"}"
11281 				},
11282 				null,
11283 				lib1Path,
11284 				JavaCore.VERSION_1_5);
11285 		this.runNegativeTest(
11286 				new String[] {
11287 						"src/X.java",
11288 						"public class X {\n" +
11289 						"    Bundle b = Bundle.adapt(BundleWiring.class);\n" +
11290 						"}\n" +
11291 						"class BundleWiring {}\n",
11292 				},
11293 				"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
11294 				+ " -cp lib1.jar" // relative
11295 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
11296 				+ " -1.4 -g -preserveAllLocals"
11297 				+ " -proceedOnError -referenceInfo"
11298 				+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
11299 		        "",
11300 		        "----------\n" +
11301 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/X.java (at line 2)\n" +
11302 		        "	Bundle b = Bundle.adapt(BundleWiring.class);\n" +
11303 		        "	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
11304 		        "Type mismatch: cannot convert from Object to Bundle\n" +
11305 		        "----------\n" +
11306 		        "1 problem (1 error)\n",
11307 		        true);
11308 	} catch (IOException e) {
11309 		System.err.println("BatchCompilerTest#testInference14 could not write to current working directory " + currentWorkingDirectoryPath);
11310 	} finally {
11311 		new File(lib1Path).delete();
11312 	}
11313 }
11314 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775 - Compiler fails to warn about invalid cast in 1.4 mode.
testInferenceIn15Project()11315 public void testInferenceIn15Project(){  // ensure 1.5 complains too
11316 	String currentWorkingDirectoryPath = System.getProperty("user.dir");
11317 	if (currentWorkingDirectoryPath == null) {
11318 		fail("BatchCompilerTest#testInference14 could not access the current working directory " + currentWorkingDirectoryPath);
11319 	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
11320 		fail("BatchCompilerTest#testInference14 current working directory is not a directory " + currentWorkingDirectoryPath);
11321 	}
11322 	String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar";
11323 	try {
11324 		Util.createJar(
11325 				new String[] {
11326 						"Bundle.java",
11327 						"public class Bundle {\n" +
11328 						"    static <A> A adapt(Class<A> type) {\n" +
11329 						"        return null;\n" +
11330 						"    }\n" +
11331 						"}"
11332 				},
11333 				null,
11334 				lib1Path,
11335 				JavaCore.VERSION_1_5);
11336 		this.runNegativeTest(
11337 				new String[] {
11338 						"src/X.java",
11339 						"public class X {\n" +
11340 						"    Bundle b = Bundle.adapt(BundleWiring.class);\n" +
11341 						"}\n" +
11342 						"class BundleWiring {}\n",
11343 				},
11344 				"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
11345 				+ " -cp lib1.jar" // relative
11346 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
11347 				+ " -1.5 -g -preserveAllLocals"
11348 				+ " -proceedOnError -referenceInfo"
11349 				+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
11350 		        "",
11351 		        "----------\n" +
11352 		        "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/X.java (at line 2)\n" +
11353 		        "	Bundle b = Bundle.adapt(BundleWiring.class);\n" +
11354 		        "	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
11355 		        "Type mismatch: cannot convert from BundleWiring to Bundle\n" +
11356 		        "----------\n" +
11357 		        "1 problem (1 error)\n",
11358 		        true);
11359 	} catch (IOException e) {
11360 		System.err.println("BatchCompilerTest#testInference14 could not write to current working directory " + currentWorkingDirectoryPath);
11361 	} finally {
11362 		new File(lib1Path).delete();
11363 	}
11364 }
11365 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565 Test interaction between 1.4 and 1.5 class files
test186565()11366 public void test186565(){
11367 	String outputDirName = OUTPUT_DIR + File.separator + "d",
11368 	  metaInfDirName = outputDirName + File.separator + "META-INF",
11369 	  jarFileName = outputDirName + File.separator + "classB15.jar";
11370 	this.runConformTest(
11371 		new String[] {
11372 			"d/B.java",
11373 			"public class B<T> extends A<T> {\n" +
11374 			"}",
11375 			"d/A.java",
11376 			"public class A<T> {\n" +
11377 			"}",
11378 			},
11379 	    "\"" + outputDirName + "\""
11380 	    + " -1.5 -g -preserveAllLocals"
11381 	    + " -d \"" + outputDirName + "\"",
11382 		"",
11383 		"",
11384 		true /* flush output directory */);
11385 	File outputDirectory = new File(outputDirName);
11386 	File metaInfDirectory = new File(metaInfDirName);
11387 	metaInfDirectory.mkdirs();
11388 	try {
11389 		Util.createFile(metaInfDirName + File.separator + "MANIFEST.MF",
11390 			"Manifest-Version: 1.0\n" +
11391 			"Class-Path: ../d/classB15.jar\n");
11392 	} catch (IOException e) {
11393 		fail("could not create manifest file");
11394 	}
11395 	Util.delete(outputDirName + File.separator + "A.class");
11396 	Util.delete(outputDirName + File.separator + "A.java");
11397 	try {
11398 		Util.zip(outputDirectory, jarFileName);
11399 	} catch (IOException e) {
11400 		fail("could not create jar file");
11401 	}
11402 	Util.delete(outputDirName + File.separator + "B.class");
11403 	Util.delete(outputDirName + File.separator + "B.java");
11404 	this.runConformTest(
11405 		new String[] {
11406 			"d/A.java",
11407 			"public class A {\n" +
11408 			"}",
11409 			"d/C.java",
11410 			"public class C extends B<String> {\n" +
11411 			"}",
11412 			},
11413 	    "\"" + outputDirName + "\""
11414 	    + " -1.5 -g -preserveAllLocals"
11415 	    + " -cp \"" + jarFileName + "\""
11416 	    + " -d \"" + OUTPUT_DIR + "\"",
11417 		"",
11418 		"",
11419 		false /* do not flush output directory */);
11420 }
11421 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330347 - Test retention of bridge methods.
testBridgeMethodRetention()11422 public void testBridgeMethodRetention(){
11423 	String currentWorkingDirectoryPath = System.getProperty("user.dir");
11424 	if (currentWorkingDirectoryPath == null) {
11425 		fail("BatchCompilerTest#testBridgeMethodRetention could not access the current working directory " + currentWorkingDirectoryPath);
11426 	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
11427 		fail("BatchCompilerTest#testBridgeMethodRetention current working directory is not a directory " + currentWorkingDirectoryPath);
11428 	}
11429 	String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar";
11430 	try {
11431 		Util.createJar(
11432 				new String[] {
11433 						"Comparable.java",
11434 						"public interface Comparable<T> {\n" +
11435 						"    public int compareTo(T o);\n" +
11436 						"}\n",
11437 						"Character.java",
11438 						"public class Character implements Comparable<Character> {\n" +
11439 						"	public int compareTo(Character obj) {\n" +
11440 						"		return 0;\n" +
11441 						"	}\n" +
11442 						"}\n"
11443 				},
11444 				null,
11445 				lib1Path,
11446 				JavaCore.VERSION_1_5);
11447 		this.runConformTest(
11448 				new String[] {
11449 						"src/X.java",
11450 						"public class X {\n" +
11451 						"    Object fValue;\n" +
11452 						"    public int compareTo(Object obj) {\n" +
11453 						"            return ((Character)fValue).compareTo(obj);\n" +
11454 						"    }\n" +
11455 						"}\n",
11456 				},
11457 				"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
11458 				+ " -cp lib1.jar" // relative
11459 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
11460 				+ " -1.4 -g -preserveAllLocals"
11461 				+ " -proceedOnError -referenceInfo"
11462 				+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
11463 		        "",
11464 		        "",
11465 		        true);
11466 	} catch (IOException e) {
11467 		System.err.println("BatchCompilerTest#testBridgeMethodRetention could not write to current working directory " + currentWorkingDirectoryPath);
11468 	} finally {
11469 		new File(lib1Path).delete();
11470 	}
11471 }
11472 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322817 -- with new option kicking in
testReportingUnavoidableGenericProblems()11473 public void testReportingUnavoidableGenericProblems() {
11474 	this.runNegativeTest(
11475 		new String[] {
11476 			"X.java",
11477 			"interface Adaptable {\n" +
11478 			"    public Object getAdapter(Class clazz);    \n" +
11479 			"}\n" +
11480 			"public class X implements Adaptable {\n" +
11481 			"    public Object getAdapter(Class clazz) {\n" +
11482 			"        return null;\n" +
11483 			"    }\n" +
11484 			"    Zork z;\n" +
11485 			"}\n"
11486 		},
11487 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11488 		+ " -1.5 -warn:-unavoidableGenericProblems -proc:none -d \"" + OUTPUT_DIR + "\"",
11489 		"",
11490 		"----------\n" +
11491 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
11492 		"	public Object getAdapter(Class clazz);    \n" +
11493 		"	                         ^^^^^\n" +
11494 		"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
11495 		"----------\n" +
11496 		"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 8)\n" +
11497 		"	Zork z;\n" +
11498 		"	^^^^\n" +
11499 		"Zork cannot be resolved to a type\n" +
11500 		"----------\n" +
11501 		"2 problems (1 error, 1 warning)\n",
11502 		true);
11503 }
11504 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322817  -- without new option kicking in
testReportingUnavoidableGenericProblems2()11505 public void testReportingUnavoidableGenericProblems2() {
11506 	this.runNegativeTest(
11507 		new String[] {
11508 			"X.java",
11509 			"interface Adaptable {\n" +
11510 			"    public Object getAdapter(Class clazz);    \n" +
11511 			"}\n" +
11512 			"public class X implements Adaptable {\n" +
11513 			"    public Object getAdapter(Class clazz) {\n" +
11514 			"        return null;\n" +
11515 			"    }\n" +
11516 			"    Zork z;\n" +
11517 			"}\n"
11518 		},
11519 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11520 		+ " -1.5 -warn:+unavoidableGenericProblems -proc:none -d \"" + OUTPUT_DIR + "\"",
11521 		"",
11522 		"----------\n" +
11523 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
11524 		"	public Object getAdapter(Class clazz);    \n" +
11525 		"	                         ^^^^^\n" +
11526 		"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
11527 		"----------\n" +
11528 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
11529 		"	public Object getAdapter(Class clazz) {\n" +
11530 		"	                         ^^^^^\n" +
11531 		"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
11532 		"----------\n" +
11533 		"3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 8)\n" +
11534 		"	Zork z;\n" +
11535 		"	^^^^\n" +
11536 		"Zork cannot be resolved to a type\n" +
11537 		"----------\n" +
11538 		"3 problems (1 error, 2 warnings)\n",
11539 		true);
11540 }
11541 //-warn option - regression tests
test0308_warn_options()11542 public void test0308_warn_options() {
11543 	// check the option introduced in bug 359721
11544 	this.runConformTest(
11545 		new String[] {
11546 			"X.java",
11547 			"import java.io.FileReader;\n" +
11548 			"public class X {\n" +
11549 			"  void foo() throws java.io.IOException {\n" +
11550 			"      FileReader r = new FileReader(\"f1\");\n" +
11551 			"      char[] cs = new char[1024];\n" +
11552 			"	   r.read(cs);\n" +
11553 			"  }\n" +
11554 			"}\n"
11555 		},
11556 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11557 		+ " -warn:-resource -1.7 -d \"" + OUTPUT_DIR + "\"",
11558 		"",
11559 		"",
11560 		true);
11561 }
11562 //-warn option - regression tests
test0309_warn_options()11563 public void test0309_warn_options() {
11564 	// check the option introduced in bug 359721
11565 	this.runConformTest(
11566 		new String[] {
11567 			"X.java",
11568 			"import java.io.FileReader;\n" +
11569 			"public class X {\n" +
11570 			"  void foo(boolean b) throws java.io.IOException {\n" +
11571 			"      FileReader r = new FileReader(\"f1\");\n" +
11572 			"      char[] cs = new char[1024];\n" +
11573 			"	   r.read(cs);\n" +
11574 			"      if (b) r.close();\n" +
11575 			"  }\n" +
11576 			"}\n"
11577 		},
11578 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11579 		+ " -warn:+resource -1.7 -d \"" + OUTPUT_DIR + "\"",
11580 		"",
11581 		"----------\n" +
11582 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" +
11583 		"	FileReader r = new FileReader(\"f1\");\n" +
11584 		"	           ^\n" +
11585 		"Potential resource leak: \'r\' may not be closed\n" +
11586 		"----------\n" +
11587 		"1 problem (1 warning)\n",
11588 		true);
11589 }
11590 
11591 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366829
11592 // -warn option - regression test to check option syncOverride
11593 // Warning when when a class overrides a synchronized method without synchronizing it
test310_warn_options()11594 public void test310_warn_options() {
11595 	this.runConformTest(
11596 		new String[] {
11597 			"X.java",
11598 			"class X { synchronized void foo() {} }\n" +
11599 			"class Y extends X { @Override void foo() { } }"
11600 		},
11601 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11602 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
11603 		+ " -warn:syncOverride -1.5 -proc:none -d \"" + OUTPUT_DIR + "\"",
11604 		"",
11605 		"----------\n" +
11606 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
11607 		"	class Y extends X { @Override void foo() { } }\n" +
11608 		"	                                   ^^^^^\n" +
11609 		"The method Y.foo() is overriding a synchronized method without being synchronized\n" +
11610 		"----------\n" +
11611 		"1 problem (1 warning)\n",
11612 		true);
11613 }
11614 
11615 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366829
11616 // -warn option - regression test to check option syncOverride
11617 // Warning when when a class overrides a synchronized method without synchronizing it
test310b_warn_options()11618 public void test310b_warn_options() {
11619 	this.runConformTest(
11620 		new String[] {
11621 				"X.java",
11622 				"public class X {\n" +
11623 				"  void bar() { new X() { @Override void foo() {} }; }\n"+
11624 				"  synchronized void foo() { }\n"+
11625 				"}"
11626 		},
11627 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
11628 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
11629 		+ " -warn:syncOverride -1.5 -proc:none -d \"" + OUTPUT_DIR + "\"",
11630 		"",
11631 		"----------\n" +
11632 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
11633 		"	void bar() { new X() { @Override void foo() {} }; }\n"+
11634 		"	                                      ^^^^^\n" +
11635 		"The method new X(){}.foo() is overriding a synchronized method without being synchronized\n" +
11636 		"----------\n" +
11637 		"1 problem (1 warning)\n",
11638 		true);
11639 }
11640 
11641 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342
11642 // -warn option - regression tests to check option nullAnnot (with args)
11643 // Null warnings because of annotations - custom annotation types used - challenging various kinds of diagnostics
test312_warn_options()11644 public void test312_warn_options() {
11645 	this.runConformTest(
11646 		new String[] {
11647 				"p/X.java",
11648 				"package p;\n" +
11649 				"import static java.lang.annotation.ElementType.*;\n" +
11650 				"import java.lang.annotation.*;\n" +
11651 				"@SuppressWarnings(\"unused\")\n" +
11652 				"public class X {\n" +
11653 				"	public void test() { Object o = null; o.toString();}\n" +
11654 				"  @NonNull Object foo(@Nullable Object o, @NonNull Object o2) {\n" +
11655 				"    if (o.toString() == \"\"){ return null;}\n" +
11656 				"    if (o2 == null) {}\n" +
11657 				"    goo(null).toString();\n" +
11658 				"	 Object local = null;\n" +
11659 				"	 o.toString();\n" +
11660 				"	 return null;\n" +
11661 				"  }\n" +
11662 				"  @Nullable Object goo(@NonNull Object o2) {\n" +
11663 				"    return new Object();\n" +
11664 				"  }\n" +
11665 				"  @NonNullByDefault Object hoo(Object o2) {\n" +
11666 				"    if (o2 == null){}\n" +
11667 				"    if (o2 == null){\n" +
11668 				"	    return null;\n" +
11669 				"	 }\n" +
11670 				"	 return new Object();\n" +
11671 				"  }\n" +
11672 				"}\n" +
11673 				"@Documented\n" +
11674 				"@Retention(RetentionPolicy.CLASS)\n" +
11675 				"@Target({ METHOD, PARAMETER })\n" +
11676 				"@interface NonNull{\n" +
11677 				"}\n" +
11678 				"@Documented\n" +
11679 				"@Retention(RetentionPolicy.CLASS)\n" +
11680 				"@Target({ METHOD, PARAMETER })\n" +
11681 				"@interface Nullable{\n" +
11682 				"}\n" +
11683 				"@Documented\n" +
11684 				"@Retention(RetentionPolicy.CLASS)\n" +
11685 				"@Target({ PACKAGE, TYPE, METHOD, CONSTRUCTOR })\n" +
11686 				"@interface NonNullByDefault{\n" +
11687 				"}"
11688 		},
11689 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
11690 //		+ " -sourcepath \"" + OUTPUT_DIR + "\""
11691 		+ " -1.5"
11692 		+ " -warn:+nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault) -warn:+null -proc:none -d \"" + OUTPUT_DIR + "\"",
11693 		"",
11694 		"----------\n" +
11695 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 6)\n" +
11696 		"	public void test() { Object o = null; o.toString();}\n" +
11697 		"	                                      ^\n" +
11698 		"Null pointer access: The variable o can only be null at this location\n" +
11699 		"----------\n" +
11700 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 8)\n" +
11701 		"	if (o.toString() == \"\"){ return null;}\n" +
11702 		"	    ^\n" +
11703 		"Potential null pointer access: The variable o may be null at this location\n" +
11704 		"----------\n" +
11705 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 8)\n" +
11706 		"	if (o.toString() == \"\"){ return null;}\n" +
11707 		"	                                ^^^^\n" +
11708 		"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
11709 		"----------\n" +
11710 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" +
11711 		"	if (o2 == null) {}\n" +
11712 		"	    ^^\n" +
11713 		"Null comparison always yields false: The variable o2 is specified as @NonNull\n" +
11714 		"----------\n" +
11715 		"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 10)\n" +
11716 		"	goo(null).toString();\n" +
11717 		"	^^^^^^^^^\n" +
11718 		"Potential null pointer access: The method goo(Object) may return null\n" +
11719 		"----------\n" +
11720 		"6. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 10)\n" +
11721 		"	goo(null).toString();\n" +
11722 		"	    ^^^^\n" +
11723 		"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
11724 		"----------\n" +
11725 		"7. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 13)\n" +
11726 		"	return null;\n" +
11727 		"	       ^^^^\n" +
11728 		"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
11729 		"----------\n" +
11730 		"8. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 19)\n" +
11731 		"	if (o2 == null){}\n" +
11732 		"	    ^^\n" +
11733 		"Null comparison always yields false: The variable o2 is specified as @NonNull\n" +
11734 		"----------\n" +
11735 		"9. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 20)\n" +
11736 		"	if (o2 == null){\n" +
11737 		"	    ^^\n" +
11738 		"Null comparison always yields false: The variable o2 is specified as @NonNull\n" +
11739 		"----------\n" +
11740 		"9 problems (9 warnings)\n",
11741 		true);
11742 }
11743 
11744 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=374605
11745 // -warn/-error option : enumSwitchPedantic
test317_warn_options()11746 public void test317_warn_options() {
11747 	this.runConformTest(
11748 		new String[] {
11749 				"p/X.java",
11750 				"package p;\n" +
11751 				"enum Color { RED, GREEN };\n" +
11752 				"public class X {\n" +
11753 				"     int getVal(Color c) {\n" +
11754 				"         switch (c) {\n" +
11755 				"             case RED: return 1;\n" +
11756 				"             default : return 0;\n" +
11757 				"         }\n" +
11758 				"     }\n" +
11759 				"}\n"
11760 		},
11761 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
11762 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
11763 		+ " -1.5"
11764 		+ " -warn:+enumSwitchPedantic -proc:none -d \"" + OUTPUT_DIR + "\"",
11765 		"",
11766 		"----------\n" +
11767 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 5)\n" +
11768 		"	switch (c) {\n" +
11769 		"	        ^\n" +
11770 		"The enum constant GREEN should have a corresponding case label in this enum switch on Color. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'\n" +
11771 		"----------\n" +
11772 		"1 problem (1 warning)\n",
11773 		true);
11774 }
11775 
11776 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=374605
11777 // -warn/-error option : enumSwitchPedantic: increase severity to ERROR
test318_warn_options()11778 public void test318_warn_options() {
11779 	this.runNegativeTest(
11780 			new String[] {
11781 					"p/X.java",
11782 					"package p;\n" +
11783 					"enum Color { RED, GREEN };\n" +
11784 					"public class X {\n" +
11785 					"     int getVal(Color c) {\n" +
11786 					"         switch (c) {\n" +
11787 					"             case RED: return 1;\n" +
11788 					"             default : return 0;\n" +
11789 					"         }\n" +
11790 					"     }\n" +
11791 					"}\n"
11792 			},
11793 			"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
11794 			+ " -sourcepath \"" + OUTPUT_DIR + "\""
11795 			+ " -1.5"
11796 			+ " -err:+enumSwitchPedantic -proc:none -d \"" + OUTPUT_DIR + "\"",
11797 			"",
11798 			"----------\n" +
11799 			"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 5)\n" +
11800 			"	switch (c) {\n" +
11801 			"	        ^\n" +
11802 			"The enum constant GREEN should have a corresponding case label in this enum switch on Color. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'\n" +
11803 			"----------\n" +
11804 			"1 problem (1 error)\n",
11805 			true);
11806 }
11807 
11808 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=374605
11809 // -warn/-error option : switchDefault
test319_warn_options()11810 public void test319_warn_options() {
11811 	this.runConformTest(
11812 		new String[] {
11813 				"p/X.java",
11814 				"package p;\n" +
11815 				"enum Color { RED, GREEN };\n" +
11816 				"public class X {\n" +
11817 				"     int getVal(Color c) {\n" +
11818 				"         switch (c) {\n" +
11819 				"             case RED: return 1;\n" +
11820 				"             case GREEN : return 2;\n" +
11821 				"         }\n" +
11822 				"         return 0;\n" +
11823 				"     }\n" +
11824 				"}\n"
11825 		},
11826 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
11827 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
11828 		+ " -1.5"
11829 		+ " -warn:+switchDefault -proc:none -d \"" + OUTPUT_DIR + "\"",
11830 		"",
11831 		"----------\n" +
11832 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 5)\n" +
11833 		"	switch (c) {\n" +
11834 		"	        ^\n" +
11835 		"The switch over the enum type Color should have a default case\n" +
11836 		"----------\n" +
11837 		"1 problem (1 warning)\n",
11838 		true);
11839 }
11840 
11841 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
11842 //-nowarn option - regression tests
11843 //default
test317_nowarn_options()11844 public void test317_nowarn_options() {
11845 	this.runConformTest(
11846 		new String[] {
11847 				"src/X.java",
11848 				"public class X {\n" +
11849 				"  /**\n" +
11850 				"    @param\n" +
11851 				"  */\n" +
11852 				"  public void foo() {\n" +
11853 				"  }\n" +
11854 				"}",
11855 			},
11856 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
11857 			+ " -warn:javadoc -nowarn:[\"" +
11858 			OUTPUT_DIR + File.separator + "src" +
11859 			"\"] -proc:none -d \"" + OUTPUT_DIR + "\"",
11860 			"",
11861 			"",
11862 			true);
11863 }
11864 
11865 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
11866 //-nowarn option - regression tests
11867 //two different source folders ignore only from one
test318_nowarn_options()11868 public void test318_nowarn_options() {
11869 	this.runConformTest(
11870 		new String[] {
11871 				"src/X.java",
11872 				"public class X {\n" +
11873 				"  /**\n" +
11874 				"    @param\n" +
11875 				"  */\n" +
11876 				"  public void foo() {\n" +
11877 				"  }\n" +
11878 				"}",
11879 				"src2/Y.java",
11880 				"public class Y {\n" +
11881 				"  /**\n" +
11882 				"    @param\n" +
11883 				"  */\n" +
11884 				"  public void foo() {\n" +
11885 				"  }\n" +
11886 				"}"
11887 			},
11888 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\"" +
11889 			" \"" + OUTPUT_DIR + File.separator + "src2/Y.java\"" +
11890 			" -warn:javadoc -nowarn:[" +
11891 			"\"" + OUTPUT_DIR + File.separator + "src"
11892 			+ "\"] -proc:none -d \"" + OUTPUT_DIR + "\"",
11893 			"",
11894 			"----------\n" +
11895 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 3)\n" +
11896 			"	@param\n" +
11897 			"	 ^^^^^\n" +
11898 			"Javadoc: Missing parameter name\n" +
11899 			"----------\n" +
11900 			"1 problem (1 warning)\n",
11901 			true);
11902 }
11903 
11904 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
11905 //-nowarn option - regression tests
11906 //two different source folders ignore from both
test319_nowarn_options()11907 public void test319_nowarn_options() {
11908 	this.runConformTest(
11909 		new String[] {
11910 				"src1/X.java",
11911 				"public class X {\n" +
11912 				"  /**\n" +
11913 				"    @param\n" +
11914 				"  */\n" +
11915 				"  public void foo() {\n" +
11916 				"  }\n" +
11917 				"}",
11918 				"src2/Y.java",
11919 				"public class Y {\n" +
11920 				"  /**\n" +
11921 				"    @param\n" +
11922 				"  */\n" +
11923 				"  public void foo() {\n" +
11924 				"  }\n" +
11925 				"}"
11926 			},
11927 			"\"" + OUTPUT_DIR + File.separator + "src1/X.java\"" +
11928 			" \"" + OUTPUT_DIR + File.separator + "src2/Y.java\"" +
11929 			" -warn:javadoc -nowarn:[" +
11930 			"\"" + OUTPUT_DIR + File.separator + "src1\"" + File.pathSeparator +
11931 			"\"" + OUTPUT_DIR + File.separator +
11932 			"src2\"] -proc:none -d \"" + OUTPUT_DIR + "\"",
11933 			"",
11934 			"",
11935 			true);
11936 }
11937 
11938 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
11939 //-nowarn option - regression tests
11940 //two different source folders ignore from both using multiple -nowarn
test320_nowarn_options()11941 public void test320_nowarn_options() {
11942 	this.runConformTest(
11943 		new String[] {
11944 				"src1/X.java",
11945 				"public class X {\n" +
11946 				"  /**\n" +
11947 				"    @param\n" +
11948 				"  */\n" +
11949 				"  public void foo() {\n" +
11950 				"  }\n" +
11951 				"}",
11952 				"src2/Y.java",
11953 				"public class Y {\n" +
11954 				"  /**\n" +
11955 				"    @param\n" +
11956 				"  */\n" +
11957 				"  public void foo() {\n" +
11958 				"  }\n" +
11959 				"}"
11960 			},
11961 			"\"" + OUTPUT_DIR + File.separator + "src1/X.java\"" +
11962 			" \"" + OUTPUT_DIR + File.separator + "src2/Y.java\"" +
11963 			" -warn:javadoc -nowarn:[" +
11964 			"\"" + OUTPUT_DIR + File.separator + "src1\"] -nowarn:[" +
11965 			"\"" + OUTPUT_DIR + File.separator + "src2\"] " +
11966 			"-proc:none -d \"" + OUTPUT_DIR + "\"",
11967 			"",
11968 			"",
11969 			true);
11970 }
11971 
11972 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
11973 //-nowarn option - regression tests
11974 //option syntax error -nowarn:
test321_nowarn_options()11975 public void test321_nowarn_options() {
11976 	this.runNegativeTest(
11977 		new String[] {
11978 				"src/X.java",
11979 				"public class X {\n" +
11980 				"  /**\n" +
11981 				"    @param\n" +
11982 				"  */\n" +
11983 				"  public void foo() {\n" +
11984 				"  }\n" +
11985 				"}",
11986 			},
11987 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
11988 			+ " -warn:javadoc -nowarn: -proc:none -d \"" + OUTPUT_DIR + "\"",
11989 			"",
11990 			"invalid syntax for nowarn option: -nowarn:\n",
11991 			true);
11992 }
11993 
11994 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
11995 //-nowarn option - regression tests
11996 //option syntax error -nowarn:[
test322_nowarn_options()11997 public void test322_nowarn_options() {
11998 	this.runNegativeTest(
11999 		new String[] {
12000 				"src/X.java",
12001 				"public class X {\n" +
12002 				"  /**\n" +
12003 				"    @param\n" +
12004 				"  */\n" +
12005 				"  public void foo() {\n" +
12006 				"  }\n" +
12007 				"}",
12008 			},
12009 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12010 			+ " -warn:javadoc -nowarn:[ -proc:none -d \"" + OUTPUT_DIR + "\"",
12011 			"",
12012 			"invalid syntax for nowarn option: -nowarn:[\n",
12013 			true);
12014 }
12015 
12016 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12017 //-nowarn option - regression tests
12018 //option syntax error -nowarn:[src
test323_nowarn_options()12019 public void test323_nowarn_options() {
12020 	this.runNegativeTest(
12021 		new String[] {
12022 				"src/X.java",
12023 				"public class X {\n" +
12024 				"  /**\n" +
12025 				"    @param\n" +
12026 				"  */\n" +
12027 				"  public void foo() {\n" +
12028 				"  }\n" +
12029 				"}",
12030 			},
12031 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12032 			+ " -warn:javadoc -nowarn:[src -proc:none -d \"" + OUTPUT_DIR + "\"",
12033 			"",
12034 			"invalid syntax for nowarn option: -nowarn:[src\n",
12035 			true);
12036 }
12037 
12038 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12039 //-nowarn option - regression tests
12040 //option syntax error -nowarn:src]
test324_nowarn_options()12041 public void test324_nowarn_options() {
12042 	this.runNegativeTest(
12043 		new String[] {
12044 				"src/X.java",
12045 				"public class X {\n" +
12046 				"  /**\n" +
12047 				"    @param\n" +
12048 				"  */\n" +
12049 				"  public void foo() {\n" +
12050 				"  }\n" +
12051 				"}",
12052 			},
12053 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12054 			+ " -warn:javadoc -nowarn:src] -proc:none -d \"" + OUTPUT_DIR + "\"",
12055 			"",
12056 			"invalid syntax for nowarn option: -nowarn:src]\n",
12057 			true);
12058 }
12059 
12060 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12061 //-nowarn option - regression tests
12062 //option syntax error -nowarn[src]
test325_nowarn_options()12063 public void test325_nowarn_options() {
12064 	this.runNegativeTest(
12065 		new String[] {
12066 				"src/X.java",
12067 				"public class X {\n" +
12068 				"  /**\n" +
12069 				"    @param\n" +
12070 				"  */\n" +
12071 				"  public void foo() {\n" +
12072 				"  }\n" +
12073 				"}",
12074 			},
12075 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12076 			+ " -warn:javadoc -nowarn[src] -proc:none -d \"" + OUTPUT_DIR + "\"",
12077 			"",
12078 			"invalid syntax for nowarn option: -nowarn[src]\n",
12079 			true);
12080 }
12081 
12082 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12083 //-nowarn option - regression tests
12084 //option syntax error -nowarn:[src1]src2
test326_nowarn_options()12085 public void test326_nowarn_options() {
12086 	this.runNegativeTest(
12087 		new String[] {
12088 				"src/X.java",
12089 				"public class X {\n" +
12090 				"  /**\n" +
12091 				"    @param\n" +
12092 				"  */\n" +
12093 				"  public void foo() {\n" +
12094 				"  }\n" +
12095 				"}",
12096 			},
12097 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12098 			+ " -warn:javadoc -nowarn:[src1]src2 -proc:none -d \"" + OUTPUT_DIR + "\"",
12099 			"",
12100 			"invalid syntax for nowarn option: -nowarn:[src1]src2\n",
12101 			true);
12102 }
12103 
12104 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12105 //-nowarn option - regression tests
12106 //option syntax error -nowarn:[]
test327_nowarn_options()12107 public void test327_nowarn_options() {
12108 	this.runNegativeTest(
12109 		new String[] {
12110 				"src/X.java",
12111 				"public class X {\n" +
12112 				"  /**\n" +
12113 				"    @param\n" +
12114 				"  */\n" +
12115 				"  public void foo() {\n" +
12116 				"  }\n" +
12117 				"}",
12118 			},
12119 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12120 			+ " -warn:javadoc -nowarn:[] -proc:none -d \"" + OUTPUT_DIR + "\"",
12121 			"",
12122 			"invalid syntax for nowarn option: -nowarn:[]\n",
12123 			true);
12124 }
12125 
12126 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12127 //-nowarn option - regression tests
12128 //non-optional errors cannot be ignored
test328_nowarn_options()12129 public void test328_nowarn_options() {
12130 	this.runNegativeTest(
12131 		new String[] {
12132 				"src/X.java",
12133 				"public class X {\n" +
12134 				"  /**\n" +
12135 				"    @param\n" +
12136 				"  */\n" +
12137 				"  public void foo() {\n" +
12138 				"    a++;\n" +
12139 				"  }\n" +
12140 				"}",
12141 			},
12142 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12143 			+ " -warn:javadoc -nowarn:[" +
12144 			"\"" + OUTPUT_DIR + File.separator + "src]\" -proc:none -d \"" + OUTPUT_DIR + "\"",
12145 			"",
12146 			"----------\n" +
12147 			"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/X.java (at line 6)\n" +
12148 			"	a++;\n" +
12149 			"	^\n" +
12150 			"a cannot be resolved to a variable\n" +
12151 			"----------\n" +
12152 			"1 problem (1 error)\n",
12153 			true);
12154 }
12155 
12156 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=220928
12157 //-nowarn option - regression tests
12158 //task tags cannot be ignored
test329_nowarn_options()12159 public void test329_nowarn_options() {
12160 	this.runConformTest(
12161 		new String[] {
12162 				"src/X.java",
12163 				"public class X {\n" +
12164 				"  /**\n" +
12165 				"    @param\n" +
12166 				"  */\n" +
12167 				"  public void foo() {\n" +
12168 				"    // TODO nothing\n" +
12169 				"  }\n" +
12170 				"}",
12171 			},
12172 			"\"" + OUTPUT_DIR + File.separator + "src/X.java\""
12173 			+ " -warn:javadoc,tasks(TODO) -nowarn:[" +
12174 			"\"" + OUTPUT_DIR + File.separator + "src]\" -proc:none -d \"" + OUTPUT_DIR + "\"",
12175 			"",
12176 			"----------\n" +
12177 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src/X.java (at line 6)\n" +
12178 			"	// TODO nothing\n" +
12179 			"	   ^^^^^^^^^^^^\n" +
12180 			"TODO nothing\n" +
12181 			"----------\n" +
12182 			"1 problem (1 warning)\n",
12183 			true);
12184 }
12185 
12186 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=408815
12187 // -warn option - regression tests to check option unlikelyCollectionMethodArgumentType
test330_warn_options()12188 public void test330_warn_options() {
12189 	this.runConformTest(
12190 		new String[] {
12191 				"p/X.java",
12192 				"package p;\n" +
12193 				"import java.util.Map;\n" +
12194 				"public class X {\n" +
12195 				"  Integer foo(Map<String,Integer> map) {\n" +
12196 				"	 return map.get(3);\n" +
12197 				"  }\n" +
12198 				"}\n",
12199 		},
12200 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12201 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
12202 		+ " -1.5"
12203 		+ " -warn:-unlikelyCollectionMethodArgumentType -proc:none -d \"" + OUTPUT_DIR + "\"",
12204 		"",
12205 		"",
12206 		true);
12207 }//https://bugs.eclipse.org/bugs/show_bug.cgi?id=408815
12208 //-warn option - regression tests to check option unlikelyEqualsArgumentType
test331_warn_options()12209 public void test331_warn_options() {
12210 	this.runConformTest(
12211 		new String[] {
12212 				"p/X.java",
12213 				"package p;\n" +
12214 				"public class X {\n" +
12215 				"  boolean foo() {\n" +
12216 				"	 return \"three\".equals(3);\n" +
12217 				"  }\n" +
12218 				"}\n",
12219 		},
12220 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12221 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
12222 		+ " -1.5"
12223 		+ " -info:-unlikelyEqualsArgumentType -proc:none -d \"" + OUTPUT_DIR + "\"",
12224 		"",
12225 		"",
12226 		true);
12227 }
12228 
12229 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
testBug375409a()12230 public void testBug375409a() {
12231 	this.runConformTest(
12232 		new String[] {
12233 				"p/X.java",
12234 				"package p;\n" +
12235 				"public class X {\n" +
12236 				"/** \n" +
12237 				"* Description {@see String}, {@category cat}\n" +
12238 				"* @param a\n" +
12239 				"*/\n" +
12240 				"public void foo(int i) {}}\n"
12241 		},
12242 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12243 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
12244 		+ " -1.5"
12245 		+ " -warn:invalidJavadoc -proc:none -d \"" + OUTPUT_DIR + "\"",
12246 		"",
12247 		"----------\n" +
12248 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 4)\n" +
12249 		"	* Description {@see String}, {@category cat}\n" +
12250 		"	                ^^^\n" +
12251 		"Javadoc: Unexpected tag\n" +
12252 		"----------\n" +
12253 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 4)\n" +
12254 		"	* Description {@see String}, {@category cat}\n" +
12255 		"	                               ^^^^^^^^\n" +
12256 		"Javadoc: Unexpected tag\n" +
12257 		"----------\n" +
12258 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 5)\n" +
12259 		"	* @param a\n" +
12260 		"	         ^\n" +
12261 		"Javadoc: Parameter a is not declared\n" +
12262 		"----------\n" +
12263 		"3 problems (3 warnings)\n",
12264 		true);
12265 }
12266 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
testBug375409b()12267 public void testBug375409b() {
12268 	this.runConformTest(
12269 		new String[] {
12270 				"p/X.java",
12271 				"package p;\n" +
12272 				"public class X {\n" +
12273 				"/** \n" +
12274 				"* Description {@see String}, {@category cat}\n" +
12275 				"* @param a\n" +
12276 				"*/\n" +
12277 				"public void foo(int i) {}}\n"
12278 		},
12279 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12280 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
12281 		+ " -1.5"
12282 		+ " -warn:missingJavadocTags,missingJavadocTagsVisibility(public) -proc:none -d \"" + OUTPUT_DIR + "\"",
12283 		"",
12284 		"----------\n" +
12285 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 7)\n" +
12286 		"	public void foo(int i) {}}\n" +
12287 		"	                    ^\n" +
12288 		"Javadoc: Missing tag for parameter i\n" +
12289 		"----------\n" +
12290 		"1 problem (1 warning)\n",
12291 		true);
12292 }
12293 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
testBug375409c()12294 public void testBug375409c() {
12295 	this.runConformTest(
12296 		new String[] {
12297 				"p/X.java",
12298 				"package p;\n" +
12299 				"public class X {\n" +
12300 				"/** \n" +
12301 				"* Description {@see String}, {@category cat}\n" +
12302 				"* @param a\n" +
12303 				"*/\n" +
12304 				"public void foo(int i) {}}\n"
12305 		},
12306 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12307 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
12308 		+ " -1.5"
12309 		+ " -warn:missingJavadocComments -proc:none -d \"" + OUTPUT_DIR + "\"",
12310 		"",
12311 		"----------\n" +
12312 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 2)\n" +
12313 		"	public class X {\n" +
12314 		"	             ^\n" +
12315 		"Javadoc: Missing comment for public declaration\n" +
12316 		"----------\n" +
12317 		"1 problem (1 warning)\n",
12318 		true);
12319 }
12320 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
testBug375409d()12321 public void testBug375409d() {
12322 	this.runConformTest(
12323 		new String[] {
12324 				"p/X.java",
12325 				"package p;\n" +
12326 				"public class X {\n" +
12327 				"/** \n" +
12328 				"* Description {@see String}, {@category cat}\n" +
12329 				"* @param a\n" +
12330 				"*/\n" +
12331 				"void foo(int i) {}\n" +
12332 				"/** \n" +
12333 				"* Description {@see String}, {@category cat}\n" +
12334 				"* @param a\n" +
12335 				"*/\n" +
12336 				"public void foo2(int i2) {}}\n"
12337 		},
12338 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12339 		+ " -sourcepath \"" + OUTPUT_DIR + "\""
12340 		+ " -1.5"
12341 		+ " -warn:missingJavadocTags,missingJavadocTagsVisibility(public) -proc:none -d \"" + OUTPUT_DIR + "\"",
12342 		"",
12343 		"----------\n" +
12344 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 12)\n" +
12345 		"	public void foo2(int i2) {}}\n" +
12346 		"	                     ^^\n" +
12347 		"Javadoc: Missing tag for parameter i2\n" +
12348 		"----------\n" +
12349 		"1 problem (1 warning)\n",
12350 		true);
12351 }
12352 
12353 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
12354 // -warn option - regression tests to check option nullAnnotConflict
testBug375409e()12355 public void testBug375409e() {
12356 	this.runConformTest(
12357 		new String[] {
12358 				"p/X.java",
12359 				"package p;\n" +
12360 				"import static java.lang.annotation.ElementType.*;\n" +
12361 				"import java.lang.annotation.*;\n" +
12362 				"public class X {\n" +
12363 				"  @NonNull Object foo(@Nullable Object o, @NonNull Object o2) {\n" +
12364 				"	 Object o3 = new X().bar();\n" + // need a local to involve flow analysis
12365 				"	 return o3;\n" +
12366 				"  }\n" +
12367 				"  @Nullable Object bar() {\n" +
12368 				"	 return null;\n" +
12369 				"  }\n" +
12370 				"}\n" +
12371 				"@Documented\n" +
12372 				"@Retention(RetentionPolicy.CLASS)\n" +
12373 				"@Target({ METHOD, PARAMETER })\n" +
12374 				"@interface NonNull{\n" +
12375 				"}\n" +
12376 				"@Documented\n" +
12377 				"@Retention(RetentionPolicy.CLASS)\n" +
12378 				"@Target({ METHOD, PARAMETER })\n" +
12379 				"@interface Nullable{\n" +
12380 				"}\n" +
12381 				"@Documented\n" +
12382 				"@Retention(RetentionPolicy.CLASS)\n" +
12383 				"@Target({ PACKAGE, TYPE, METHOD, CONSTRUCTOR })\n" +
12384 				"@interface NonNullByDefault{\n" +
12385 				"}"
12386 		},
12387 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12388 		+ " -1.5"
12389 		+ " -warn:+nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault),+null,-nullAnnotConflict "
12390 		+ "-proc:none -d \"" + OUTPUT_DIR + "\"",
12391 		"",
12392 		"",
12393 		true);
12394 }
12395 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
12396 // -warn option - regression tests to check option nullAnnotRedundant
testBug375409f()12397 public void testBug375409f() {
12398 	this.runConformTest(
12399 		new String[] {
12400 				"p/X.java",
12401 				"package p;\n" +
12402 				"import static java.lang.annotation.ElementType.*;\n" +
12403 				"import java.lang.annotation.*;\n" +
12404 				"@NonNullByDefault public class X {\n" +
12405 				"  @NonNull Object foo() {\n" +
12406 				"	 return null;\n" +
12407 				"  }\n" +
12408 				"}\n" +
12409 				"@Documented\n" +
12410 				"@Retention(RetentionPolicy.CLASS)\n" +
12411 				"@Target({ METHOD, PARAMETER })\n" +
12412 				"@interface NonNull{\n" +
12413 				"}\n" +
12414 				"@Documented\n" +
12415 				"@Retention(RetentionPolicy.CLASS)\n" +
12416 				"@Target({ METHOD, PARAMETER })\n" +
12417 				"@interface Nullable{\n" +
12418 				"}\n" +
12419 				"@Documented\n" +
12420 				"@Retention(RetentionPolicy.CLASS)\n" +
12421 				"@Target({ PACKAGE, TYPE, METHOD, CONSTRUCTOR })\n" +
12422 				"@interface NonNullByDefault{\n" +
12423 				"}"
12424 		},
12425 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12426 		+ " -1.5"
12427 		+ " -warn:+nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault),+null,-nullAnnotRedundant "
12428 		+ "-proc:none -d \"" + OUTPUT_DIR + "\"",
12429 		"",
12430 		"----------\n" +
12431 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 6)\n" +
12432 		"	return null;\n" +
12433 		"	       ^^^^\n" +
12434 		"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
12435 		"----------\n" +
12436 		"1 problem (1 warning)\n",
12437 		true);
12438 }
12439 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=375409
12440 // -warn option - regression tests to check option nullUncheckedConversion
testBug375409g()12441 public void testBug375409g() {
12442 	this.runConformTest(
12443 		new String[] {
12444 				"p/X.java",
12445 				"package p;\n" +
12446 				"import static java.lang.annotation.ElementType.*;\n" +
12447 				"import java.lang.annotation.*;\n" +
12448 				"public class X {\n" +
12449 				"  @NonNull Object foo(@Nullable Object o, @NonNull Object o2) {\n" +
12450 				"	 return new X().bar();\n" +
12451 				"  }\n" +
12452 				"  Object bar() {\n" +
12453 				"	 return null;\n" +
12454 				"  }\n" +
12455 				"}\n" +
12456 				"@Documented\n" +
12457 				"@Retention(RetentionPolicy.CLASS)\n" +
12458 				"@Target({ METHOD, PARAMETER })\n" +
12459 				"@interface NonNull{\n" +
12460 				"}\n" +
12461 				"@Documented\n" +
12462 				"@Retention(RetentionPolicy.CLASS)\n" +
12463 				"@Target({ METHOD, PARAMETER })\n" +
12464 				"@interface Nullable{\n" +
12465 				"}\n" +
12466 				"@Documented\n" +
12467 				"@Retention(RetentionPolicy.CLASS)\n" +
12468 				"@Target({ PACKAGE, TYPE, METHOD, CONSTRUCTOR })\n" +
12469 				"@interface NonNullByDefault{\n" +
12470 				"}"
12471 		},
12472 		"\"" + OUTPUT_DIR +  File.separator + "p" + File.separator + "X.java\""
12473 		+ " -1.5"
12474 		+ " -warn:+nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault) -warn:+null -warn:-nullUncheckedConversion "
12475 		+ "-proc:none -d \"" + OUTPUT_DIR + "\"",
12476 		"",
12477 		"",
12478 		true);
12479 }
12480 
12481 
12482 // Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set
12483 // when -properties is used process javadoc by default
testBug375366a()12484 public void testBug375366a() throws IOException {
12485 	createOutputTestDirectory("regression/.settings");
12486 	Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs",
12487 			"eclipse.preferences.version=1\n" +
12488 			"org.eclipse.jdt.core.compiler.problem.unusedParameter=warning\n");
12489 	this.runConformTest(
12490 		new String[] {
12491 			"bugs/warning/ShowBug.java",
12492 			"package bugs.warning;\n" +
12493 			"\n" +
12494 			"public class ShowBug {\n" +
12495 			"	/**\n" +
12496 			"	 * \n" +
12497 			"	 * @param unusedParam\n" +
12498 			"	 */\n" +
12499 			"	public void foo(Object unusedParam) {\n" +
12500 			"		\n" +
12501 			"	}\n" +
12502 			"}\n"
12503 		},
12504 		"\"" + OUTPUT_DIR +  File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\""
12505 		+ " -1.5"
12506 		+ " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs "
12507 		+ " -d \"" + OUTPUT_DIR + "\"",
12508 		"",
12509 		"",
12510 		false /*don't flush output dir*/);
12511 }
12512 
12513 // Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set
12514 // property file explicitly disables javadoc processing
testBug375366b()12515 public void testBug375366b() throws IOException {
12516 	createOutputTestDirectory("regression/.settings");
12517 	Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs",
12518 			"eclipse.preferences.version=1\n" +
12519 			"org.eclipse.jdt.core.compiler.problem.unusedParameter=warning\n" +
12520 			"org.eclipse.jdt.core.compiler.doc.comment.support=disabled\n");
12521 	this.runTest(
12522 		true, // compile OK, expecting only warning
12523 		new String[] {
12524 			"bugs/warning/ShowBug.java",
12525 			"package bugs.warning;\n" +
12526 			"\n" +
12527 			"public class ShowBug {\n" +
12528 			"	/**\n" +
12529 			"	 * \n" +
12530 			"	 * @param unusedParam\n" +
12531 			"	 */\n" +
12532 			"	public void foo(Object unusedParam) {\n" +
12533 			"		\n" +
12534 			"	}\n" +
12535 			"}\n"
12536 		},
12537 		"\"" + OUTPUT_DIR +  File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\""
12538 		+ " -1.5"
12539 		+ " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs "
12540 		+ " -d \"" + OUTPUT_DIR + "\"",
12541 		"",
12542 		"----------\n" +
12543 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/bugs/warning/ShowBug.java (at line 8)\n" +
12544 		"	public void foo(Object unusedParam) {\n" +
12545 		"	                       ^^^^^^^^^^^\n" +
12546 		"The value of the parameter unusedParam is not used\n" +
12547 		"----------\n" +
12548 		"1 problem (1 warning)\n",
12549 		false /*don't flush output dir*/,
12550 		null /* progress */);
12551 }
12552 // see also:
12553 // org.eclipse.jdt.core.tests.compiler.regression.NullAnnotationBatchCompilerTest.testBug375366c()
12554 // org.eclipse.jdt.core.tests.compiler.regression.NullAnnotationBatchCompilerTest.testBug375366d()
12555 
12556 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=385780
test385780_warn_option()12557 public void test385780_warn_option() {
12558 	this.runConformTest(
12559 		new String[] {
12560 			"X.java",
12561 			"public class X<T> {\n"+
12562 			"public <S> X() {\n"+
12563 			"}\n"+
12564 			"public void ph(int t) {\n"+
12565 	        "}\n"+
12566 			"}\n"+
12567 			"interface doNothingInterface<T> {\n"+
12568 			"}\n"+
12569 			"class doNothing {\n"+
12570 			"public <T> void doNothingMethod() {"+
12571 			"}\n"+
12572 			"}\n"+
12573 			"class noerror {\n"+
12574 			"public <T> void doNothing(T t) {"+
12575 			"}"+
12576 			"}\n"
12577 		},
12578 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
12579 		+ " -warn:unusedTypeParameter -proc:none -1.7 -d \"" + OUTPUT_DIR + "\"",
12580 		"",
12581 		"----------\n" +
12582 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 1)\n" +
12583 		"	public class X<T> {\n" +
12584 		"	               ^\n" +
12585 		"Unused type parameter T\n" +
12586 		"----------\n" +
12587 		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
12588 		"	public <S> X() {\n" +
12589 		"	        ^\n" +
12590 		"Unused type parameter S\n" +
12591 		"----------\n" +
12592 		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
12593 		"	interface doNothingInterface<T> {\n" +
12594 		"	                             ^\n" +
12595 		"Unused type parameter T\n" +
12596 		"----------\n" +
12597 		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 10)\n" +
12598 		"	public <T> void doNothingMethod() {}\n" +
12599 		"	        ^\n" +
12600 		"Unused type parameter T\n" +
12601 		"----------\n" +
12602 		"4 problems (4 warnings)\n",
12603 		true);
12604 }
12605 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=405225
test405225_extdirs()12606 public void test405225_extdirs() {
12607 	if (AbstractCompilerTest.isJRE9Plus)
12608 		return;
12609 	this.runConformTest(
12610 		new String[] {
12611 			"X.java",
12612 			"import java.io.FileReader;\n" +
12613 			"public class X {\n" +
12614 			"  void foo() throws java.io.IOException {\n" +
12615 			"      FileReader r = new FileReader(\"f1\");\n" +
12616 			"      char[] cs = new char[1024];\n" +
12617 			"	   r.read(cs);\n" +
12618 			"  }\n" +
12619 			"}\n"
12620 		},
12621 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
12622 		+ " -warn:-resource -1.7 -extdirs \"" + LIB_DIR + "\" -d \"" + OUTPUT_DIR + "\"",
12623 		"",
12624 		"",
12625 		true);
12626 }
12627 //Bug 408038 - Classes which implement Externalizable should not have an unused constructor warning
test408038a()12628 public void test408038a() {
12629 	this.runConformTest(
12630 		new String[] {
12631 			"externalizable/warning/X.java",
12632 			"package externalizable.warning;\n" +
12633 			"\n" +
12634 			"public class X {\n" +
12635 			"	private class Y {\n" +
12636 			"		static final int i = 10;\n" +
12637 			"		public Y() {}\n" +
12638 			"		public Y(int x) {System.out.println(x);}\n" +
12639 			"	}\n" +
12640 			"\n" +
12641 			"	public void zoo() {\n" +
12642 			"		System.out.println(Y.i);\n" +
12643 			"		Y y = new Y(5);\n" +
12644 			"		System.out.println(y);\n" +
12645 			"	}\n" +
12646 			"}",
12647 			},
12648 			"\"" + OUTPUT_DIR +  File.separator + "externalizable" + File.separator + "warning" + File.separator + "X.java\""
12649 			+ " -1.6 -d none",
12650 			"",
12651 			"----------\n" +
12652 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/externalizable/warning/X.java (at line 6)\n" +
12653 			"	public Y() {}\n" +
12654 			"	       ^^^\n" +
12655 			"The constructor X.Y() is never used locally\n" +
12656 			"----------\n" +
12657 			"1 problem (1 warning)\n",
12658 			true);
12659 }
12660 //Bug 408038 - Classes which implement Externalizable should not have an unused constructor warning
test408038b()12661 public void test408038b() {
12662 	this.runConformTest(
12663 		new String[] {
12664 			"externalizable/warning/X.java",
12665 			"package externalizable.warning;\n" +
12666 			"\n" +
12667 			"public class X {\n" +
12668 			"	private static class Y {\n" +
12669 			"		static final int i = 10;\n" +
12670 			"		public Y() {}\n" +
12671 			"		public Y(int x) {System.out.println(x);}\n" +
12672 			"	}\n" +
12673 			"\n" +
12674 			"	public void zoo() {\n" +
12675 			"		System.out.println(Y.i);\n" +
12676 			"		Y y = new Y(5);\n" +
12677 			"		System.out.println(y);\n" +
12678 			"	}\n" +
12679 			"}",
12680 			},
12681 			"\"" + OUTPUT_DIR +  File.separator + "externalizable" + File.separator + "warning" + File.separator + "X.java\""
12682 			+ " -1.6 -d none",
12683 			"",
12684 			"----------\n" +
12685 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/externalizable/warning/X.java (at line 6)\n" +
12686 			"	public Y() {}\n" +
12687 			"	       ^^^\n" +
12688 			"The constructor X.Y() is never used locally\n" +
12689 			"----------\n" +
12690 			"1 problem (1 warning)\n",
12691 			true);
12692 }
12693 //Bug 408038 - Classes which implement Externalizable should not have an unused constructor warning
test408038c()12694 public void test408038c() {
12695 	this.runConformTest(
12696 		new String[] {
12697 			"externalizable/warning/X.java",
12698 			"package externalizable.warning;\n" +
12699 			"import java.io.Externalizable;\n" +
12700 			"import java.io.IOException;\n" +
12701 			"import java.io.ObjectInput;\n" +
12702 			"import java.io.ObjectOutput;\n" +
12703 			"\n" +
12704 			"public class X {\n" +
12705 			"	private static class Y implements Externalizable {\n" +
12706 			"		static final int i = 10;\n" +
12707 			"		public Y() {}\n" +
12708 			"		public Y(int x) {System.out.println(x);}\n" +
12709 			"\n" +
12710 			"		@Override\n" +
12711 			"		public void writeExternal(ObjectOutput out) throws IOException {\n" +
12712 			"		}\n" +
12713 			"\n" +
12714 			"		@Override\n" +
12715 			"		public void readExternal(ObjectInput in) throws IOException,\n" +
12716 			"		ClassNotFoundException {\n" +
12717 			"		}\n" +
12718 			"	}\n" +
12719 			"\n" +
12720 			"	public void zoo() {\n" +
12721 			"		System.out.println(Y.i);\n" +
12722 			"		Y y = new Y(5);\n" +
12723 			"		System.out.println(y);\n" +
12724 			"	}\n" +
12725 			"}",
12726 			},
12727 			"\"" + OUTPUT_DIR +  File.separator + "externalizable" + File.separator + "warning" + File.separator + "X.java\""
12728 			+ " -1.6 -d none",
12729 			"",
12730 			"",
12731 			true);
12732 }
12733 //Bug 408038 - Classes which implement Externalizable should not have an unused constructor warning
test408038d()12734 public void test408038d() {
12735 	this.runConformTest(
12736 		new String[] {
12737 			"externalizable/warning/X.java",
12738 			"package externalizable.warning;\n" +
12739 			"import java.io.Externalizable;\n" +
12740 			"import java.io.IOException;\n" +
12741 			"import java.io.ObjectInput;\n" +
12742 			"import java.io.ObjectOutput;\n" +
12743 			"\n" +
12744 			"public class X {\n" +
12745 			"	private class Y implements Externalizable {\n" +
12746 			"		static final int i = 10;\n" +
12747 			"		public Y() {}\n" +
12748 			"		public Y(int x) {System.out.println(x);}\n" +
12749 			"\n" +
12750 			"		@Override\n" +
12751 			"		public void writeExternal(ObjectOutput out) throws IOException {\n" +
12752 			"		}\n" +
12753 			"\n" +
12754 			"		@Override\n" +
12755 			"		public void readExternal(ObjectInput in) throws IOException,\n" +
12756 			"		ClassNotFoundException {\n" +
12757 			"		}\n" +
12758 			"	}\n" +
12759 			"\n" +
12760 			"	public void zoo() {\n" +
12761 			"		System.out.println(Y.i);\n" +
12762 			"		Y y = new Y(5);\n" +
12763 			"		System.out.println(y);\n" +
12764 			"	}\n" +
12765 			"}",
12766 			},
12767 			"\"" + OUTPUT_DIR +  File.separator + "externalizable" + File.separator + "warning" + File.separator + "X.java\""
12768 			+ " -1.6 -d none",
12769 			"",
12770 			"----------\n" +
12771 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/externalizable/warning/X.java (at line 10)\n" +
12772 			"	public Y() {}\n" +
12773 			"	       ^^^\n" +
12774 			"The constructor X.Y() is never used locally\n" +
12775 			"----------\n" +
12776 			"1 problem (1 warning)\n",
12777 			true);
12778 }
12779 // Bug 408038 - Classes which implement Externalizable should not have an unused constructor warning
12780 // The test case is not directly related to the bug. It was discovered as a result
12781 // of the bug. Please see comment 16 bullet 4 in bugzilla.
test408038e()12782 public void test408038e() {
12783 	this.runConformTest(
12784 		new String[] {
12785 			"externalizable/warning/X.java",
12786 			"package externalizable.warning;\n" +
12787 			"class X {\n" +
12788 			"	int i;\n" +
12789 			"	private X(int x) {i = x;}\n" +
12790 			"	X() {}\n" +
12791 			"	public int foo() {\n" +
12792 			"		X x = new X();\n" +
12793 			"		return x.i;\n" +
12794 			"	}\n" +
12795 			"}\n"
12796 			},
12797 			"\"" + OUTPUT_DIR +  File.separator + "externalizable" + File.separator + "warning" + File.separator + "X.java\""
12798 			+ " -1.6 -d none",
12799 			"",
12800 			"----------\n" +
12801 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/externalizable/warning/X.java (at line 4)\n" +
12802 			"	private X(int x) {i = x;}\n" +
12803 	        "	        ^^^^^^^^\n" +
12804 	        "The constructor X(int) is never used locally\n" +
12805 	        "----------\n" +
12806 	        "1 problem (1 warning)\n",
12807 			true);
12808 }
12809 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=419351
testBug419351()12810 public void testBug419351() {
12811 	String backup = System.getProperty("java.endorsed.dirs");
12812 	if (backup == null)
12813 		return; // Don't bother running if it is JRE9, where there's no endorsed.dir
12814 	String endorsedPath = LIB_DIR + File.separator + "endorsed";
12815 	new File(endorsedPath).mkdir();
12816 	String lib1Path = endorsedPath + File.separator + "lib1.jar";
12817 	try {
12818 		System.setProperty("java.endorsed.dirs", endorsedPath);
12819 		Util.createJar(
12820 				new String[] {
12821 						"java/lang/String.java",
12822 						"package java.lang;\n" +
12823 						"public class String {\n" +
12824 						"    public String(java.lang.Object obj) {}\n" +
12825 						"}\n"
12826 				},
12827 				null,
12828 				lib1Path,
12829 				JavaCore.VERSION_1_5);
12830 		this.runConformTest(
12831 				new String[] {
12832 						"src/X.java",
12833 						"public class X {\n" +
12834 						"    public void foo(Object obj) {\n" +
12835 						"        java.lang.String str = new java.lang.String(obj);\n" +
12836 						"	}\n" +
12837 						"}\n",
12838 				},
12839 				"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
12840 				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
12841 				+ " -1.4 -nowarn"
12842 				+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
12843 				"",
12844 				"",
12845 		        true);
12846 	} catch (IOException e) {
12847 	} finally {
12848 		System.setProperty("java.endorsed.dirs", backup);
12849 		new File(endorsedPath).delete();
12850 		new File(lib1Path).delete();
12851 	}
12852 }
12853 
test501457()12854 public void test501457() throws IOException {
12855 	this.runConformTest(new String[] {
12856 			"FailingClass.java",
12857 			"import java.lang.invoke.MethodHandle;\n" +
12858 			"import java.util.ArrayList;\n" +
12859 			"public class FailingClass {\n" +
12860 			"  protected void test(MethodHandle handle) throws Throwable {\n" +
12861 			"        handle.invoke(null, new ArrayList<>());\n" +
12862 			"    }\n" +
12863 			"}\n"
12864 		},
12865 		" -1.8 " +
12866 		" -sourcepath \"" + OUTPUT_DIR + "\" " +
12867 		"\"" + OUTPUT_DIR +  File.separator + "FailingClass.java",
12868 		"",
12869 		"",
12870 		true
12871 	);
12872 }
12873 
12874 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=439750
test439750()12875 public void test439750() {
12876 	this.runConformTest(
12877 		new String[] {
12878 			"externalizable/warning/X.java",
12879 			"import java.io.FileInputStream;\n" +
12880 			"import java.io.IOException;\n" +
12881 			"class X {\n" +
12882 			"	public static void main(String[] args) {\n" +
12883 			"		FileInputStream fis = null;\n" +
12884 			"		try {\n" +
12885 			"			fis = new FileInputStream(\"xyz\");\n" +
12886 			"			System.out.println(\"fis\");\n" +
12887 			"		} catch (IOException e) {\n" +
12888 			"			e.printStackTrace();\n" +
12889 			"		} finally {\n" +
12890 			"			try {\n" +
12891 			"				if (fis != null) fis.close();\n" +
12892 			"			} catch (Exception e) {}\n" +
12893  			"		}\n" +
12894  			"	}\n" +
12895 			"}\n"
12896 			},
12897 			"\"" + OUTPUT_DIR +  File.separator + "externalizable" + File.separator + "warning" + File.separator + "X.java\""
12898 			+ " -1.6 -warn:unused -warn:unusedExceptionParam -d none",
12899 			"",
12900 			"----------\n" +
12901 			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/externalizable/warning/X.java (at line 14)\n" +
12902 			"	} catch (Exception e) {}\n" +
12903 			"	                   ^\n" +
12904 			"The value of the exception parameter e is not used\n" +
12905 			"----------\n" +
12906 			"1 problem (1 warning)\n",
12907 			true);
12908 }
12909 
12910 /**
12911  * A fast exit/result is expected when secondary types are searched with the reserved class name "package-info",
12912  * because there can not exist a secondary type with the name "package-info", because it is a reserved class name.
12913  * This fast exit improves the performance, because the search for secondary types is very expensive regarding performance
12914  * (all classes of a package have to get loaded, parsed and analyzed).
12915  */
testFileSystem_findSecondaryInClass()12916 public void testFileSystem_findSecondaryInClass() {
12917 	final String testScratchArea = "fileSystemTestScratchArea";
12918 
12919 	File testScratchAreaFile = new File(Util.getOutputDirectory(), testScratchArea);
12920 	try {
12921 		if(!testScratchAreaFile.exists()) {
12922 			testScratchAreaFile.mkdirs();
12923 		}
12924 
12925 		assertTrue(testScratchAreaFile.exists());
12926 
12927 		Classpath classpath = FileSystem.getClasspath(testScratchAreaFile.getPath(), null, null);
12928 		assertNotNull(classpath);
12929 		assertTrue(classpath instanceof ClasspathDirectory);
12930 
12931 		ClasspathDirectory classpathDirectory = (ClasspathDirectory)classpath;
12932 		NameEnvironmentAnswer answer = classpathDirectory.findSecondaryInClass(TypeConstants.PACKAGE_INFO_NAME, null, null);
12933 		assertNull(answer); //No answer is expected, because "package-info" isn't a secondary type.
12934 
12935 		try {
12936 			//When there is a call with another name like "package-info", an exception is expected, because the search can not get executed successfully
12937 			// when no value for qualifiedPackageName is provided.
12938 			classpathDirectory.findSecondaryInClass("X".toCharArray(), null, null);
12939 			fail("An exception is expected, because the parameter qualifiedPackageName can not be NULL!");
12940 		} catch(Exception e) {}
12941 	} finally {
12942 		if(testScratchAreaFile.exists()) {
12943 			Util.delete(testScratchAreaFile);
12944 		}
12945 	}
12946 }
12947 //same as test293, but for -info: instead of -err:
test496137a()12948 public void test496137a(){
12949 	createCascadedJars();
12950 	this.runConformTest(
12951 		new String[] {
12952 			"src/p/X.java",
12953 			"package p;\n" +
12954 			"/** */\n" +
12955 			"public class X {\n" +
12956 			"  A a;\n" +
12957 			"}",
12958 		},
12959 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
12960 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar[~p/A]\""
12961 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
12962 		+ " -1.5 -g -preserveAllLocals"
12963 		+ " -proceedOnError -referenceInfo -info:+discouraged"
12964 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
12965 		"",
12966 		"----------\n" +
12967 		"1. INFO in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" +
12968 		"	A a;\n" +
12969 		"	^\n" +
12970 		"Discouraged access: The type \'A\' is not API (restriction on classpath entry \'---LIB_DIR_PLACEHOLDER---/lib3.jar\')\n" +
12971 		"----------\n" +
12972 		"1 problem (1 info)\n",
12973 		true);
12974 }
12975 //same as test294, but for -info: instead of -err:
test496137b()12976 public void test496137b(){
12977 	this.runConformTest(
12978 		new String[] {
12979 			"src/X.java",
12980 			"public class X {\n" +
12981 			"}",
12982 		},
12983 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
12984 		+ " -cp \"" + LIB_DIR + "\""
12985 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
12986 		+ " -1.5 -g -preserveAllLocals"
12987 		+ " -proceedOnError -referenceInfo -info:+discouraged2"
12988 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
12989 		"",
12990 		"invalid info token: \'discouraged2\'. Ignoring this info token and compiling\n",
12991 		true);
12992 }
12993 //same as test296, but for -info: instead of -err:
test496137c()12994 public void test496137c(){
12995 	this.runNegativeTest(
12996 		new String[] {
12997 			"src/X.java",
12998 			"public class X {\n" +
12999 			"}",
13000 		},
13001 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
13002 		+ " -cp \"" + LIB_DIR + "\""
13003 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
13004 		+ " -1.5 -g -preserveAllLocals"
13005 		+ " -proceedOnError -referenceInfo -info:"
13006 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
13007 		"",
13008 		"invalid info configuration: \'-info:\'\n",
13009 		true);
13010 }
13011 //same as test297, but for -info: instead of -err:
test496137d()13012 public void test496137d(){
13013 	this.runNegativeTest(
13014 		new String[] {
13015 			"src/X.java",
13016 			"public class X {\n" +
13017 			"}",
13018 		},
13019 		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
13020 		+ " -cp \"" + LIB_DIR + "\""
13021 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
13022 		+ " -1.5 -g -preserveAllLocals"
13023 		+ " -proceedOnError -referenceInfo -info"
13024 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
13025 		"",
13026 		"invalid info configuration: \'-info\'\n",
13027 		true);
13028 }
13029 //same as testBug375366b, but for =info: instead of =warning:
test496137e()13030 public void test496137e() throws IOException {
13031 	createOutputTestDirectory("regression/.settings");
13032 	Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs",
13033 			"eclipse.preferences.version=1\n" +
13034 			"org.eclipse.jdt.core.compiler.problem.unusedParameter=info\n" +
13035 			"org.eclipse.jdt.core.compiler.doc.comment.support=disabled\n");
13036 	this.runTest(
13037 		true, // compile OK, expecting only warning
13038 		new String[] {
13039 			"bugs/warning/ShowBug.java",
13040 			"package bugs.warning;\n" +
13041 			"\n" +
13042 			"public class ShowBug {\n" +
13043 			"	/**\n" +
13044 			"	 * \n" +
13045 			"	 * @param unusedParam\n" +
13046 			"	 */\n" +
13047 			"	public void foo(Object unusedParam) {\n" +
13048 			"		\n" +
13049 			"	}\n" +
13050 			"}\n"
13051 		},
13052 		"\"" + OUTPUT_DIR +  File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\""
13053 		+ " -1.5"
13054 		+ " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs "
13055 		+ " -d \"" + OUTPUT_DIR + "\"",
13056 		"",
13057 		"----------\n" +
13058 		"1. INFO in ---OUTPUT_DIR_PLACEHOLDER---/bugs/warning/ShowBug.java (at line 8)\n" +
13059 		"	public void foo(Object unusedParam) {\n" +
13060 		"	                       ^^^^^^^^^^^\n" +
13061 		"The value of the parameter unusedParam is not used\n" +
13062 		"----------\n" +
13063 		"1 problem (1 info)\n",
13064 		false /*don't flush output dir*/,
13065 		null /* progress */);
13066 }
13067 // variation of test496137a to test that -warn:none turns off all info, too
test496137f()13068 public void test496137f(){
13069 	createCascadedJars();
13070 	this.runConformTest(
13071 		new String[] {
13072 			"src/p/X.java",
13073 			"package p;\n" +
13074 			"/** */\n" +
13075 			"public class X {\n" +
13076 			"  A a;\n" +
13077 			"}",
13078 		},
13079 		"\"" + OUTPUT_DIR +  File.separator + "src/p/X.java\""
13080 		+ " -cp \"" + LIB_DIR + File.separator + "lib3.jar[~p/A]\""
13081 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
13082 		+ " -1.5 -g -preserveAllLocals"
13083 		+ " -proceedOnError -referenceInfo -info:+discouraged -warn:none"
13084 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
13085 		"",
13086 		"",
13087 		true);
13088 }
testReleaseOption()13089 public void testReleaseOption() throws Exception {
13090 	try {
13091 		SourceVersion valueOf = SourceVersion.valueOf("RELEASE_9");
13092 		if (valueOf != null)
13093 			return;
13094 	} catch(IllegalArgumentException iae) {
13095 		// Ignore
13096 	}
13097 	this.runNegativeTest(
13098 			new String[] {
13099 				"X.java",
13100 				"/** */\n" +
13101 				"public class X {\n" +
13102 				"}",
13103 			},
13104 	     "\"" + OUTPUT_DIR +  File.separator + "X.java\""
13105 	     + " --release 8 -d \"" + OUTPUT_DIR + "\"",
13106 	     "",
13107 	     "option --release is supported only when run with JDK 9 or above\n",
13108 	     true);
13109 }
13110 
testBug531579()13111 public void testBug531579() throws Exception {
13112 	if (!isJRE9Plus) return;
13113 	// these types replace inaccessible types from JRE/javax.xml.bind:
13114 	runConformTest(new String[] {
13115 			"src/javax/xml/bind/JAXBContext.java",
13116 			"package javax.xml.bind;\n" +
13117 			"public abstract class JAXBContext {\n" +
13118 			"	public static JAXBContext newInstance( String contextPath )\n" +
13119 			"		throws JAXBException {\n" +
13120 			"		return null;\n" +
13121 			"	}\n" +
13122 			"}\n",
13123 			"src/javax/xml/bind/JAXBException.java",
13124 			"package javax.xml.bind;\n" +
13125 			"public class JAXBException extends Exception {}\n"
13126 		},
13127 		"\"" + OUTPUT_DIR +  File.separator + "src/javax/xml/bind/JAXBContext.java\""
13128 		+ " \"" + OUTPUT_DIR +  File.separator + "src/javax/xml/bind/JAXBException.java\""
13129 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
13130 		+ " -1.8"
13131 		+ " -warn:none"
13132 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
13133 		"",
13134 		"",
13135 		true);
13136 
13137 	runConformTest(new String[] {
13138 			"src/p1/ImportJAXBType.java",
13139 			"package p1;\n" +
13140 			"\n" +
13141 			"import javax.xml.bind.JAXBContext;\n" +
13142 			"\n" +
13143 			"public class ImportJAXBType {\n" +
13144 			"\n" +
13145 			"	public static void main(String[] args) throws Exception {\n" +
13146 			"		JAXBContext context = JAXBContext.newInstance(\"\");\n" +
13147 			"	}\n" +
13148 			"\n" +
13149 			"}\n"
13150 		},
13151 		"\"" + OUTPUT_DIR +  File.separator + "src/p1/ImportJAXBType.java\""
13152 		+ " -cp \"" + OUTPUT_DIR + File.separator + "bin\" "
13153 		+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
13154 		+ " -1.9"
13155 		+ " -warn:none"
13156 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
13157 		"",
13158 		"",
13159 		false);
13160 }
13161 
testFailOnWarnings_NoWarning()13162 public void testFailOnWarnings_NoWarning() {
13163 	this.runConformTest(
13164 		new String[] {
13165 			"X.java",
13166 			"/** */\n" +
13167 			"public class X {\n" +
13168 			"}",
13169 		},
13170 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
13171 		+ " -failOnWarning"
13172 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin/\"",
13173 		"",
13174 		"",
13175 		true);
13176 
13177 }
13178 
testFailOnWarnings_WithWarning()13179 public void testFailOnWarnings_WithWarning() {
13180 	this.runNegativeTest(
13181 		new String[] {
13182 			"X.java",
13183 			"/** */\n" +
13184 			"public class X {\n" +
13185 			"private int a;\n" +
13186 			"}",
13187 		},
13188 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
13189 		+ " -failOnWarning"
13190 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin/\"",
13191 		"",
13192 		"----------\n" +
13193 		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
13194 		"	private int a;\n" +
13195 		"	            ^\n" +
13196 		"The value of the field X.a is not used\n" +
13197 		"----------\n" +
13198 		"1 problem (1 warning)\n" +
13199 		"error: warnings found and -failOnWarning specified\n" +
13200 		"",
13201 		true);
13202 }
testUnusedObjectAllocation()13203 public void testUnusedObjectAllocation() {
13204 	runNegativeTest(
13205 		new String[] {
13206 			"X.java",
13207 			"public class X {\n" +
13208 			"	void foo() {\n" +
13209 			"		new X();\n" +
13210 			"	}\n" +
13211 			"}\n"
13212 		},
13213 		"\"" + OUTPUT_DIR +  File.separator + "X.java\""
13214 		+ " -err:+unused"
13215 		+ " -d \"" + OUTPUT_DIR + File.separator + "bin/\"",
13216 		"",
13217 		"----------\n" +
13218 		"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
13219 		"	new X();\n" +
13220 		"	^^^^^^^\n" +
13221 		"The allocated object is never used\n" +
13222 		"----------\n" +
13223 		"1 problem (1 error)\n",
13224 		true);
13225 
13226 }
13227 }
13228