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

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-1 / +44 lines)
Lines 15-22 Link Here
15
 *******************************************************************************/
15
 *******************************************************************************/
16
package org.eclipse.jdt.internal.compiler.batch;
16
package org.eclipse.jdt.internal.compiler.batch;
17
17
18
import java.io.BufferedInputStream;
18
import java.io.ByteArrayInputStream;
19
import java.io.ByteArrayInputStream;
19
import java.io.File;
20
import java.io.File;
21
import java.io.FileInputStream;
20
import java.io.FileNotFoundException;
22
import java.io.FileNotFoundException;
21
import java.io.FileOutputStream;
23
import java.io.FileOutputStream;
22
import java.io.FilenameFilter;
24
import java.io.FilenameFilter;
Lines 41-46 Link Here
41
import java.util.Locale;
43
import java.util.Locale;
42
import java.util.Map;
44
import java.util.Map;
43
import java.util.MissingResourceException;
45
import java.util.MissingResourceException;
46
import java.util.Properties;
44
import java.util.ResourceBundle;
47
import java.util.ResourceBundle;
45
import java.util.Set;
48
import java.util.Set;
46
import java.util.StringTokenizer;
49
import java.util.StringTokenizer;
Lines 1713-1718 Link Here
1713
	final int INSIDE_PROCESSOR_start = 18;
1716
	final int INSIDE_PROCESSOR_start = 18;
1714
	final int INSIDE_S_start = 19;
1717
	final int INSIDE_S_start = 19;
1715
	final int INSIDE_CLASS_NAMES = 20;
1718
	final int INSIDE_CLASS_NAMES = 20;
1719
	final int INSIDE_WARNINGS_PROPERTIES = 21;
1716
1720
1717
	final int DEFAULT = 0;
1721
	final int DEFAULT = 0;
1718
	ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
1722
	ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
Lines 2095-2101 Link Here
2095
					continue;
2099
					continue;
2096
				}
2100
				}
2097
				if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$
2101
				if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$
2098
				    mode = DEFAULT;
2102
					mode = DEFAULT;
2099
					this.options.put(
2103
					this.options.put(
2100
							CompilerOptions.OPTION_InlineJsr,
2104
							CompilerOptions.OPTION_InlineJsr,
2101
							CompilerOptions.ENABLED);
2105
							CompilerOptions.ENABLED);
Lines 2368-2373 Link Here
2368
					mode = INSIDE_CLASS_NAMES;
2372
					mode = INSIDE_CLASS_NAMES;
2369
					continue;
2373
					continue;
2370
				}
2374
				}
2375
				if (currentArg.equals("-properties")) { //$NON-NLS-1$
2376
					mode = INSIDE_WARNINGS_PROPERTIES;
2377
					continue;
2378
				}
2371
				break;
2379
				break;
2372
			case INSIDE_TARGET :
2380
			case INSIDE_TARGET :
2373
				if (this.didSpecifyTarget) {
2381
				if (this.didSpecifyTarget) {
Lines 2544-2549 Link Here
2544
				}
2552
				}
2545
				mode = DEFAULT;
2553
				mode = DEFAULT;
2546
				continue;
2554
				continue;
2555
			case INSIDE_WARNINGS_PROPERTIES :
2556
				initializeWarnings(currentArg);
2557
				mode = DEFAULT;
2558
				continue;
2547
		}
2559
		}
2548
2560
2549
		// default is input directory, if no custom destination path exists
2561
		// default is input directory, if no custom destination path exists
Lines 2720-2725 Link Here
2720
		this.pendingErrors = null;
2732
		this.pendingErrors = null;
2721
	}
2733
	}
2722
}
2734
}
2735
private void initializeWarnings(String propertiesFile) {
2736
	File file = new File(propertiesFile);
2737
	if (!file.exists()) {
2738
		throw new IllegalArgumentException(this.bind("configure.missingwarningspropertiesfile", propertiesFile)); //$NON-NLS-1$
2739
	}
2740
	BufferedInputStream stream = null;
2741
	Properties properties = null;
2742
	try {
2743
		stream = new BufferedInputStream(new FileInputStream(propertiesFile));
2744
		properties = new Properties();
2745
		properties.load(stream);
2746
	} catch(IOException e) {
2747
		e.printStackTrace();
2748
		throw new IllegalArgumentException(this.bind("configure.ioexceptionwarningspropertiesfile", propertiesFile)); //$NON-NLS-1$
2749
	} finally {
2750
		if (stream != null) {
2751
			try {
2752
				stream.close();
2753
			} catch(IOException e) {
2754
				// ignore
2755
			}
2756
		}
2757
	}
2758
	for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext(); ) {
2759
		Map.Entry entry = (Map.Entry) iterator.next();
2760
		final String key = (String) entry.getKey();
2761
		if (key.startsWith("org.eclipse.jdt.core.compiler.problem")) { //$NON-NLS-1$
2762
			this.options.put(key, entry.getValue());
2763
		}
2764
	}
