### Eclipse Workspace Patch 1.0 #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.170 diff -u -r1.170 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 26 Aug 2008 11:52:59 -0000 1.170 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 5 Sep 2008 10:20:03 -0000 @@ -1660,6 +1660,7 @@ " indirectStatic indirect reference to static member\n" + " intfAnnotation + annotation type used as super interface\n" + " intfNonInherited + interface non-inherited method compatibility\n" + + " intfRedundant + find redundant superinterfaces\n" + " javadoc invalid javadoc\n" + " localHiding local variable hiding another variable\n" + " maskedCatchBlock + hidden catch block\n" + @@ -1671,7 +1672,6 @@ " paramAssign assignment to a parameter\n" + " pkgDefaultMethod + attempt to override package-default method\n" + " raw + usage of raw type\n" + - " redundantSuperinterface + find redundant superinterfaces\n" + " semicolon unnecessary semicolon, empty statement\n" + " serial + missing serialVersionUID\n" + " specialParamHiding constructor or setter parameter hiding a field\n" + @@ -1679,14 +1679,12 @@ " staticReceiver + non-static reference to static member\n" + " super overriding a method without making a super invocation\n" + " suppress + enable @SuppressWarnings\n" + - " syncOverride overriding a synchronized method without synchronizing it\n" + - " synthetic-access same as syntheticAccess\n" + + " syncOverride missing synchronized in synchr. method override\n" + " syntheticAccess synthetic access for innerclass\n" + " tasks() tasks identified by tags inside comments\n" + " typeHiding + type parameter hiding another type\n" + " unchecked + unchecked type operation\n" + " unnecessaryElse unnecessary else clause\n" + - " unqualified-field-access same as unqualifiedField\n" + " unqualifiedField unqualified reference to field\n" + " unused macro for unusedArgument, unusedImport, unusedLabel,\n" + " unusedLocal, unusedPrivate, unusedThrown,\n" + @@ -10963,4 +10961,67 @@ "Unrecognized option : @options2.txt\n" /* stderr */, true /*shouldFlushOutput*/); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=246066 +public void test288_warn_options() { + this.runConformTest( + new String[] { + "X.java", + "interface IX {}\n" + + "class BaseX implements IX {}\n" + + "public class X extends BaseX implements IX {\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "X.java\"" + + " -sourcepath \"" + OUTPUT_DIR + "\"" + + " -warn:+intfRedundant -proc:none -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" + + " public class X extends BaseX implements IX {\n" + + " ^^\n" + + "Redundant superinterface IX for the type X, already defined by BaseX\n" + + "----------\n" + + "1 problem (1 warning)", + true); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=246066 - variation +public void test289_warn_options() { + this.runConformTest( + new String[] { + "X.java", + "interface IX {}\n" + + "class BaseX implements IX {}\n" + + "public class X extends BaseX implements IX {\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "X.java\"" + + " -sourcepath \"" + OUTPUT_DIR + "\"" + + " -warn:+redundantSuperinterface -proc:none -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" + + " public class X extends BaseX implements IX {\n" + + " ^^\n" + + "Redundant superinterface IX for the type X, already defined by BaseX\n" + + "----------\n" + + "1 problem (1 warning)", + true); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=246066 - variation +public void test290_warn_options() { + this.runConformTest( + new String[] { + "X.java", + "interface IX {}\n" + + "class BaseX implements IX {}\n" + + "public class X extends BaseX implements IX {\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "X.java\"" + + " -sourcepath \"" + OUTPUT_DIR + "\"" + + " -warn:+intfRedundant -warn:-intfRedundant -proc:none -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); +} } #P org.eclipse.jdt.core 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.760 diff -u -r1.760 messages.properties --- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 4 Sep 2008 13:12:28 -0000 1.760 +++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 5 Sep 2008 10:20:05 -0000 @@ -257,6 +257,7 @@ \ indirectStatic indirect reference to static member\n\ \ intfAnnotation + annotation type used as super interface\n\ \ intfNonInherited + interface non-inherited method compatibility\n\ +\ intfRedundant + find redundant superinterfaces\n\ \ javadoc invalid javadoc\n\ \ localHiding local variable hiding another variable\n\ \ maskedCatchBlock + hidden catch block\n\ @@ -268,7 +269,6 @@ \ paramAssign assignment to a parameter\n\ \ pkgDefaultMethod + attempt to override package-default method\n\ \ raw + usage of raw type\n\ -\ redundantSuperinterface + find redundant superinterfaces\n\ \ semicolon unnecessary semicolon, empty statement\n\ \ serial + missing serialVersionUID\n\ \ specialParamHiding constructor or setter parameter hiding a field\n\ @@ -276,14 +276,12 @@ \ staticReceiver + non-static reference to static member\n\ \ super overriding a method without making a super invocation\n\ \ suppress + enable @SuppressWarnings\n\ -\ syncOverride overriding a synchronized method without synchronizing it\n\ -\ synthetic-access same as syntheticAccess\n\ +\ syncOverride missing synchronized in synchr. method override\n\ \ syntheticAccess synthetic access for innerclass\n\ \ tasks() tasks identified by tags inside comments\n\ \ typeHiding + type parameter hiding another type\n\ \ unchecked + unchecked type operation\n\ \ unnecessaryElse unnecessary else clause\n\ -\ unqualified-field-access same as unqualifiedField\n\ \ unqualifiedField unqualified reference to field\n\ \ unused macro for unusedArgument, unusedImport, unusedLabel,\n\ \ unusedLocal, unusedPrivate, unusedThrown,\n\ 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.331 diff -u -r1.331 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 26 Aug 2008 11:52:53 -0000 1.331 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 5 Sep 2008 10:20:05 -0000 @@ -381,7 +381,7 @@ // find out an option name controlling a given problemID private String getProblemOptionKey(int problemID) { - long irritant = ProblemReporter.getIrritant(problemID); + int irritant = ProblemReporter.getIrritant(problemID); return CompilerOptions.optionKeyFromIrritant(irritant); } @@ -3056,319 +3056,451 @@ * Handle a single warning token. */ protected void handleWarningToken(String token, boolean isEnabling) throws InvalidInputException { - if (token.equals("constructorName")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportMethodWithConstructorName, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("pkgDefaultMethod") || token.equals("packageDefaultMethod")/*backward compatible*/ ) { //$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("maskedCatchBlock") || token.equals("maskedCatchBlocks")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportHiddenCatchBlock, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("deprecation")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportDeprecation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, - CompilerOptions.DISABLED); - this.options.put( - CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, - CompilerOptions.DISABLED); - } else if (token.equals("allDeprecation")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportDeprecation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, - isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); - this.options.put( - CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, - isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); - } else if (token.equals("unusedLocal") || token.equals("unusedLocals")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedLocal, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unusedArgument") || token.equals("unusedArguments")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedParameter, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unusedImport") || token.equals("unusedImports")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedImport, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unusedPrivate")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedPrivateMember, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unusedLabel")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedLabel, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("localHiding")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportLocalVariableHiding, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("fieldHiding")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportFieldHiding, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("specialParamHiding")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportSpecialParameterHidingField, - isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); - } else if (token.equals("conditionAssign")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("syntheticAccess") //$NON-NLS-1$ - || token.equals("synthetic-access")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportSyntheticAccessEmulation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("nls")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("staticReceiver")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportNonStaticAccessToStatic, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("indirectStatic")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportIndirectStaticAccess, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("noEffectAssign")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportNoEffectAssignment, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("compareIdentical")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportComparingIdentical, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("syncOverride")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportMissingSynchronizedOnInheritedMethod, - isEnabling ? CompilerOptions.ERROR : CompilerOptions.IGNORE); - } else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("charConcat") || token.equals("noImplicitStringConversion")/*backward compatible*/) {//$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportNoImplicitStringConversion, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("semicolon")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportEmptyStatement, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("serial")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportMissingSerialVersion, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("emptyBlock")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("uselessTypeCheck")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unchecked") || token.equals("unsafe")) {//$NON-NLS-1$ //$NON-NLS-2$ - this.options.put( - CompilerOptions.OPTION_ReportUncheckedTypeOperation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("raw")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportRawTypeReference, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("finalBound")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportFinalParameterBound, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("suppress")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_SuppressWarnings, - isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); - } else if (token.equals("warningToken")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnhandledWarningToken, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedWarningToken, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unnecessaryElse")) {//$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnnecessaryElse, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("javadoc")) {//$NON-NLS-1$ - this.warnJavadocOn = isEnabling; - } else if (token.equals("allJavadoc")) { //$NON-NLS-1$ - this.warnAllJavadocOn = this.warnJavadocOn = isEnabling; - } else if (token.startsWith("tasks")) { //$NON-NLS-1$ - String taskTags = Util.EMPTY_STRING; - int start = token.indexOf('('); - int end = token.indexOf(')'); - if (start >= 0 && end >= 0 && start < end){ - taskTags = token.substring(start+1, end).trim(); - taskTags = taskTags.replace('|',','); - } - if (taskTags.length() == 0){ - throw new InvalidInputException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$ - } - this.options.put( - CompilerOptions.OPTION_TaskTags, - isEnabling ? taskTags : Util.EMPTY_STRING); - } else if (token.equals("assertIdentifier")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportAssertIdentifier, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("enumIdentifier")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportEnumIdentifier, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("finally")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unusedThrown")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unqualifiedField") //$NON-NLS-1$ - || token.equals("unqualified-field-access")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnqualifiedFieldAccess, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("typeHiding")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportTypeParameterHiding, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("varargsCast")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportVarargsArgumentNeedCast, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("null")) { //$NON-NLS-1$ - if (isEnabling) { - this.options.put(CompilerOptions.OPTION_ReportNullReference, - CompilerOptions.WARNING); - this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference, - CompilerOptions.WARNING); - this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, - CompilerOptions.WARNING); - } else { - this.options.put(CompilerOptions.OPTION_ReportNullReference, - CompilerOptions.IGNORE); - this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference, - CompilerOptions.IGNORE); - this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, - CompilerOptions.IGNORE); - } - } else if (token.equals("nullDereference")) { //$NON-NLS-1$ - if (isEnabling) { - this.options.put(CompilerOptions.OPTION_ReportNullReference, - CompilerOptions.WARNING); - } else { - this.options.put(CompilerOptions.OPTION_ReportNullReference, - CompilerOptions.IGNORE); - this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference, - CompilerOptions.IGNORE); - this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, - CompilerOptions.IGNORE); - } - } else if (token.equals("boxing")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportAutoboxing, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("over-ann")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportMissingOverrideAnnotation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("dep-ann")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportMissingDeprecatedAnnotation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("intfAnnotation")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportAnnotationSuperInterface, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("enumSwitch") //$NON-NLS-1$ - || token.equals("incomplete-switch")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportIncompleteEnumSwitch, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("hiding")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportHiddenCatchBlock, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportLocalVariableHiding, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportFieldHiding, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportTypeParameterHiding, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("static-access")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportNonStaticAccessToStatic, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportIndirectStaticAccess, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unused")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedLocal, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedParameter, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedImport, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedPrivateMember, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedLabel, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - this.options.put( - CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("paramAssign")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportParameterAssignment, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("discouraged")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportDiscouragedReference, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("forbidden")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportForbiddenReference, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("fallthrough")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportFallthroughCase, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("super")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else if (token.equals("unusedTypeArgs")) { //$NON-NLS-1$ - this.options.put( - CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, - isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); - } else { - addPendingErrors(this.bind("configure.invalidWarning", token)); //$NON-NLS-1$ + if (token.length() == 0) return; + switch(token.charAt(0)) { + case 'a' : + if (token.equals("allDeprecation")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportDeprecation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, + isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); + this.options.put( + CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, + isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); + return; + } else if (token.equals("allJavadoc")) { //$NON-NLS-1$ + this.warnAllJavadocOn = this.warnJavadocOn = isEnabling; + return; + } else if (token.equals("assertIdentifier")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportAssertIdentifier, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'b' : + if (token.equals("boxing")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportAutoboxing, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'c' : + if (token.equals("constructorName")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportMethodWithConstructorName, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("conditionAssign")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("compareIdentical")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportComparingIdentical, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("charConcat") /*|| token.equals("noImplicitStringConversion")/*backward compatible*/) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNoImplicitStringConversion, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'd' : + if (token.equals("deprecation")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportDeprecation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, + CompilerOptions.DISABLED); + this.options.put( + CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, + CompilerOptions.DISABLED); + return; + } else if (token.equals("dep-ann")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportMissingDeprecatedAnnotation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("discouraged")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportDiscouragedReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'e' : + if (token.equals("enumSwitch") //$NON-NLS-1$ + || token.equals("incomplete-switch")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportIncompleteEnumSwitch, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("emptyBlock")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("enumIdentifier")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportEnumIdentifier, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'f' : + if (token.equals("fieldHiding")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportFieldHiding, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("finalBound")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportFinalParameterBound, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("finally")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("forbidden")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportForbiddenReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("fallthrough")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportFallthroughCase, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'h' : + if (token.equals("hiding")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportHiddenCatchBlock, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportLocalVariableHiding, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportFieldHiding, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportTypeParameterHiding, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'i' : + if (token.equals("indirectStatic")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportIndirectStaticAccess, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("intfAnnotation")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportAnnotationSuperInterface, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("intfRedundant") /*|| token.equals("redundantSuperinterface")*/) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportRedundantSuperinterface, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'j' : + if (token.equals("javadoc")) {//$NON-NLS-1$ + this.warnJavadocOn = isEnabling; + return; + } + break; + case 'l' : + if (token.equals("localHiding")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportLocalVariableHiding, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'm' : + if (token.equals("maskedCatchBlock") || token.equals("maskedCatchBlocks")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportHiddenCatchBlock, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'n' : + if (token.equals("nls")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("noEffectAssign")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNoEffectAssignment, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (/*token.equals("charConcat") ||*/ token.equals("noImplicitStringConversion")/*backward compatible*/) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNoImplicitStringConversion, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("null")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNullReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportPotentialNullReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportRedundantNullCheck, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("nullDereference")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNullReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + if (!isEnabling) { + this.options.put( + CompilerOptions.OPTION_ReportPotentialNullReference, + CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportRedundantNullCheck, + CompilerOptions.IGNORE); + } + return; + } + break; + case 'o' : + if (token.equals("over-sync") /*|| token.equals("syncOverride")*/) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportMissingSynchronizedOnInheritedMethod, + isEnabling ? CompilerOptions.ERROR : CompilerOptions.IGNORE); + return; + } else if (token.equals("over-ann")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportMissingOverrideAnnotation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'p' : + if (token.equals("pkgDefaultMethod") || token.equals("packageDefaultMethod")/*backward compatible*/ ) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("paramAssign")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportParameterAssignment, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'r' : + if (token.equals("raw")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportRawTypeReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (/*token.equals("intfRedundant") ||*/ token.equals("redundantSuperinterface")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportRedundantSuperinterface, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 's' : + if (token.equals("specialParamHiding")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportSpecialParameterHidingField, + isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); + return; + } else if (token.equals("syntheticAccess") || token.equals("synthetic-access")) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportSyntheticAccessEmulation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("staticReceiver")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNonStaticAccessToStatic, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (/*token.equals("over-sync") ||*/ token.equals("syncOverride")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportMissingSynchronizedOnInheritedMethod, + isEnabling ? CompilerOptions.ERROR : CompilerOptions.IGNORE); + return; + } else if (token.equals("semicolon")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportEmptyStatement, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("serial")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportMissingSerialVersion, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("suppress")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_SuppressWarnings, + isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); + return; + } else if (token.equals("static-access")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportNonStaticAccessToStatic, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportIndirectStaticAccess, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("super")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 't' : + if (token.startsWith("tasks")) { //$NON-NLS-1$ + String taskTags = Util.EMPTY_STRING; + int start = token.indexOf('('); + int end = token.indexOf(')'); + if (start >= 0 && end >= 0 && start < end){ + taskTags = token.substring(start+1, end).trim(); + taskTags = taskTags.replace('|',','); + } + if (taskTags.length() == 0){ + throw new InvalidInputException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$ + } + this.options.put( + CompilerOptions.OPTION_TaskTags, + isEnabling ? taskTags : Util.EMPTY_STRING); + return; + } else if (token.equals("typeHiding")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportTypeParameterHiding, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'u' : + if (token.equals("unusedLocal") || token.equals("unusedLocals")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedLocal, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unusedArgument") || token.equals("unusedArguments")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedParameter, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unusedImport") || token.equals("unusedImports")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedImport, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unusedPrivate")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedPrivateMember, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unusedLabel")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedLabel, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("uselessTypeCheck")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unchecked") || token.equals("unsafe")) {//$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportUncheckedTypeOperation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unnecessaryElse")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnnecessaryElse, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unusedThrown")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unqualifiedField") || token.equals("unqualified-field-access")) { //$NON-NLS-1$ //$NON-NLS-2$ + this.options.put( + CompilerOptions.OPTION_ReportUnqualifiedFieldAccess, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unused")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedLocal, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedParameter, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedImport, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedPrivateMember, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedLabel, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } else if (token.equals("unusedTypeArgs")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'v' : + if (token.equals("varargsCast")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportVarargsArgumentNeedCast, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; + case 'w' : + if (token.equals("warningToken")) {//$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportUnhandledWarningToken, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + this.options.put( + CompilerOptions.OPTION_ReportUnusedWarningToken, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + return; + } + break; } + addPendingErrors(this.bind("configure.invalidWarning", token)); //$NON-NLS-1$ } /** * @deprecated - use {@link #initialize(PrintWriter, PrintWriter, boolean, Map, CompilationProgress)} instead