### 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.365 diff -u -r1.365 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 28 Jul 2011 17:07:36 -0000 1.365 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 18 Aug 2011 18:02:58 -0000 @@ -2204,23 +2204,20 @@ this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$ } int warnTokenStart; - boolean isEnabling, allowPlusOrMinus; + boolean isEnabling; switch (warningOption.charAt(6)) { case '+' : warnTokenStart = 7; isEnabling = true; - allowPlusOrMinus = true; break; case '-' : warnTokenStart = 7; isEnabling = false; // specified warnings are disabled - allowPlusOrMinus = true; break; default: disableWarnings(); warnTokenStart = 6; isEnabling = true; - allowPlusOrMinus = false; } StringTokenizer tokenizer = @@ -2236,22 +2233,12 @@ tokenCounter++; switch(token.charAt(0)) { case '+' : - if (allowPlusOrMinus) { - isEnabling = true; - token = token.substring(1); - } else { - throw new IllegalArgumentException( - this.bind("configure.invalidUsageOfPlusOption", token)); //$NON-NLS-1$ - } + isEnabling = true; + token = token.substring(1); break; case '-' : - if (allowPlusOrMinus) { - isEnabling = false; - token = token.substring(1); - } else { - throw new IllegalArgumentException( - this.bind("configure.invalidUsageOfMinusOption", token)); //$NON-NLS-1$ - } + isEnabling = false; + token = token.substring(1); } handleWarningToken(token, isEnabling); } @@ -2270,23 +2257,20 @@ this.bind("configure.invalidErrorConfiguration", errorOption)); //$NON-NLS-1$ } int errorTokenStart; - boolean isEnabling, allowPlusOrMinus; + boolean isEnabling; switch (errorOption.charAt(5)) { case '+' : errorTokenStart = 6; isEnabling = true; - allowPlusOrMinus = true; break; case '-' : errorTokenStart = 6; isEnabling = false; // specified errors are disabled - allowPlusOrMinus = true; break; default: disableErrors(); errorTokenStart = 5; isEnabling = true; - allowPlusOrMinus = false; } StringTokenizer tokenizer = @@ -2298,22 +2282,12 @@ tokenCounter++; switch(token.charAt(0)) { case '+' : - if (allowPlusOrMinus) { - isEnabling = true; - token = token.substring(1); - } else { - throw new IllegalArgumentException( - this.bind("configure.invalidUsageOfPlusOption", token)); //$NON-NLS-1$ - } + isEnabling = true; + token = token.substring(1); break; case '-' : - if (allowPlusOrMinus) { - isEnabling = false; - token = token.substring(1); - } else { - throw new IllegalArgumentException( - this.bind("configure.invalidUsageOfMinusOption", token)); //$NON-NLS-1$ - } + isEnabling = false; + token = token.substring(1); break; } handleErrorToken(token, isEnabling); @@ -2838,6 +2812,20 @@ } this.options.put(CompilerOptions.OPTION_TaskTags, Util.EMPTY_STRING); } +protected void enableAllWarnings() { + Object[] entries = this.options.entrySet().toArray(); + for (int i = 0, max = entries.length; i < max; i++) { + Map.Entry entry = (Map.Entry) entries[i]; + if (!(entry.getKey() instanceof String)) + continue; + if (!(entry.getValue() instanceof String)) + continue; + if (((String) entry.getValue()).equals(CompilerOptions.IGNORE)) { + this.options.put(entry.getKey(), CompilerOptions.WARNING); + } + } + this.options.put(CompilerOptions.OPTION_TaskTags, Util.EMPTY_STRING); +} protected void disableErrors() { Object[] entries = this.options.entrySet().toArray(); for (int i = 0, max = entries.length; i < max; i++) { @@ -3251,6 +3239,13 @@ setSeverity(CompilerOptions.OPTION_ReportMethodCanBeStatic, severity, isEnabling); setSeverity(CompilerOptions.OPTION_ReportMethodCanBePotentiallyStatic, severity, isEnabling); return; + } else if (token.equals("all")) { //$NON-NLS-1$ + if (isEnabling) { + enableAllWarnings(); + } else { + disableWarnings(); + } + return; } break; case 'b' : 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.994 diff -u -r1.994 messages.properties --- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 16 Aug 2011 19:12:00 -0000 1.994 +++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 18 Aug 2011 18:02:58 -0000 @@ -66,8 +66,6 @@ configure.invalidErrorConfiguration = invalid error configuration: ''{0}'' configure.invalidError = invalid error token: ''{0}''. Ignoring this error token and compiling configure.invalidErrorOption = invalid error option: ''{0}''. Must specify an error token -configure.invalidUsageOfPlusOption=usage of ''+'' for ''{0}'' is illegal there -configure.invalidUsageOfMinusOption=usage of ''-'' for ''{0}'' is illegal there ## configure.directoryNotExist = directory does not exist: {0} configure.unrecognizedOption = Unrecognized option : {0} @@ -265,6 +263,7 @@ \ -warn: enable exactly the listed warnings\n\ \ -warn:+ enable additional warnings\n\ \ -warn:- disable specific warnings\n\ +\ all enable all warnings\n\ \ allDeadCode dead code including trivial if(DEBUG) check\n\ \ allDeprecation deprecation including inside deprecated code\n\ \ allJavadoc invalid or missing javadoc\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.227 diff -u -r1.227 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 8 Aug 2011 09:51:23 -0000 1.227 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 18 Aug 2011 18:02:59 -0000 @@ -1659,6 +1659,7 @@ " -warn: enable exactly the listed warnings\n" + " -warn:+ enable additional warnings\n" + " -warn:- disable specific warnings\n" + + " all enable all warnings\n" + " allDeadCode dead code including trivial if(DEBUG) check\n" + " allDeprecation deprecation including inside deprecated code\n" + " allJavadoc invalid or missing javadoc\n" + @@ -8510,48 +8511,6 @@ "1 problem (1 warning)", true); } -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210518 -// variant -public void test214_warn_options() { - // same source as 153, skip default checks - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void foo() {\n" + - " String s = null;\n" + - " s.toString();\n" + - " String u;\n" + - " }\n" + - "}", - }, - "\"" + OUTPUT_DIR + File.separator + "X.java\"" - + " -warn:null,-unused -proc:none -d \"" + OUTPUT_DIR + "\"", - "", - "usage of \'-\' for \'-unused\' is illegal there\n", - true); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210518 -// variant -public void test215_warn_options() { - // same source as 153, skip default checks - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void foo() {\n" + - " String s = null;\n" + - " s.toString();\n" + - " String u;\n" + - " }\n" + - "}", - }, - "\"" + OUTPUT_DIR + File.separator + "X.java\"" - + " -warn:null,+unused -proc:none -d \"" + OUTPUT_DIR + "\"", - "", - "usage of \'+\' for \'+unused\' is illegal there\n", - true); -} // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588 // variant - check impact of javadoc upon other warnings public void _test216a_warn_options() { @@ -11398,24 +11357,6 @@ true); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784 -public void test295(){ - this.runNegativeTest( - new String[] { - "src/X.java", - "public class X {\n" + - "}", - }, - "\"" + OUTPUT_DIR + File.separator + "src/X.java\"" - + " -cp \"" + LIB_DIR + "\"" - + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" - + " -1.5 -g -preserveAllLocals" - + " -proceedOnError -referenceInfo -err:raw,+discouraged" - + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", - "", - "usage of \'+\' for \'+discouraged\' is illegal there\n", - true); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784 public void test296(){ this.runNegativeTest( new String[] {