### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v retrieving revision 1.351 diff -u -r1.351 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 25 Feb 2010 19:17:04 -0000 1.351 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 20 Apr 2010 18:15:17 -0000 @@ -15,8 +15,10 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.batch; +import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilenameFilter; @@ -41,6 +43,7 @@ import java.util.Locale; import java.util.Map; import java.util.MissingResourceException; +import java.util.Properties; import java.util.ResourceBundle; import java.util.Set; import java.util.StringTokenizer; @@ -1713,6 +1716,7 @@ final int INSIDE_PROCESSOR_start = 18; final int INSIDE_S_start = 19; final int INSIDE_CLASS_NAMES = 20; + final int INSIDE_WARNINGS_PROPERTIES = 21; final int DEFAULT = 0; ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); @@ -2095,7 +2099,7 @@ continue; } if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$ - mode = DEFAULT; + mode = DEFAULT; this.options.put( CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED); @@ -2368,6 +2372,10 @@ mode = INSIDE_CLASS_NAMES; continue; } + if (currentArg.equals("-properties")) { //$NON-NLS-1$ + mode = INSIDE_WARNINGS_PROPERTIES; + continue; + } break; case INSIDE_TARGET : if (this.didSpecifyTarget) { @@ -2544,6 +2552,10 @@ } mode = DEFAULT; continue; + case INSIDE_WARNINGS_PROPERTIES : + initializeWarnings(currentArg); + mode = DEFAULT; + continue; } // default is input directory, if no custom destination path exists @@ -2720,6 +2732,31 @@ this.pendingErrors = null; } } +private void initializeWarnings(String propertiesFile) { + File file = new File(propertiesFile); + if (!file.exists()) { + throw new IllegalArgumentException(this.bind("configure.missingwarningspropertiesfile", propertiesFile)); //$NON-NLS-1$ + } + BufferedInputStream stream = null; + Properties properties = null; + try { + stream = new BufferedInputStream(new FileInputStream(propertiesFile)); + properties = new Properties(); + properties.load(stream); + } catch(IOException e) { + e.printStackTrace(); + throw new IllegalArgumentException(this.bind("configure.ioexceptionwarningspropertiesfile", propertiesFile)); //$NON-NLS-1$ + } finally { + if (stream != null) { + try { + stream.close(); + } catch(IOException e) { + // ignore + } + } + } + this.options.putAll(properties); +} protected void disableWarnings() { Object[] entries = this.options.entrySet().toArray(); for (int i = 0, max = entries.length; i < max; i++) { Index: batch/org/eclipse/jdt/internal/compiler/batch/messages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties,v retrieving revision 1.891 diff -u -r1.891 messages.properties --- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 20 Apr 2010 11:48:19 -0000 1.891 +++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 20 Apr 2010 18:15:17 -0000 @@ -95,6 +95,8 @@ configure.incompatibleComplianceForCldcTarget=Target level ''{0}'' is incompatible with compliance level ''{1}''. A compliance level ''1.4''or lower is required configure.invalidClasspathSection = invalid Class-Path header in manifest of jar file: {0} configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0} +configure.missingwarningspropertiesfile=properties file {0} does not exist +configure.ioexceptionwarningspropertiesfile=An IOException occurred while reading the properties file {0} ### requestor requestor.error = {0}. ERROR in {1} @@ -182,6 +184,12 @@ \ -err:- disable specific warnings to be\n\ \ reported as errors\n\ \ \n\ +\ Setting warning or error options using properties file:\n\ +\ -properties: set warnings/errors option based on the properties\n\ +\ file contents. This option can be used with -nowarn,\n\ +\ -err:.. or -warn:.. options, but the last one on the\n\ +\ command line sets the options to be used.\n\ +\ \n\ \ Debug options:\n\ \ -g[:lines,vars,source] custom debug info\n\ \ -g:lines,source + both lines table and source debug info\n\ #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.205 diff -u -r1.205 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 17 Mar 2010 16:10:02 -0000 1.205 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 20 Apr 2010 18:15:21 -0000 @@ -48,7 +48,7 @@ static { // TESTS_NAMES = new String[] { "test292_warn_options" }; -// TESTS_NUMBERS = new int[] { 298 }; +// TESTS_NUMBERS = new int[] { 12 }; // TESTS_RANGE = new int[] { 298, -1 }; } public BatchCompilerTest(String name) { @@ -1553,6 +1553,12 @@ " -err:- disable specific warnings to be\n" + " reported as errors\n" + " \n" + + " Setting warning or error options using properties file:\n" + + " -properties: set warnings/errors option based on the properties\n" + + " file contents. This option can be used with -nowarn,\n" + + " -err:.. or -warn:.. options, but the last one on the\n" + + " command line sets the options to be used.\n" + + " \n" + " Debug options:\n" + " -g[:lines,vars,source] custom debug info\n" + " -g:lines,source + both lines table and source debug info\n" +