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 93146 Details for
Bug 222902
[Javadoc] Missing description should not be warned in some cases
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New proposed fix and regression test
222902.txt (text/plain), 14.42 KB, created by
Jerome Lanneluc
on 2008-03-21 12:06:02 EDT
(
hide
)
Description:
New proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-03-21 12:06:02 EDT
Size:
14.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java,v >retrieving revision 1.38 >diff -u -r1.38 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 16 Oct 2007 10:24:51 -0000 1.38 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 21 Mar 2008 16:03:53 -0000 >@@ -3083,7 +3083,7 @@ > "}\n" > }; > reportInvalidJavadoc = CompilerOptions.WARNING; >- reportMissingJavadocDescription = CompilerOptions.ALL_TAGS; >+ reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS; > runNegativeTest(units, > "----------\n" + > "1. WARNING in X.java (at line 2)\n" + >@@ -3180,7 +3180,7 @@ > "}\n" > }; > reportInvalidJavadoc = CompilerOptions.WARNING; >- reportMissingJavadocDescription = CompilerOptions.ALL_TAGS; >+ reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS; > runConformTest(units); > } > public void testBug73352c() { >@@ -6936,4 +6936,111 @@ > "Javadoc: Malformed reference (missing end space separator)\n" + > "----------\n"); > } >+ /** >+ * @bug 222902: [Javadoc] Missing description should not be warned in some cases >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222902" >+ */ >+ public void testBug222902() { >+ String[] units = new String[] { >+ "X.java", >+ "/**\n" + >+ " * @author\n" + >+ " * {@code}\n" + >+ " * @deprecated\n" + >+ " * {@literal}\n" + >+ " * @since\n" + >+ " * @version\n" + >+ " * @generated\n" + // should not get a warning for missing description on non-standard tag >+ " * @code\n" + // should not get a warning for non-inlined tag @code >+ " * @literal\n" + // should not get a warning for non-inlined tag @literal >+ "*/\n" + >+ "public class X {\n" + >+ " /**\n" + >+ " * @param aParam\n" + >+ " * @return\n" + >+ " * @throws NullPointerException\n" + >+ " * @exception NullPointerException\n" + >+ " */\n" + >+ " public String foo(String aParam) {\n" + >+ " return new String();\n" + >+ " }\n" + >+ " /**\n" + >+ " * @serial\n" + >+ " * @serialData\n" + >+ " * @serialField\n" + >+ " */\n" + >+ " Object field;\n" + >+ "}\n" >+ }; >+ reportInvalidJavadoc = CompilerOptions.WARNING; >+ reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS; >+ runNegativeTest(units, >+ "----------\n" + >+ "1. WARNING in X.java (at line 2)\n" + >+ " * @author\n" + >+ " ^^^^^^\n" + >+ "Javadoc: Description expected after @author\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 3)\n" + >+ " * {@code}\n" + >+ " ^^^^\n" + >+ "Javadoc: Description expected after @code\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 4)\n" + >+ " * @deprecated\n" + >+ " ^^^^^^^^^^\n" + >+ "Javadoc: Description expected after @deprecated\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 5)\n" + >+ " * {@literal}\n" + >+ " ^^^^^^^\n" + >+ "Javadoc: Description expected after @literal\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 6)\n" + >+ " * @since\n" + >+ " ^^^^^\n" + >+ "Javadoc: Description expected after @since\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 7)\n" + >+ " * @version\n" + >+ " ^^^^^^^\n" + >+ "Javadoc: Description expected after @version\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 14)\n" + >+ " * @param aParam\n" + >+ " ^^^^^^\n" + >+ "Javadoc: Description expected after this reference\n" + >+ "----------\n" + >+ "8. WARNING in X.java (at line 15)\n" + >+ " * @return\n" + >+ " ^^^^^^\n" + >+ "Javadoc: Description expected after @return\n" + >+ "----------\n" + >+ "9. WARNING in X.java (at line 16)\n" + >+ " * @throws NullPointerException\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: Description expected after this reference\n" + >+ "----------\n" + >+ "10. WARNING in X.java (at line 17)\n" + >+ " * @exception NullPointerException\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: Description expected after this reference\n" + >+ "----------\n" + >+ "11. WARNING in X.java (at line 23)\n" + >+ " * @serial\n" + >+ " ^^^^^^\n" + >+ "Javadoc: Description expected after @serial\n" + >+ "----------\n" + >+ "12. WARNING in X.java (at line 24)\n" + >+ " * @serialData\n" + >+ " ^^^^^^^^^^\n" + >+ "Javadoc: Description expected after @serialData\n" + >+ "----------\n" + >+ "13. WARNING in X.java (at line 25)\n" + >+ " * @serialField\n" + >+ " ^^^^^^^^^^^\n" + >+ "Javadoc: Description expected after @serialField\n" + >+ "----------\n" >+ ); >+ } > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java,v >retrieving revision 1.13 >diff -u -r1.13 JavadocTagConstants.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java 4 Oct 2007 13:01:46 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java 21 Mar 2008 16:03:54 -0000 >@@ -52,6 +52,14 @@ > public static final int TAG_INHERITDOC_LENGTH = TAG_INHERITDOC.length; > public static final int TAG_VALUE_LENGTH = TAG_VALUE.length; > public static final int TAG_CATEGORY_LENGTH = TAG_CATEGORY.length; >+ public static final int TAG_AUTHOR_LENGTH = TAG_AUTHOR.length; >+ public static final int TAG_SERIAL_LENGTH = TAG_SERIAL.length; >+ public static final int TAG_SERIAL_DATA_LENGTH = TAG_SERIAL_DATA.length; >+ public static final int TAG_SERIAL_FIELD_LENGTH = TAG_SERIAL_FIELD.length; >+ public static final int TAG_SINCE_LENGTH = TAG_SINCE.length; >+ public static final int TAG_VERSION_LENGTH = TAG_VERSION.length; >+ public static final int TAG_CODE_LENGTH = TAG_CODE.length; >+ public static final int TAG_LITERAL_LENGTH = TAG_LITERAL.length; > > > // tags value >@@ -67,6 +75,14 @@ > public static final int TAG_INHERITDOC_VALUE = 9; > public static final int TAG_VALUE_VALUE = 10; > public static final int TAG_CATEGORY_VALUE = 11; >+ public static final int TAG_AUTHOR_VALUE = 12; >+ public static final int TAG_SERIAL_VALUE = 13; >+ public static final int TAG_SERIAL_DATA_VALUE = 14; >+ public static final int TAG_SERIAL_FIELD_VALUE = 15; >+ public static final int TAG_SINCE_VALUE = 16; >+ public static final int TAG_VERSION_VALUE = 17; >+ public static final int TAG_CODE_VALUE = 18; >+ public static final int TAG_LITERAL_VALUE = 19; > public static final int TAG_OTHERS_VALUE = 100; > > // tags expected positions >Index: compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java,v >retrieving revision 1.64 >diff -u -r1.64 JavadocParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 4 Oct 2007 13:01:21 -0000 1.64 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 21 Mar 2008 16:03:54 -0000 >@@ -483,15 +483,22 @@ > this.scanner.currentPosition = this.tagSourceEnd+1; > > // Decide which parse to perform depending on tag name >- this.tagValue = NO_TAG_VALUE; >+ this.tagValue = TAG_OTHERS_VALUE; > boolean alreadyParsedTag = false; > switch (token) { > case TerminalTokens.TokenNameIdentifier : > switch (tagName[0]) { >+ case 'a': >+ if (length == TAG_AUTHOR_LENGTH && CharOperation.equals(TAG_AUTHOR, tagName)) { >+ this.tagValue = TAG_AUTHOR_VALUE; >+ } >+ break; > case 'c': > if (length == TAG_CATEGORY_LENGTH && CharOperation.equals(TAG_CATEGORY, tagName)) { > this.tagValue = TAG_CATEGORY_VALUE; > valid = parseIdentifierTag(false); // TODO (frederic) reconsider parameter value when @category will be significant in spec >+ } else if (length == TAG_CODE_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_CODE, tagName)) { >+ this.tagValue = TAG_CODE_VALUE; > } > break; > case 'd': >@@ -547,6 +554,8 @@ > } > } > alreadyParsedTag = true; >+ } else if (length == TAG_LITERAL_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_LITERAL, tagName)) { >+ this.tagValue = TAG_LITERAL_VALUE; > } > break; > case 'p': >@@ -570,6 +579,14 @@ > valid = parseReference(); > } > alreadyParsedTag = true; >+ } else if (length == TAG_SERIAL_LENGTH && CharOperation.equals(TAG_SERIAL, tagName)) { >+ this.tagValue = TAG_SERIAL_VALUE; >+ } else if (length == TAG_SERIAL_DATA_LENGTH && CharOperation.equals(TAG_SERIAL_DATA, tagName)) { >+ this.tagValue = TAG_SERIAL_DATA_VALUE; >+ } else if (length == TAG_SERIAL_FIELD_LENGTH && CharOperation.equals(TAG_SERIAL_FIELD, tagName)) { >+ this.tagValue = TAG_SERIAL_FIELD_VALUE; >+ } else if (length == TAG_SINCE_LENGTH && CharOperation.equals(TAG_SINCE, tagName)) { >+ this.tagValue = TAG_SINCE_VALUE; > } > break; > case 'v': >@@ -598,6 +615,8 @@ > } > } > alreadyParsedTag = true; >+ } else if (length == TAG_VERSION_LENGTH && CharOperation.equals(TAG_VERSION, tagName)) { >+ this.tagValue = TAG_VERSION_VALUE; > } else { > createTag(); > } >@@ -627,7 +646,7 @@ > break; > } > this.textStart = this.index; >- if (! alreadyParsedTag && this.reportProblems && verifyEndLine(this.scanner.currentPosition)) { >+ if (this.tagValue != TAG_OTHERS_VALUE && ! alreadyParsedTag && this.reportProblems && verifyEndLine(this.scanner.currentPosition)) { > this.sourceParser.problemReporter().javadocMissingTagDescription(tagName, this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers); > return false; > } >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.368 >diff -u -r1.368 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 5 Mar 2008 11:56:14 -0000 1.368 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 21 Mar 2008 16:03:56 -0000 >@@ -1135,7 +1135,7 @@ > } > break; > case IProblem.JavadocMissingTagDescription: >- if (! CompilerOptions.ALL_TAGS.equals(this.options.reportMissingJavadocTagDescription)) { >+ if (! CompilerOptions.ALL_STANDARD_TAGS.equals(this.options.reportMissingJavadocTagDescription)) { > return ProblemSeverities.Ignore; > } > break; >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.610 >diff -u -r1.610 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 17 Mar 2008 14:14:21 -0000 1.610 >+++ model/org/eclipse/jdt/core/JavaCore.java 21 Mar 2008 16:03:56 -0000 >@@ -1090,12 +1090,14 @@ > public static final String COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + ".compiler.problem.invalidJavadocTagsVisibility"; //$NON-NLS-1$ > /** > * Compiler option ID: Reporting missing tag description. >- * <p>When enabled, the compiler will report a warning or an error for any Javadoc missing a required description. >+ * <p>When enabled, the compiler will report a warning or an error for any Javadoc tag missing a required description. > * <p>The severity of the problem is controlled with option {@link #COMPILER_PB_INVALID_JAVADOC}. > * <p>This option is NOT dependent from the Report errors in tags option. >+ * <p>The initial set of standard tags is a subset of the <a href="http://java.sun.com/javase/6/docs/technotes/tools/windows/javadoc.html#javadoctags">Javadoc tags</a> >+ * that have a description, text or label. This set may grow in the future. User defined tags are thus not included in the standard tags. > * <dl> > * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription"</code></dd> >- * <dt>Possible values:</dt><dd><code>{ "return_tag", "all_tags", "no_tag" }</code></dd> >+ * <dt>Possible values:</dt><dd><code>{ "return_tag", "all_standard_tags", "no_tag" }</code></dd> > * <dt>Default:</dt><dd><code>"return_tag"</code></dd> > * </dl> > * @since 3.4 >@@ -2135,7 +2137,12 @@ > * @since 3.4 > * @category OptionValue > */ >- public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_TAGS = CompilerOptions.ALL_TAGS; >+ public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_STANDARD_TAGS = CompilerOptions.ALL_STANDARD_TAGS; >+ /** >+ * @deprecated use {@link #COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_STANDARD_TAGS} instead >+ * TODO: remove before 3.4M6 >+ */ >+ public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_TAGS = CompilerOptions.ALL_STANDARD_TAGS; > // end configurable option values } > > /** >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.200 >diff -u -r1.200 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 5 Mar 2008 07:57:20 -0000 1.200 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 21 Mar 2008 16:03:54 -0000 >@@ -152,7 +152,7 @@ > public static final String PRIVATE = "private"; //$NON-NLS-1$ > public static final String RETURN_TAG = "return_tag"; //$NON-NLS-1$ > public static final String NO_TAG = "no_tag"; //$NON-NLS-1$ >- public static final String ALL_TAGS = "all_tags"; //$NON-NLS-1$ >+ public static final String ALL_STANDARD_TAGS = "all_standard_tags"; //$NON-NLS-1$ > > /** > * Bit mask for configurable problems (error/warning threshold)
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 222902
:
93125
| 93146