2765
}
2723
protected void disableWarnings() {
2766
protected void disableWarnings() {
2724
	Object[] entries = this.options.entrySet().toArray();
2767
	Object[] entries = this.options.entrySet().toArray();
2725
	for (int i = 0, max = entries.length; i < max; i++) {
2768
	for (int i = 0, max = entries.length; i < max; i++) {
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (+8 lines)
Lines 95-100 Link Here
95
configure.incompatibleComplianceForCldcTarget=Target level ''{0}'' is incompatible with compliance level ''{1}''. A compliance level ''1.4''or lower is required
95
configure.incompatibleComplianceForCldcTarget=Target level ''{0}'' is incompatible with compliance level ''{1}''. A compliance level ''1.4''or lower is required
96
configure.invalidClasspathSection = invalid Class-Path header in manifest of jar file: {0}
96
configure.invalidClasspathSection = invalid Class-Path header in manifest of jar file: {0}
97
configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0}
97
configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0}
98
configure.missingwarningspropertiesfile=properties file {0} does not exist
99
configure.ioexceptionwarningspropertiesfile=An IOException occurred while reading the properties file {0}
98
100
99
### requestor
101
### requestor
100
requestor.error = {0}. ERROR in {1}
102
requestor.error = {0}. ERROR in {1}
Lines 182-187 Link Here
182
\    -err:-<warnings separated by ,>   disable specific warnings to be\n\
184
\    -err:-<warnings separated by ,>   disable specific warnings to be\n\
183
\                                      reported as errors\n\
185
\                                      reported as errors\n\
184
\ \n\
186
\ \n\
187
\ Setting warning or error options using properties file:\n\
188
\    -properties: <file>   set warnings/errors option based on the properties\n\
189
\                          file contents. This option can be used with -nowarn,\n\
190
\                          -err:.. or -warn:.. options, but the last one on the\n\
191
\                          command line sets the options to be used.\n\
192
\ \n\
185
\ Debug options:\n\
193
\ Debug options:\n\
186
\    -g[:lines,vars,source] custom debug info\n\
194
\    -g[:lines,vars,source] custom debug info\n\
187
\    -g:lines,source  + both lines table and source debug info\n\
195
\    -g:lines,source  + both lines table and source debug info\n\
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-1 / +7 lines)
Lines 48-54 Link Here
48
48
49
	static {
49
	static {
50
//		TESTS_NAMES = new String[] { "test292_warn_options" };
50
//		TESTS_NAMES = new String[] { "test292_warn_options" };
51
//		TESTS_NUMBERS = new int[] { 298 };
51
//		TESTS_NUMBERS = new int[] { 12 };
52
//		TESTS_RANGE = new int[] { 298, -1 };
52
//		TESTS_RANGE = new int[] { 298, -1 };
53
	}
53
	}
54
public BatchCompilerTest(String name) {
54
public BatchCompilerTest(String name) {
Lines 1553-1558 Link Here
1553
        "    -err:-<warnings separated by ,>   disable specific warnings to be\n" + 
1553
        "    -err:-<warnings separated by ,>   disable specific warnings to be\n" + 
1554
        "                                      reported as errors\n" + 
1554
        "                                      reported as errors\n" + 
1555
        " \n" + 
1555
        " \n" + 
1556
        " Setting warning or error options using properties file:\n" + 
1557
        "    -properties: <file>   set warnings/errors option based on the properties\n" + 
1558
        "                          file contents. This option can be used with -nowarn,\n" + 
1559
        "                          -err:.. or -warn:.. options, but the last one on the\n" + 
1560
        "                          command line sets the options to be used.\n" + 
1561
        " \n" + 
1556
        " Debug options:\n" +
1562
        " Debug options:\n" +
1557
        "    -g[:lines,vars,source] custom debug info\n" +
1563
        "    -g[:lines,vars,source] custom debug info\n" +
1558
        "    -g:lines,source  + both lines table and source debug info\n" +
1564
        "    -g:lines,source  + both lines table and source debug info\n" +

Return to bug 291528