### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v retrieving revision 1.314 diff -u -r1.314 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 8 Nov 2007 16:59:56 -0000 1.314 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 30 Nov 2007 14:42:33 -0000 @@ -1190,7 +1190,12 @@ // for the '-d none' option (wherever it may be found) public static final int DEFAULT_SIZE_CLASSPATH = 4; public static final String NONE = "none"; //$NON-NLS-1$ - + + // javadoc analysis tuning + boolean enableJavadocOn; + boolean warnJavadocOn; + boolean warnAllJavadocOn; + /* * Internal IDE API */ @@ -1603,7 +1608,7 @@ * External API * Handle a single warning token. */ -protected void handleWarningToken(String token, boolean isEnabling, boolean useEnableJavadoc) throws InvalidInputException { +protected void handleWarningToken(String token, boolean isEnabling) throws InvalidInputException { if (token.equals("constructorName")) { //$NON-NLS-1$ this.options.put( CompilerOptions.OPTION_ReportMethodWithConstructorName, @@ -1745,65 +1750,9 @@ 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); - this.options.put( - CompilerOptions.OPTION_ReportRedundantSuperinterface, - CompilerOptions.DISABLED); - } + this.warnJavadocOn = isEnabling; } 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); - } + this.warnAllJavadocOn = this.warnJavadocOn = isEnabling; } else if (token.startsWith("tasks")) { //$NON-NLS-1$ String taskTags = Util.EMPTY_STRING; int start = token.indexOf('('); @@ -2261,7 +2210,6 @@ boolean didSpecifyDefaultEncoding = false; boolean didSpecifyDeprecation = false; boolean didSpecifyWarnings = false; - boolean useEnableJavadoc = false; boolean didSpecifyCompliance = false; boolean didSpecifyDisabledAnnotationProcessing = false; @@ -2724,7 +2672,7 @@ token = token.substring(1); break; } - handleWarningToken(token, isEnabling, useEnableJavadoc); + handleWarningToken(token, isEnabling); } if (tokenCounter == 0) { throw new InvalidInputException( @@ -2746,10 +2694,7 @@ } if (currentArg.equals("-enableJavadoc")) {//$NON-NLS-1$ mode = DEFAULT; - this.options.put( - CompilerOptions.OPTION_DocCommentSupport, - CompilerOptions.ENABLED); - useEnableJavadoc = true; + this.enableJavadocOn = true; continue; } if (currentArg.equals("-Xemacs")) { //$NON-NLS-1$ @@ -3057,6 +3002,69 @@ mode = DEFAULT; continue; } + + if (this.enableJavadocOn) { + this.options.put( + CompilerOptions.OPTION_DocCommentSupport, + CompilerOptions.ENABLED); + } else if (this.warnJavadocOn || this.warnAllJavadocOn) { + this.options.put( + CompilerOptions.OPTION_DocCommentSupport, + CompilerOptions.ENABLED); + // override defaults + this.options.put( + CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, + CompilerOptions.DISABLED); + this.options.put( + CompilerOptions.OPTION_ReportUnusedDeclaredThrownExceptionIncludeDocCommentReference, + CompilerOptions.DISABLED); + } + if (this.warnJavadocOn) { + 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); + this.options.put( + CompilerOptions.OPTION_ReportRedundantSuperinterface, + CompilerOptions.DISABLED); + } + if (this.warnAllJavadocOn) { + 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); + } if (printUsageRequired || (filesCount == 0 && classCount == 0)) { if (usageSection == null) { #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.140 diff -u -r1.140 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 30 Nov 2007 13:50:41 -0000 1.140 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 30 Nov 2007 14:42:35 -0000 @@ -7632,7 +7632,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588 // -warn option - regression tests -public void _test206_warn_options() { +public void test206_warn_options() { // same source as 168, skip check defaults this.runConformTest( new String[] { @@ -7653,7 +7653,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588 // -warn option - regression tests -public void _test207_warn_options() { +public void test207_warn_options() { // same source as 168, skip check defaults this.runConformTest( new String[] { @@ -7760,7 +7760,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588 // variant - javadoc and allJavadoc mistakenly imply enableJavadoc -public void _test212_warn_options() { +public void test212_warn_options() { this.runConformTest( new String[] { "X.java", @@ -7791,7 +7791,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211588 // variant - javadoc and allJavadoc mistakenly imply enableJavadoc -public void _test213_warn_options() { +public void test213_warn_options() { this.runConformTest( new String[] { "X.java",