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