Andrew Overholt 9fa962a
Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java
Andrew Overholt 9fa962a
===================================================================
Andrew Overholt 9fa962a
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v
Andrew Overholt 9fa962a
retrieving revision 1.254
Andrew Overholt 9fa962a
diff -u -r1.254 Main.java
Andrew Overholt 9fa962a
--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java	2 May 2006 13:45:31 -0000	1.254
Andrew Overholt 9fa962a
+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java	18 Jul 2006 22:46:41 -0000
Andrew Overholt 9fa962a
@@ -1392,6 +1392,391 @@
Andrew Overholt 9fa962a
 }
Andrew Overholt 9fa962a
 
Andrew Overholt 9fa962a
 /*
Andrew Overholt 9fa962a
+Handle a single warning token.
Andrew Overholt 9fa962a
+*/
Andrew Overholt 9fa962a
+protected void handleWarningToken(String token, boolean isEnabling,
Andrew Overholt 9fa962a
+		boolean useEnableJavadoc) throws InvalidInputException {
Andrew Overholt 9fa962a
+	if (token.equals("constructorName")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportMethodWithConstructorName,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("pkgDefaultMethod") || token.equals("packageDefaultMethod")/*backward compatible*/ ) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("maskedCatchBlock") || token.equals("maskedCatchBlocks")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportHiddenCatchBlock,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("deprecation")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDeprecation, 
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, 
Andrew Overholt 9fa962a
+			CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, 
Andrew Overholt 9fa962a
+			CompilerOptions.DISABLED);						
Andrew Overholt 9fa962a
+	} else if (token.equals("allDeprecation")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDeprecation, 
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, 
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, 
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+	} else if (token.equals("unusedLocal") || token.equals("unusedLocals")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedLocal, 
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unusedArgument") || token.equals("unusedArguments")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedParameter,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unusedImport") || token.equals("unusedImports")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedImport,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unusedPrivate")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedPrivateMember,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unusedLabel")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedLabel,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("localHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportLocalVariableHiding,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("fieldHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportFieldHiding,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("specialParamHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportSpecialParameterHidingField,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+	} else if (token.equals("conditionAssign")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		} else if (token.equals("syntheticAccess") //$NON-NLS-1$
Andrew Overholt 9fa962a
+				|| token.equals("synthetic-access")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("nls")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportNonExternalizedStringLiteral,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("staticReceiver")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportNonStaticAccessToStatic,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("indirectStatic")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportIndirectStaticAccess,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("noEffectAssign")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportNoEffectAssignment,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("charConcat") || token.equals("noImplicitStringConversion")/*backward compatible*/) {//$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportNoImplicitStringConversion,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("semicolon")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportEmptyStatement,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("serial")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportMissingSerialVersion,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("emptyBlock")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUndocumentedEmptyBlock,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("uselessTypeCheck")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnnecessaryTypeCheck,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unchecked") || token.equals("unsafe")) {//$NON-NLS-1$ //$NON-NLS-2$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUncheckedTypeOperation,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("raw")) {//$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportRawTypeReference,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("finalBound")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportFinalParameterBound,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("suppress")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_SuppressWarnings,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+	} else if (token.equals("warningToken")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnhandledWarningToken,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unnecessaryElse")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnnecessaryElse,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("javadoc")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		if (!useEnableJavadoc) {
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_DocCommentSupport,
Andrew Overholt 9fa962a
+				isEnabling ? CompilerOptions.ENABLED: CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		// if disabling then it's not necessary to set other javadoc options
Andrew Overholt 9fa962a
+		if (isEnabling) {
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadoc,
Andrew Overholt 9fa962a
+				CompilerOptions.WARNING);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadocTags,
Andrew Overholt 9fa962a
+				CompilerOptions.ENABLED);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadocTagsDeprecatedRef,
Andrew Overholt 9fa962a
+				CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadocTagsNotVisibleRef,
Andrew Overholt 9fa962a
+				CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility,
Andrew Overholt 9fa962a
+				CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportMissingJavadocTags,
Andrew Overholt 9fa962a
+				CompilerOptions.WARNING);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility,
Andrew Overholt 9fa962a
+				CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	} else if (token.equals("allJavadoc")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		if (!useEnableJavadoc) {
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_DocCommentSupport,
Andrew Overholt 9fa962a
+				isEnabling ? CompilerOptions.ENABLED: CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		// if disabling then it's not necessary to set other javadoc options
Andrew Overholt 9fa962a
+		if (isEnabling) {
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportInvalidJavadoc,
Andrew Overholt 9fa962a
+			CompilerOptions.WARNING);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadocTags,
Andrew Overholt 9fa962a
+				CompilerOptions.ENABLED);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility,
Andrew Overholt 9fa962a
+				CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportMissingJavadocTags,
Andrew Overholt 9fa962a
+				CompilerOptions.WARNING);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility,
Andrew Overholt 9fa962a
+				CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
+			this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportMissingJavadocComments,
Andrew Overholt 9fa962a
+				CompilerOptions.WARNING);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	} else if (token.startsWith("tasks")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		String taskTags = ""; //$NON-NLS-1$
Andrew Overholt 9fa962a
+		int start = token.indexOf('(');
Andrew Overholt 9fa962a
+		int end = token.indexOf(')');
Andrew Overholt 9fa962a
+		if (start >= 0 && end >= 0 && start < end){
Andrew Overholt 9fa962a
+			taskTags = token.substring(start+1, end).trim();
Andrew Overholt 9fa962a
+			taskTags = taskTags.replace('|',',');
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		if (taskTags.length() == 0){
Andrew Overholt 9fa962a
+			throw new InvalidInputException(Main.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_TaskTags,
Andrew Overholt 9fa962a
+			isEnabling ? taskTags : "");  //$NON-NLS-1$
Andrew Overholt 9fa962a
+	} else if (token.equals("assertIdentifier")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportAssertIdentifier,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("enumIdentifier")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportEnumIdentifier,
Andrew Overholt 9fa962a
+				isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("finally")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unusedThrown")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unqualifiedField") //$NON-NLS-1$
Andrew Overholt 9fa962a
+			|| token.equals("unqualified-field-access")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnqualifiedFieldAccess,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("typeHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportTypeParameterHiding,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("varargsCast")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportVarargsArgumentNeedCast,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("null")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportNullReference,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("boxing")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportAutoboxing,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("over-ann")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportMissingOverrideAnnotation,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("dep-ann")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportMissingDeprecatedAnnotation,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("intfAnnotation")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportAnnotationSuperInterface,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("enumSwitch") //$NON-NLS-1$
Andrew Overholt 9fa962a
+			|| token.equals("incomplete-switch")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportIncompleteEnumSwitch,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
+	} else if (token.equals("hiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportHiddenCatchBlock,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportLocalVariableHiding,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportFieldHiding,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportTypeParameterHiding,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("static-access")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportNonStaticAccessToStatic,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportIndirectStaticAccess,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("unused")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedLocal, 
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedParameter,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedImport,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedPrivateMember,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_ReportUnusedLabel,
Andrew Overholt 9fa962a
+				isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("paramAssign")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportParameterAssignment,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("discouraged")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportDiscouragedReference,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("forbidden")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportForbiddenReference,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else if (token.equals("fallthrough")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+			CompilerOptions.OPTION_ReportFallthroughCase,
Andrew Overholt 9fa962a
+			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
+	} else {
Andrew Overholt 9fa962a
+		throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+/*
Andrew Overholt 9fa962a
+Handle extdirs processing
Andrew Overholt 9fa962a
+*/
Andrew Overholt 9fa962a
+protected ArrayList handleExtdirs(ArrayList extdirsClasspaths) {
Andrew Overholt 9fa962a
+ 	final File javaHome = getJavaHome();
Andrew Overholt 9fa962a
+	final int DEFAULT_SIZE_CLASSPATH = 4;
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	/*
Andrew Overholt 9fa962a
+	 * Feed endorsedDirClasspath according to:
Andrew Overholt 9fa962a
+	 * - -extdirs first if present;
Andrew Overholt 9fa962a
+	 * - else java.ext.dirs if defined;
Andrew Overholt 9fa962a
+	 * - else default extensions directory for the platform.
Andrew Overholt 9fa962a
+	 */
Andrew Overholt 9fa962a
+	if (extdirsClasspaths == null) {
Andrew Overholt 9fa962a
+		extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
Andrew Overholt 9fa962a
+		String extdirsStr = System.getProperty("java.ext.dirs"); //$NON-NLS-1$
Andrew Overholt 9fa962a
+		if (extdirsStr == null) {
Andrew Overholt 9fa962a
+			extdirsClasspaths.add(javaHome.getAbsolutePath() + "/lib/ext"); //$NON-NLS-1$
Andrew Overholt 9fa962a
+		} else {
Andrew Overholt 9fa962a
+			StringTokenizer tokenizer = new StringTokenizer(extdirsStr, File.pathSeparator);
Andrew Overholt 9fa962a
+			while (tokenizer.hasMoreTokens()) 
Andrew Overholt 9fa962a
+				extdirsClasspaths.add(tokenizer.nextToken());
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+	
Andrew Overholt 9fa962a
+	/*
Andrew Overholt 9fa962a
+	 * Feed extdirsClasspath with the entries found into the directories listed by
Andrew Overholt 9fa962a
+	 * extdirsNames.
Andrew Overholt 9fa962a
+	 */
Andrew Overholt 9fa962a
+	if (extdirsClasspaths.size() != 0) {
Andrew Overholt 9fa962a
+		File[] directoriesToCheck = new File[extdirsClasspaths.size()];
Andrew Overholt 9fa962a
+		for (int i = 0; i < directoriesToCheck.length; i++) 
Andrew Overholt 9fa962a
+			directoriesToCheck[i] = new File((String) extdirsClasspaths.get(i));
Andrew Overholt 9fa962a
+		extdirsClasspaths.clear();
Andrew Overholt 9fa962a
+		File[][] extdirsJars = getLibrariesFiles(directoriesToCheck);
Andrew Overholt 9fa962a
+		if (extdirsJars != null) {
Andrew Overholt 9fa962a
+			for (int i = 0, max = extdirsJars.length; i < max; i++) {
Andrew Overholt 9fa962a
+				File[] current = extdirsJars[i];
Andrew Overholt 9fa962a
+				if (current != null) {
Andrew Overholt 9fa962a
+					for (int j = 0, max2 = current.length; j < max2; j++) {
Andrew Overholt 9fa962a
+						FileSystem.Classpath classpath = 
Andrew Overholt 9fa962a
+							FileSystem.getClasspath(
Andrew Overholt 9fa962a
+									current[j].getAbsolutePath(),
Andrew Overholt 9fa962a
+									null, null); 
Andrew Overholt 9fa962a
+						if (classpath != null) {
Andrew Overholt 9fa962a
+							extdirsClasspaths.add(classpath);
Andrew Overholt 9fa962a
+						}
Andrew Overholt 9fa962a
+					}
Andrew Overholt 9fa962a
+				} else if (directoriesToCheck[i].isFile()) {
Andrew Overholt 9fa962a
+					this.logger.logIncorrectExtDirsEntry(directoriesToCheck[i].getAbsolutePath());
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+	
Andrew Overholt 9fa962a
+	return extdirsClasspaths;
Andrew Overholt 9fa962a
+}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+/*
Andrew Overholt 9fa962a
 Decode the command line arguments 
Andrew Overholt 9fa962a
  */
Andrew Overholt 9fa962a
 public void configure(String[] argv) throws InvalidInputException {
Andrew Overholt 9fa962a
@@ -1848,326 +2233,7 @@
Andrew Overholt 9fa962a
 					while (tokenizer.hasMoreTokens()) {
Andrew Overholt 9fa962a
 						String token = tokenizer.nextToken();
Andrew Overholt 9fa962a
 						tokenCounter++;
Andrew Overholt 9fa962a
-						if (token.equals("constructorName")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportMethodWithConstructorName,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("pkgDefaultMethod") || token.equals("packageDefaultMethod")/*backward compatible*/ ) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("maskedCatchBlock") || token.equals("maskedCatchBlocks")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportHiddenCatchBlock,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("deprecation")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDeprecation, 
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, 
Andrew Overholt 9fa962a
-								CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, 
Andrew Overholt 9fa962a
-								CompilerOptions.DISABLED);						
Andrew Overholt 9fa962a
-						} else if (token.equals("allDeprecation")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDeprecation, 
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, 
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, 
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-						} else if (token.equals("unusedLocal") || token.equals("unusedLocals")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedLocal, 
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unusedArgument") || token.equals("unusedArguments")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedParameter,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unusedImport") || token.equals("unusedImports")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedImport,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unusedPrivate")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedPrivateMember,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unusedLabel")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedLabel,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("localHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportLocalVariableHiding,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("fieldHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportFieldHiding,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("specialParamHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportSpecialParameterHidingField,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-						} else if (token.equals("conditionAssign")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-	   					} else if (token.equals("syntheticAccess") //$NON-NLS-1$
Andrew Overholt 9fa962a
-	   							|| token.equals("synthetic-access")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("nls")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportNonExternalizedStringLiteral,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("staticReceiver")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportNonStaticAccessToStatic,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("indirectStatic")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportIndirectStaticAccess,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("noEffectAssign")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportNoEffectAssignment,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("intfNonInherited") || token.equals("interfaceNonInherited")/*backward compatible*/) { //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("charConcat") || token.equals("noImplicitStringConversion")/*backward compatible*/) {//$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportNoImplicitStringConversion,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("semicolon")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportEmptyStatement,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("serial")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportMissingSerialVersion,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("emptyBlock")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUndocumentedEmptyBlock,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("uselessTypeCheck")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnnecessaryTypeCheck,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unchecked") || token.equals("unsafe")) {//$NON-NLS-1$ //$NON-NLS-2$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUncheckedTypeOperation,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("raw")) {//$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportRawTypeReference,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("finalBound")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportFinalParameterBound,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("suppress")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_SuppressWarnings,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-						} else if (token.equals("warningToken")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnhandledWarningToken,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unnecessaryElse")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnnecessaryElse,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("javadoc")) {//$NON-NLS-1$ 
Andrew Overholt 9fa962a
-							if (!useEnableJavadoc) {
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_DocCommentSupport,
Andrew Overholt 9fa962a
-									isEnabling ? CompilerOptions.ENABLED: CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-							}
Andrew Overholt 9fa962a
-							// if disabling then it's not necessary to set other javadoc options
Andrew Overholt 9fa962a
-							if (isEnabling) {
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadoc,
Andrew Overholt 9fa962a
-									CompilerOptions.WARNING);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadocTags,
Andrew Overholt 9fa962a
-									CompilerOptions.ENABLED);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadocTagsDeprecatedRef,
Andrew Overholt 9fa962a
-									CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadocTagsNotVisibleRef,
Andrew Overholt 9fa962a
-									CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility,
Andrew Overholt 9fa962a
-									CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportMissingJavadocTags,
Andrew Overholt 9fa962a
-									CompilerOptions.WARNING);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility,
Andrew Overholt 9fa962a
-									CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
-							}
Andrew Overholt 9fa962a
-						} else if (token.equals("allJavadoc")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							if (!useEnableJavadoc) {
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_DocCommentSupport,
Andrew Overholt 9fa962a
-									isEnabling ? CompilerOptions.ENABLED: CompilerOptions.DISABLED);
Andrew Overholt 9fa962a
-							}
Andrew Overholt 9fa962a
-							// if disabling then it's not necessary to set other javadoc options
Andrew Overholt 9fa962a
-							if (isEnabling) {
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportInvalidJavadoc,
Andrew Overholt 9fa962a
-								CompilerOptions.WARNING);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadocTags,
Andrew Overholt 9fa962a
-									CompilerOptions.ENABLED);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility,
Andrew Overholt 9fa962a
-									CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportMissingJavadocTags,
Andrew Overholt 9fa962a
-									CompilerOptions.WARNING);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility,
Andrew Overholt 9fa962a
-									CompilerOptions.PRIVATE);
Andrew Overholt 9fa962a
-								this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportMissingJavadocComments,
Andrew Overholt 9fa962a
-									CompilerOptions.WARNING);
Andrew Overholt 9fa962a
-							}
Andrew Overholt 9fa962a
-						} else if (token.startsWith("tasks")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							String taskTags = ""; //$NON-NLS-1$
Andrew Overholt 9fa962a
-							int start = token.indexOf('(');
Andrew Overholt 9fa962a
-							int end = token.indexOf(')');
Andrew Overholt 9fa962a
-							if (start >= 0 && end >= 0 && start < end){
Andrew Overholt 9fa962a
-								taskTags = token.substring(start+1, end).trim();
Andrew Overholt 9fa962a
-								taskTags = taskTags.replace('|',',');
Andrew Overholt 9fa962a
-							}
Andrew Overholt 9fa962a
-							if (taskTags.length() == 0){
Andrew Overholt 9fa962a
-								throw new InvalidInputException(Main.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$
Andrew Overholt 9fa962a
-							}
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_TaskTags,
Andrew Overholt 9fa962a
-								isEnabling ? taskTags : "");  //$NON-NLS-1$
Andrew Overholt 9fa962a
-						} else if (token.equals("assertIdentifier")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportAssertIdentifier,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("enumIdentifier")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportEnumIdentifier,
Andrew Overholt 9fa962a
-									isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("finally")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unusedThrown")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unqualifiedField") //$NON-NLS-1$
Andrew Overholt 9fa962a
-								|| token.equals("unqualified-field-access")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnqualifiedFieldAccess,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("typeHiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportTypeParameterHiding,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("varargsCast")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportVarargsArgumentNeedCast,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("null")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportNullReference,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("boxing")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportAutoboxing,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("over-ann")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportMissingOverrideAnnotation,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("dep-ann")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportMissingDeprecatedAnnotation,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("intfAnnotation")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportAnnotationSuperInterface,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("enumSwitch") //$NON-NLS-1$
Andrew Overholt 9fa962a
-								|| token.equals("incomplete-switch")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportIncompleteEnumSwitch,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
Andrew Overholt 9fa962a
-						} else if (token.equals("hiding")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportHiddenCatchBlock,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportLocalVariableHiding,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportFieldHiding,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportTypeParameterHiding,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("static-access")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportNonStaticAccessToStatic,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportIndirectStaticAccess,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("unused")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedLocal, 
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedParameter,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedImport,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedPrivateMember,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-									CompilerOptions.OPTION_ReportUnusedLabel,
Andrew Overholt 9fa962a
-									isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("paramAssign")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportParameterAssignment,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("discouraged")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportDiscouragedReference,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("forbidden")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportForbiddenReference,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else if (token.equals("fallthrough")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
-							this.options.put(
Andrew Overholt 9fa962a
-								CompilerOptions.OPTION_ReportFallthroughCase,
Andrew Overholt 9fa962a
-								isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
Andrew Overholt 9fa962a
-						} else {
Andrew Overholt 9fa962a
-							throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$
Andrew Overholt 9fa962a
-						}
Andrew Overholt 9fa962a
+						handleWarningToken(token, isEnabling, useEnableJavadoc);
Andrew Overholt 9fa962a
 					}
Andrew Overholt 9fa962a
 					if (tokenCounter == 0)
Andrew Overholt 9fa962a
 						throw new InvalidInputException(
Andrew Overholt 9fa962a
@@ -2708,7 +2774,7 @@
Andrew Overholt 9fa962a
 		this.timesCounter = 0;
Andrew Overholt 9fa962a
 	}
Andrew Overholt 9fa962a
 }
Andrew Overholt 9fa962a
-private void disableWarnings() {
Andrew Overholt 9fa962a
+protected void disableWarnings() {
Andrew Overholt 9fa962a
 	Object[] entries = this.options.entrySet().toArray();
Andrew Overholt 9fa962a
 	for (int i = 0, max = entries.length; i < max; i++) {
Andrew Overholt 9fa962a
 		Map.Entry entry = (Map.Entry) entries[i];
Andrew Overholt 9fa962a
Index: batch/org/eclipse/jdt/internal/compiler/batch/GCCMain.java
Andrew Overholt 9fa962a
===================================================================
Andrew Overholt 9fa962a
RCS file: batch/org/eclipse/jdt/internal/compiler/batch/GCCMain.java
Andrew Overholt 9fa962a
diff -N batch/org/eclipse/jdt/internal/compiler/batch/GCCMain.java
Andrew Overholt 9fa962a
--- /dev/null	1 Jan 1970 00:00:00 -0000
Andrew Overholt 9fa962a
+++ batch/org/eclipse/jdt/internal/compiler/batch/GCCMain.java	1 Jan 1970 00:00:00 -0000
Andrew Overholt 9fa962a
@@ -0,0 +1,442 @@
Andrew Overholt 9fa962a
+/**
Andrew Overholt 9fa962a
+ * 
Andrew Overholt 9fa962a
+ */
Andrew Overholt 9fa962a
+package org.eclipse.jdt.internal.compiler.batch;
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+import java.io.BufferedOutputStream;
Andrew Overholt 9fa962a
+import java.io.BufferedReader;
Andrew Overholt 9fa962a
+import java.io.ByteArrayInputStream;
Andrew Overholt 9fa962a
+import java.io.File;
Andrew Overholt 9fa962a
+import java.io.FileOutputStream;
Andrew Overholt 9fa962a
+import java.io.FileReader;
Andrew Overholt 9fa962a
+import java.io.IOException;
Andrew Overholt 9fa962a
+import java.io.InputStreamReader;
Andrew Overholt 9fa962a
+import java.io.OutputStream;
Andrew Overholt 9fa962a
+import java.io.PrintWriter;
Andrew Overholt 9fa962a
+import java.io.UnsupportedEncodingException;
Andrew Overholt 9fa962a
+import java.util.ArrayList;
Andrew Overholt 9fa962a
+import java.util.HashSet;
Andrew Overholt 9fa962a
+import java.util.Iterator;
Andrew Overholt 9fa962a
+import java.util.Map;
Andrew Overholt 9fa962a
+import java.util.StringTokenizer;
Andrew Overholt 9fa962a
+import java.util.zip.CRC32;
Andrew Overholt 9fa962a
+import java.util.zip.ZipEntry;
Andrew Overholt 9fa962a
+import java.util.zip.ZipOutputStream;
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+import org.eclipse.jdt.core.compiler.InvalidInputException;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.ClassFile;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.CompilationResult;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.env.AccessRule;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.env.AccessRuleSet;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.util.Messages;
Andrew Overholt 9fa962a
+import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+/**
Andrew Overholt 9fa962a
+ * This is an alternate entry point for the command-line compiler which
Andrew Overholt 9fa962a
+ * is simpler to integrate into GCC.  In particular the option processing
Andrew Overholt 9fa962a
+ * is more GNU-like and the recognized options are similar to those supported
Andrew Overholt 9fa962a
+ * by other GCC front ends.
Andrew Overholt 9fa962a
+ */
Andrew Overholt 9fa962a
+public class GCCMain extends Main {
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	// All the compilation units specified on the command line.
Andrew Overholt 9fa962a
+	private HashSet commandLineCompilationUnits = new HashSet();
Andrew Overholt 9fa962a
+	// True if we are only checking syntax.
Andrew Overholt 9fa962a
+	private boolean syntaxOnly;
Andrew Overholt 9fa962a
+	// If not null, the name of the output zip file.
Andrew Overholt 9fa962a
+	// If null, we are generating class files in the file system,
Andrew Overholt 9fa962a
+	// not a zip file.
Andrew Overholt 9fa962a
+	private String zipDestination;
Andrew Overholt 9fa962a
+	// The zip stream to which we're writing, or null if it hasn't been opened.
Andrew Overholt 9fa962a
+	private ZipOutputStream zipStream;
Andrew Overholt 9fa962a
+	
Andrew Overholt 9fa962a
+	// If not null, the name of the zip file to which dependency class files
Andrew Overholt 9fa962a
+	// should be written.
Andrew Overholt 9fa962a
+	private String zipDependencyDestination;
Andrew Overholt 9fa962a
+	// The zip stream to which dependency files should be written.
Andrew Overholt 9fa962a
+	private ZipOutputStream zipDependencyStream;
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public GCCMain(PrintWriter outWriter, PrintWriter errWriter,
Andrew Overholt 9fa962a
+			boolean systemExitWhenFinished) {
Andrew Overholt 9fa962a
+		super(outWriter, errWriter, systemExitWhenFinished);
Andrew Overholt 9fa962a
+		this.logger.setEmacs();
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public GCCMain(PrintWriter outWriter, PrintWriter errWriter,
Andrew Overholt 9fa962a
+			boolean systemExitWhenFinished, Map customDefaultOptions) {
Andrew Overholt 9fa962a
+		super(outWriter, errWriter, systemExitWhenFinished,
Andrew Overholt 9fa962a
+				customDefaultOptions);
Andrew Overholt 9fa962a
+		this.logger.setEmacs();
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	private void fail(Exception t) {
Andrew Overholt 9fa962a
+		this.logger.logException(t);
Andrew Overholt 9fa962a
+		System.exit(1);
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public CompilationUnit[] getCompilationUnits() throws InvalidInputException {
Andrew Overholt 9fa962a
+		CompilationUnit[] units = super.getCompilationUnits();
Andrew Overholt 9fa962a
+		for (int i = 0; i < units.length; ++i)
Andrew Overholt 9fa962a
+			this.commandLineCompilationUnits.add(units[i]);
Andrew Overholt 9fa962a
+		return units;
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	private String combine(char[] one, char[] two) {
Andrew Overholt 9fa962a
+		StringBuffer b = new StringBuffer();
Andrew Overholt 9fa962a
+		b.append(one);
Andrew Overholt 9fa962a
+		b.append(two);
Andrew Overholt 9fa962a
+		return b.toString();
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	private ZipOutputStream getZipOutput() throws IOException {
Andrew Overholt 9fa962a
+		if (this.zipDestination != null && this.zipStream == null) {
Andrew Overholt 9fa962a
+			OutputStream os;
Andrew Overholt 9fa962a
+			if ("-".equals(this.zipDestination)) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				os = System.out;
Andrew Overholt 9fa962a
+			} else {
Andrew Overholt 9fa962a
+				os = new FileOutputStream(this.zipDestination);
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+			zipStream = new ZipOutputStream(new BufferedOutputStream(os));
Andrew Overholt 9fa962a
+			zipStream.setMethod(ZipOutputStream.STORED);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		return zipStream;
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	private ZipOutputStream getDependencyOutput() throws IOException {
Andrew Overholt 9fa962a
+		if (this.zipDependencyDestination != null && this.zipDependencyStream == null) {
Andrew Overholt 9fa962a
+			OutputStream os = new FileOutputStream(zipDependencyDestination);
Andrew Overholt 9fa962a
+			zipDependencyStream = new ZipOutputStream(new BufferedOutputStream(os));
Andrew Overholt 9fa962a
+			zipDependencyStream.setMethod(ZipOutputStream.STORED);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		return zipDependencyStream;
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public void outputClassFiles(CompilationResult unitResult) {
Andrew Overholt 9fa962a
+		if (this.syntaxOnly) {
Andrew Overholt 9fa962a
+			return;
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		if (this.zipDestination == null) {
Andrew Overholt 9fa962a
+			// Nothing special to do here.
Andrew Overholt 9fa962a
+			super.outputClassFiles(unitResult);
Andrew Overholt 9fa962a
+			return;
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		if (unitResult == null || unitResult.hasErrors()) {
Andrew Overholt 9fa962a
+			return;
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		// If we are compiling with indirect dispatch, we don't need
Andrew Overholt 9fa962a
+		// any dependent classes.  If we are using the C++ ABI, then we
Andrew Overholt 9fa962a
+		// do need the dependencies in order to do proper layout.
Andrew Overholt 9fa962a
+		boolean gcjCompile = this.commandLineCompilationUnits.contains(unitResult.getCompilationUnit());
Andrew Overholt 9fa962a
+		if (this.zipDependencyDestination == null && !gcjCompile) {
Andrew Overholt 9fa962a
+			return;
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		try {
Andrew Overholt 9fa962a
+			ZipOutputStream dest = gcjCompile ? getZipOutput() : getDependencyOutput();
Andrew Overholt 9fa962a
+			ClassFile[] classFiles = unitResult.getClassFiles();
Andrew Overholt 9fa962a
+			for (int i = 0; i < classFiles.length; ++i) {
Andrew Overholt 9fa962a
+				ClassFile classFile = classFiles[i];
Andrew Overholt 9fa962a
+				String filename = combine(classFile.fileName(), SuffixConstants.SUFFIX_class);
Andrew Overholt 9fa962a
+				if (this.verbose)
Andrew Overholt 9fa962a
+					this.out.println(
Andrew Overholt 9fa962a
+							Messages.bind(
Andrew Overholt 9fa962a
+									Messages.compilation_write,
Andrew Overholt 9fa962a
+									new String[] {
Andrew Overholt 9fa962a
+								String.valueOf(this.exportedClassFilesCounter+1),
Andrew Overholt 9fa962a
+								filename
Andrew Overholt 9fa962a
+							}));
Andrew Overholt 9fa962a
+				ZipEntry entry = new ZipEntry(filename);
Andrew Overholt 9fa962a
+				byte[] contents = classFile.getBytes();
Andrew Overholt 9fa962a
+				CRC32 crc = new CRC32();
Andrew Overholt 9fa962a
+				crc.update(contents);
Andrew Overholt 9fa962a
+				entry.setSize(contents.length);
Andrew Overholt 9fa962a
+				entry.setCrc(crc.getValue());
Andrew Overholt 9fa962a
+				dest.putNextEntry(entry);
Andrew Overholt 9fa962a
+				dest.write(contents);
Andrew Overholt 9fa962a
+				dest.closeEntry();
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+		} catch (IOException err) {
Andrew Overholt 9fa962a
+			fail(err);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+	
Andrew Overholt 9fa962a
+	private String getArgument(String option) {
Andrew Overholt 9fa962a
+		int index = option.indexOf('=');
Andrew Overholt 9fa962a
+		return option.substring(index + 1);
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	private void addPath(ArrayList result, String currentClasspathName) {
Andrew Overholt 9fa962a
+		String customEncoding = null;
Andrew Overholt 9fa962a
+		AccessRule[] accessRules = new AccessRule[0];
Andrew Overholt 9fa962a
+		String templates[] = new String[AccessRuleSet.MESSAGE_TEMPLATES_LENGTH];
Andrew Overholt 9fa962a
+		templates[0] = Main.bind(
Andrew Overholt 9fa962a
+			"template.restrictedAccess.type", //$NON-NLS-1$
Andrew Overholt 9fa962a
+			new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		templates[1] = Main.bind(
Andrew Overholt 9fa962a
+			"template.restrictedAccess.constructor", //$NON-NLS-1$
Andrew Overholt 9fa962a
+			new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$ 
Andrew Overholt 9fa962a
+		templates[2] = Main.bind(
Andrew Overholt 9fa962a
+			"template.restrictedAccess.method", //$NON-NLS-1$
Andrew Overholt 9fa962a
+			new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$ 
Andrew Overholt 9fa962a
+		templates[3] = Main.bind(
Andrew Overholt 9fa962a
+			"template.restrictedAccess.field", //$NON-NLS-1$
Andrew Overholt 9fa962a
+			new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$ 
Andrew Overholt 9fa962a
+		AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules, templates);
Andrew Overholt 9fa962a
+		FileSystem.Classpath currentClasspath = FileSystem
Andrew Overholt 9fa962a
+				.getClasspath(currentClasspathName,
Andrew Overholt 9fa962a
+						customEncoding, accessRuleSet);
Andrew Overholt 9fa962a
+		if (currentClasspath != null) {
Andrew Overholt 9fa962a
+			result.add(currentClasspath);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+	
Andrew Overholt 9fa962a
+	private void parsePath(ArrayList result, String path) {
Andrew Overholt 9fa962a
+		StringTokenizer iter = new StringTokenizer(path, File.pathSeparator);
Andrew Overholt 9fa962a
+		while (iter.hasMoreTokens()) {
Andrew Overholt 9fa962a
+			addPath(result, iter.nextToken());
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	protected void handleWarningToken(String token, boolean isEnabling,
Andrew Overholt 9fa962a
+			boolean useEnableJavadoc) throws InvalidInputException {
Andrew Overholt 9fa962a
+		// Recognize this for compatibility with older versions of gcj.
Andrew Overholt 9fa962a
+		if ("deprecated".equals(token)) //$NON-NLS-1$
Andrew Overholt 9fa962a
+			token = "deprecation"; //$NON-NLS-1$
Andrew Overholt 9fa962a
+		else if ("static-access".equals(token)   //$NON-NLS-1$
Andrew Overholt 9fa962a
+				|| "dep-ann".equals(token) //$NON-NLS-1$
Andrew Overholt 9fa962a
+				|| "over-ann".equals(token)) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+			// Some exceptions to the warning naming rule.
Andrew Overholt 9fa962a
+		} else if ("extraneous-semicolon".equals(token)) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+			// Compatibility with earlier versions of gcj.
Andrew Overholt 9fa962a
+			token = "semicolon"; //$NON-NLS-1$
Andrew Overholt 9fa962a
+		} else {
Andrew Overholt 9fa962a
+			// Turn "foo-bar-baz" into eclipse-style "fooBarBaz".
Andrew Overholt 9fa962a
+			StringBuffer newToken = new StringBuffer(token.length());
Andrew Overholt 9fa962a
+			StringTokenizer t = new StringTokenizer(token, "-"); //$NON-NLS-1$
Andrew Overholt 9fa962a
+			boolean first = true;
Andrew Overholt 9fa962a
+			while (t.hasMoreTokens()) {
Andrew Overholt 9fa962a
+				String next = t.nextToken();
Andrew Overholt 9fa962a
+				if (first) {
Andrew Overholt 9fa962a
+					newToken.append(next);
Andrew Overholt 9fa962a
+					first = false;
Andrew Overholt 9fa962a
+				} else {
Andrew Overholt 9fa962a
+					newToken.append(Character.toUpperCase(next.charAt(0)));
Andrew Overholt 9fa962a
+					newToken.append(next.substring(1));
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+			token = newToken.toString();
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		super.handleWarningToken(token, isEnabling, useEnableJavadoc);
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	/**
Andrew Overholt 9fa962a
+	 * Set the debug level to the indicated value.  The level should be
Andrew Overholt 9fa962a
+	 * between 0 and 2, inclusive, but this is not checked.
Andrew Overholt 9fa962a
+	 * @param level the debug level
Andrew Overholt 9fa962a
+	 */
Andrew Overholt 9fa962a
+	private void setDebugLevel(int level) {
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_LocalVariableAttribute,
Andrew Overholt 9fa962a
+				level > 1 ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_LineNumberAttribute,
Andrew Overholt 9fa962a
+				level > 0 ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE);
Andrew Overholt 9fa962a
+		this.options.put(
Andrew Overholt 9fa962a
+				CompilerOptions.OPTION_SourceFileAttribute,
Andrew Overholt 9fa962a
+				CompilerOptions.GENERATE);
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	private void readFileList(String file, ArrayList result) {
Andrew Overholt 9fa962a
+		try {
Andrew Overholt 9fa962a
+			BufferedReader b = new BufferedReader(new FileReader(file));
Andrew Overholt 9fa962a
+			String line;
Andrew Overholt 9fa962a
+			while ((line = b.readLine()) != null) {
Andrew Overholt 9fa962a
+				if (line.endsWith(SUFFIX_STRING_java))
Andrew Overholt 9fa962a
+					result.add(line);
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+			b.close();
Andrew Overholt 9fa962a
+		} catch (IOException err) {
Andrew Overholt 9fa962a
+			fail(err);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+	
Andrew Overholt 9fa962a
+	private void readAllFileListFiles(ArrayList fileList, ArrayList result) {
Andrew Overholt 9fa962a
+		Iterator it = fileList.iterator();
Andrew Overholt 9fa962a
+		while (it.hasNext()) {
Andrew Overholt 9fa962a
+			readFileList((String) it.next(), result);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public void configure(String[] argv) throws InvalidInputException {
Andrew Overholt 9fa962a
+		if ((argv == null) || (argv.length == 0)) {
Andrew Overholt 9fa962a
+			// This is a "can't happen".
Andrew Overholt 9fa962a
+			System.exit(1);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		ArrayList files = new ArrayList();
Andrew Overholt 9fa962a
+		ArrayList otherFiles = new ArrayList();
Andrew Overholt 9fa962a
+		String classpath = null;
Andrew Overholt 9fa962a
+		boolean haveFileList = false;
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		for (int i = 0; i < argv.length; ++i) {
Andrew Overholt 9fa962a
+			String currentArg = argv[i];
Andrew Overholt 9fa962a
+			
Andrew Overholt 9fa962a
+			if (currentArg.startsWith("-fencoding=")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				// Simply accept the last one.
Andrew Overholt 9fa962a
+				String encoding = getArgument(currentArg);
Andrew Overholt 9fa962a
+				try { // ensure encoding is supported
Andrew Overholt 9fa962a
+					new InputStreamReader(new ByteArrayInputStream(new byte[0]), encoding);
Andrew Overholt 9fa962a
+				} catch (UnsupportedEncodingException e) {
Andrew Overholt 9fa962a
+					throw new InvalidInputException(
Andrew Overholt 9fa962a
+						Main.bind("configure.unsupportedEncoding", encoding)); //$NON-NLS-1$
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+				this.options.put(CompilerOptions.OPTION_Encoding, encoding);
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-foutput-class-dir=")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				String arg = getArgument(currentArg);
Andrew Overholt 9fa962a
+				if (this.destinationPath != null) {
Andrew Overholt 9fa962a
+					StringBuffer errorMessage = new StringBuffer();
Andrew Overholt 9fa962a
+					errorMessage.append("-d"); //$NON-NLS-1$
Andrew Overholt 9fa962a
+					errorMessage.append(' ');
Andrew Overholt 9fa962a
+					errorMessage.append(arg);
Andrew Overholt 9fa962a
+					throw new InvalidInputException(
Andrew Overholt 9fa962a
+						Main.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+				this.destinationPath = arg;
Andrew Overholt 9fa962a
+				this.generatePackagesStructure = true;
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-fbootclasspath=")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				classpath = getArgument(currentArg);
Andrew Overholt 9fa962a
+			} else if (currentArg.equals("-fzip-target")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				++i;
Andrew Overholt 9fa962a
+				if (i >= argv.length)
Andrew Overholt 9fa962a
+					// FIXME: i18n.
Andrew Overholt 9fa962a
+					throw new InvalidInputException("-fzip-target requires argument");
Andrew Overholt 9fa962a
+				this.zipDestination = argv[i];
Andrew Overholt 9fa962a
+			} else if (currentArg.equals("-fzip-dependency")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				++i;
Andrew Overholt 9fa962a
+				if (i >= argv.length)
Andrew Overholt 9fa962a
+					// FIXME: i18n.
Andrew Overholt 9fa962a
+					throw new InvalidInputException("-fzip-dependency requires argument");
Andrew Overholt 9fa962a
+				this.zipDependencyDestination = argv[i];
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-g")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				if (currentArg.equals("-g0")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					setDebugLevel(0);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("-g2") || currentArg.equals("-g3") //$NON-NLS-1$ //$NON-NLS-2$
Andrew Overholt 9fa962a
+						|| currentArg.equals("-g")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					setDebugLevel(2);
Andrew Overholt 9fa962a
+				} else {
Andrew Overholt 9fa962a
+					// Handle -g1 but also things like -gstabs.
Andrew Overholt 9fa962a
+					setDebugLevel(1);
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-Wno-")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				handleWarningToken(currentArg.substring(5), false, false);
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-W")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				handleWarningToken(currentArg.substring(2), true, false);
Andrew Overholt 9fa962a
+			} else if (currentArg.equals("-w")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				disableWarnings();
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-O")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				// Ignore.
Andrew Overholt 9fa962a
+			} else if (currentArg.equals("-v")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				this.verbose = true;
Andrew Overholt 9fa962a
+			} else if (currentArg.equals("-fsyntax-only")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				this.syntaxOnly = true;
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-fsource=")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				currentArg = getArgument(currentArg);
Andrew Overholt 9fa962a
+				if (currentArg.equals("1.3")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.4")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
Andrew Overholt 9fa962a
+				} else {
Andrew Overholt 9fa962a
+					throw new InvalidInputException(Main.bind("configure.source", currentArg)); //$NON-NLS-1$
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+			} else if (currentArg.startsWith("-ftarget=")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				currentArg = getArgument(currentArg);
Andrew Overholt 9fa962a
+				if (currentArg.equals("1.1")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.2")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.3")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.4")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
Andrew Overholt 9fa962a
+				} else if (currentArg.equals("jsr14")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_JSR14);
Andrew Overholt 9fa962a
+				} else {
Andrew Overholt 9fa962a
+					throw new InvalidInputException(Main.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
Andrew Overholt 9fa962a
+				}
Andrew Overholt 9fa962a
+			} else if (currentArg.equals("-ffilelist-file")) { //$NON-NLS-1$
Andrew Overholt 9fa962a
+				haveFileList = true;
Andrew Overholt 9fa962a
+			} else if (currentArg.endsWith(SuffixConstants.SUFFIX_STRING_java)) {
Andrew Overholt 9fa962a
+				files.add(currentArg);
Andrew Overholt 9fa962a
+			} else if (currentArg.charAt(0) == '-'){
Andrew Overholt 9fa962a
+				// FIXME: error if not a file?
Andrew Overholt 9fa962a
+			} else {
Andrew Overholt 9fa962a
+				otherFiles.add(currentArg);
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		// Read the file list file.  We read them all, but really there
Andrew Overholt 9fa962a
+		// will only be one.
Andrew Overholt 9fa962a
+		if (haveFileList)
Andrew Overholt 9fa962a
+			readAllFileListFiles(otherFiles, files);
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		this.filenames = (String[]) files.toArray(new String[0]);
Andrew Overholt 9fa962a
+		this.encodings = new String[this.filenames.length];
Andrew Overholt 9fa962a
+		
Andrew Overholt 9fa962a
+		// Classpath processing.
Andrew Overholt 9fa962a
+		ArrayList result = new ArrayList();
Andrew Overholt 9fa962a
+		if (classpath == null)
Andrew Overholt 9fa962a
+			// FIXME: update resources.
Andrew Overholt 9fa962a
+			throw new InvalidInputException("no classpath specified");
Andrew Overholt 9fa962a
+		parsePath(result, classpath);
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		// We must always create both output files, even if one is not used.
Andrew Overholt 9fa962a
+		// That way we will always pass valid zip file on to jc1.
Andrew Overholt 9fa962a
+		try {
Andrew Overholt 9fa962a
+			getZipOutput();
Andrew Overholt 9fa962a
+			getDependencyOutput();
Andrew Overholt 9fa962a
+		} catch (IOException err) {
Andrew Overholt 9fa962a
+			fail(err);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		this.checkedClasspaths = new FileSystem.Classpath[result.size()];
Andrew Overholt 9fa962a
+		result.toArray(this.checkedClasspaths);
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+		this.logger.logCommandLineArguments(argv);
Andrew Overholt 9fa962a
+		this.logger.logOptions(this.options);
Andrew Overholt 9fa962a
+		this.logger.logClasspath(this.checkedClasspaths);
Andrew Overholt 9fa962a
+		
Andrew Overholt 9fa962a
+		this.repetitions = 1;
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public boolean compile(String[] argv) {
Andrew Overholt 9fa962a
+		boolean result = super.compile(argv);
Andrew Overholt 9fa962a
+		try {
Andrew Overholt 9fa962a
+			if (zipStream != null) {
Andrew Overholt 9fa962a
+				zipStream.finish();
Andrew Overholt 9fa962a
+				zipStream.close();
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+			if (zipDependencyStream != null) {
Andrew Overholt 9fa962a
+				zipDependencyStream.finish();
Andrew Overholt 9fa962a
+				zipDependencyStream.close();
Andrew Overholt 9fa962a
+			}
Andrew Overholt 9fa962a
+		} catch (IOException err) {
Andrew Overholt 9fa962a
+			fail(err);
Andrew Overholt 9fa962a
+		}
Andrew Overholt 9fa962a
+		return result;
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+
Andrew Overholt 9fa962a
+	public static void main(String[] argv) {
Andrew Overholt 9fa962a
+		boolean result = new GCCMain(new PrintWriter(System.out), new PrintWriter(System.err), false).compile(argv);
Andrew Overholt 9fa962a
+		System.exit(result ? 0 : 1);
Andrew Overholt 9fa962a
+	}
Andrew Overholt 9fa962a
+}