### 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.315 diff -u -r1.315 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 3 Jan 2008 08:34:10 -0000 1.315 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 3 Jan 2008 12:32:15 -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('('); @@ -2260,7 +2209,6 @@ boolean didSpecifyDefaultEncoding = false; boolean didSpecifyDeprecation = false; - boolean useEnableJavadoc = false; boolean didSpecifyCompliance = false; boolean didSpecifyDisabledAnnotationProcessing = false; @@ -2734,7 +2682,7 @@ } break; } - handleWarningToken(token, isEnabling, useEnableJavadoc); + handleWarningToken(token, isEnabling); } if (tokenCounter == 0) { throw new InvalidInputException( @@ -2755,10 +2703,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$ @@ -3066,6 +3011,58 @@ mode = DEFAULT; continue; } + + // set DocCommentSupport, with appropriate side effects on defaults if + // javadoc is not enabled + 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: references that are embedded in javadoc are ignored + // from the perspective of parameters and thrown exceptions usage + this.options.put( + CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, + CompilerOptions.DISABLED); + this.options.put( + CompilerOptions.OPTION_ReportUnusedDeclaredThrownExceptionIncludeDocCommentReference, + CompilerOptions.DISABLED); + } + // configure warnings for javadoc contents + if (this.warnJavadocOn || this.warnAllJavadocOn) { + 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_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.141 diff -u -r1.141 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 3 Jan 2008 08:34:13 -0000 1.141 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 3 Jan 2008 12:32:20 -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",