Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 179869 Details for
Bug 322581
[5.0] Add Javadoc compiler option to (not) report missing tags for method type parameters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v1.0 + regression tests
patch322581.txt (text/plain), 15.16 KB, created by
Ayushman Jain
on 2010-09-29 13:01:41 EDT
(
hide
)
Description:
proposed fix v1.0 + regression tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-09-29 13:01:41 EDT
Size:
15.16 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java,v >retrieving revision 1.66 >diff -u -r1.66 Javadoc.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 20 Aug 2009 13:21:00 -0000 1.66 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 29 Sep 2010 16:00:59 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -325,7 +325,7 @@ > // @param tags > CompilerOptions compilerOptions = methScope.compilerOptions(); > resolveParamTags(methScope, reportMissing, compilerOptions.reportUnusedParameterIncludeDocCommentReference /* considerParamRefAsUsage*/); >- resolveTypeParameterTags(methScope, reportMissing); >+ resolveTypeParameterTags(methScope, reportMissing && compilerOptions.reportMissingJavadocTagsMethodTypeParameters); > > // @return tags > if (this.returnStatement == null) { >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.232 >diff -u -r1.232 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 24 Sep 2010 06:30:56 -0000 1.232 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 29 Sep 2010 16:00:59 -0000 >@@ -76,6 +76,7 @@ > public static final String OPTION_ReportMissingJavadocTags = "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingJavadocTagsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingJavadocTagsOverriding = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$ >+ public static final String OPTION_ReportMissingJavadocTagsMethodTypeParameters = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingJavadocComments = "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingJavadocTagDescription = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingJavadocCommentsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$ >@@ -326,6 +327,8 @@ > public int reportMissingJavadocTagsVisibility; > /** Specify if need to flag missing javadoc tags for overriding method */ > public boolean reportMissingJavadocTagsOverriding; >+ /** Specify if need to flag missing javadoc tags for method type parameters (java 1.5 and above)*/ >+ public boolean reportMissingJavadocTagsMethodTypeParameters; > /** Only report missing javadoc comment above a given level of visibility of associated construct */ > public int reportMissingJavadocCommentsVisibility; > /** Specify if need to flag missing javadoc comment for overriding method */ >@@ -857,6 +860,7 @@ > optionsMap.put(OPTION_ReportMissingJavadocTags, getSeverityString(MissingJavadocTags)); > optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, getVisibilityString(this.reportMissingJavadocTagsVisibility)); > optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); >+ optionsMap.put(OPTION_ReportMissingJavadocTagsMethodTypeParameters, this.reportMissingJavadocTagsMethodTypeParameters ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportMissingJavadocComments, getSeverityString(MissingJavadocComments)); > optionsMap.put(OPTION_ReportMissingJavadocTagDescription, this.reportMissingJavadocTagDescription); > optionsMap.put(OPTION_ReportMissingJavadocCommentsVisibility, getVisibilityString(this.reportMissingJavadocCommentsVisibility)); >@@ -1018,6 +1022,7 @@ > // check missing javadoc tags > this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPublic; > this.reportMissingJavadocTagsOverriding = false; >+ this.reportMissingJavadocTagsMethodTypeParameters = false; > > // check missing javadoc comments > this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPublic; >@@ -1399,6 +1404,13 @@ > this.reportMissingJavadocTagsOverriding = false; > } > } >+ if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsMethodTypeParameters)) != null) { >+ if (ENABLED.equals(optionValue)) { >+ this.reportMissingJavadocTagsMethodTypeParameters = true; >+ } else if (DISABLED.equals(optionValue)) { >+ this.reportMissingJavadocTagsMethodTypeParameters = false; >+ } >+ } > if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) { > updateSeverity(MissingJavadocComments, optionValue); > } >@@ -1476,6 +1488,7 @@ > buf.append("\n\t\t+ visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$ > buf.append("\n\t\t+ missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$ > buf.append("\n\t\t+ visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$ >+ buf.append("\n\t\t+ report missing javadoc tags for method type parameters: ").append(this.reportMissingJavadocTagsMethodTypeParameters ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t\t+ report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t\t+ missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$ > buf.append("\n\t\t+ report missing tag description option: ").append(this.reportMissingJavadocTagDescription); //$NON-NLS-1$ >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.653 >diff -u -r1.653 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 24 Sep 2010 06:30:56 -0000 1.653 >+++ model/org/eclipse/jdt/core/JavaCore.java 29 Sep 2010 16:00:59 -0000 >@@ -1206,6 +1206,21 @@ > */ > public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + ".compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$ > /** >+ * Compiler option ID: Reporting Missing Javadoc Tags for Method Type Parameters. >+ * <p>Specify whether a missing <code>@param</code> for a type parameter in a method declaration should be reported. >+ * When enabled, the compiler will issue a missing javadoc tag error or warning for the type parameter without a >+ * corresponding <code>@param</code> tag.</p> >+ * <p>This option only has an effect if the compiler compliance is 1.5 or greater.</p> >+ * <dl> >+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"</code></dd> >+ * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd> >+ * <dt>Default:</dt><dd><code>"disabled"</code></dd> >+ * </dl> >+ * @since 3.7 >+ * @category CompilerOptionID >+ */ >+ public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS = PLUGIN_ID + ".compiler.problem.missingJavadocTagsMethodTypeParameters"; //$NON-NLS-1$ >+ /** > * Compiler option ID: Reporting Missing Javadoc Comments. > * <p>This is the generic control for the severity of missing Javadoc comment problems. > * When enabled, the compiler will issue an error or a warning when Javadoc comments are missing. >#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.211 >diff -u -r1.211 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 24 Sep 2010 06:30:50 -0000 1.211 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 29 Sep 2010 16:01:03 -0000 >@@ -1836,6 +1836,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility\" value=\"public\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription\" value=\"return_tag\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTags\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility\" value=\"public\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation\" value=\"ignore\"/>\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java,v >retrieving revision 1.48 >diff -u -r1.48 JavadocTest_1_5.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java 4 Jan 2010 19:28:17 -0000 1.48 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java 29 Sep 2010 16:01:03 -0000 >@@ -72,6 +72,7 @@ > options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR); > options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR); > options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE); >+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.ENABLED); > return options; > } > /* (non-Javadoc) >@@ -4143,5 +4144,80 @@ > " " + > " }\n" > }); >- } >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322581 >+ // To test the javadoc option CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters >+ public void testBug322581a() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.DISABLED); >+ this.runNegativeTest( >+ true, >+ new String[] { >+ "X.java", >+ " public class X {\n" + >+ " /**\n" + >+ " * javadoc\n" + >+ " */\n" + >+ " public <T, U, V> void foo(int val, Object obj) {}\n" + >+ "}" >+ }, >+ null, >+ options, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " public <T, U, V> void foo(int val, Object obj) {}\n" + >+ " ^^^\n" + >+ "Javadoc: Missing tag for parameter val\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " public <T, U, V> void foo(int val, Object obj) {}\n" + >+ " ^^^\n" + >+ "Javadoc: Missing tag for parameter obj\n" + >+ "----------\n", >+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError >+ ); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322581 >+ // To test the javadoc option CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters >+ public void testBug322581b() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.DISABLED); >+ this.runNegativeTest( >+ true, >+ new String[] { >+ "ListCallable.java", >+ " import java.util.Collections;\n" + >+ " import java.util.List;\n" + >+ " import java.util.concurrent.Callable;\n" + >+ "/**\n" + >+ " * Callable that returns a list.\n" + >+ " */\n" + >+ "public abstract class ListCallable<V> implements Callable<List<V>> { // good warning\n" + >+ " public abstract List<V> call() throws Exception;\n" + >+ " /**\n" + >+ " * Returns a {@link ListCallable} that wraps the result from calling <code>callable</code>.\n" + >+ " * @param callable the {@link Callable} to wrap\n" + >+ " * @return the wrapper\n" + >+ " */\n" + >+ " public static <T> ListCallable<T> from(final Callable<T> callable) { // don't warn\n" + >+ " return new ListCallable<T>() {\n" + >+ " @Override\n" + >+ " public List<T> call() throws Exception {\n" + >+ " return Collections.singletonList(callable.call());\n" + >+ " }\n" + >+ " };\n" + >+ " }\n" + >+ "}" >+ }, >+ null, >+ options, >+ "----------\n" + >+ "1. ERROR in ListCallable.java (at line 7)\n" + >+ " public abstract class ListCallable<V> implements Callable<List<V>> { // good warning\n" + >+ " ^\n" + >+ "Javadoc: Missing tag for parameter V\n" + >+ "----------\n", >+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError >+ ); >+ } > } >#P org.eclipse.jdt.doc.isv >Index: guide/jdt_api_options.htm >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.isv/guide/jdt_api_options.htm,v >retrieving revision 1.75 >diff -u -r1.75 jdt_api_options.htm >--- guide/jdt_api_options.htm 2 Jun 2010 13:02:29 -0000 1.75 >+++ guide/jdt_api_options.htm 29 Sep 2010 16:01:05 -0000 >@@ -774,6 +774,20 @@ > </tr> > > <tr> >+<td colspan=2><b>Reporting Missing Javadoc Tags for Method Type Parameters</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS">COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS</a></b>)</td> >+</tr> >+<tr valign="top"> >+<td rowspan=2>Specify whether a missing <code>@param</code> for a type parameter in a method declaration should be reported. >+When enabled, the compiler will issue a missing javadoc tag error or warning for the type parameter without a >+corresponding <code>@param</code> tag. >+<br>This option only has an effect if the compiler compliance is 1.6 or greater.</td> >+<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ENABLED">ENABLED</a></b></td> >+</tr> >+<tr valign="top"> >+<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#DISABLED"><i>DISABLED</i></a></b></td> >+</tr> >+ >+<tr> > <td colspan=2><b>Visibility Level For Missing Javadoc Tags</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY">COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY</a></b>)</td> > </tr> > <tr valign="top">
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 322581
:
176704
|
179869
|
180330