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 133050 Details for
Bug 267833
[javadoc] Standard block/inline tags should be warned when used in the wrong context (inline/block)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
bug_267833_5.txt (text/plain), 16.21 KB, created by
Jay Arthanareeswaran
on 2009-04-23 23:17:33 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2009-04-23 23:17:33 EDT
Size:
16.21 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.61 >diff -u -r1.61 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 16 Apr 2009 14:59:18 -0000 1.61 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 22 Apr 2009 16:09:44 -0000 >@@ -3319,7 +3319,7 @@ > * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73995">73995</a> > */ > public void testBug73995() { >- runNegativeTest( >+ runConformTest( > new String[] { > "X.java", > "public class X extends Base {\n" + >@@ -3339,14 +3339,7 @@ > "/** return \"The foo2 value\" */" + > "public int foo2(){return 0;}\n" + > "}" >- }, >- "----------\n" + >- "1. ERROR in X.java (at line 10)\n" + >- " * {@unknown_tag}\n" + >- " ^^^^^^^^^^^\n" + >- "Javadoc: Unexpected tag\n" + >- "----------\n" >- ); >+ }); > } > > /** >@@ -8504,7 +8497,7 @@ > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=267833" > */ > public void testBug267833() { >- runNegativeTest( >+ runConformTest( > new String[] { > "X.java", > "/**\n" + >@@ -8513,14 +8506,7 @@ > "*/\n" + > "public class X {\n" + > "}" >- }, >- "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " * Invalid custom tag {@custom \"Invalid\"} \n" + >- " ^^^^^^\n" + >- "Javadoc: Unexpected tag\n" + >- "----------\n" >- ); >+ }); > } > /** > * Additional test for bug 267833 >@@ -8567,8 +8553,8 @@ > "X.java", > "public class X {\n" + > "/** \n" + >- "* Description {@see value} , {@return value}, {@since value}, {@param i}, {@throws NullPointerException}\n" + >- "* and more {@author jay}, {@category cat}, {@deprecated}, {@exception Exception}, {@version 1.1}\n" + >+ "* Description {@see String} , {@return int}, {@since 1.0}, {@param i}, {@throws NullPointerException}\n" + >+ "* and more {@author jay}, {@category cat}, {@deprecated}, {@exception NullPointerException}, {@version 1.1}\n" + > "* and more {@since 1.0}, {@serial 0L}, {@serialData data}, {@serialField field}\n" + > "* @param i\n" + > "* @return value\n" + >@@ -8580,53 +8566,53 @@ > "}\n" }, > "----------\n" + > "1. ERROR in X.java (at line 3)\n" + >- " * Description {@see value} , {@return value}, {@since value}, {@param i}, {@throws NullPointerException}\n" + >+ " * Description {@see String} , {@return int}, {@since 1.0}, {@param i}, {@throws NullPointerException}\n" + > " ^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "2. ERROR in X.java (at line 3)\n" + >- " * Description {@see value} , {@return value}, {@since value}, {@param i}, {@throws NullPointerException}\n" + >- " ^^^^^^\n" + >+ " * Description {@see String} , {@return int}, {@since 1.0}, {@param i}, {@throws NullPointerException}\n" + >+ " ^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "3. ERROR in X.java (at line 3)\n" + >- " * Description {@see value} , {@return value}, {@since value}, {@param i}, {@throws NullPointerException}\n" + >- " ^^^^^\n" + >+ " * Description {@see String} , {@return int}, {@since 1.0}, {@param i}, {@throws NullPointerException}\n" + >+ " ^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "4. ERROR in X.java (at line 3)\n" + >- " * Description {@see value} , {@return value}, {@since value}, {@param i}, {@throws NullPointerException}\n" + >- " ^^^^^\n" + >+ " * Description {@see String} , {@return int}, {@since 1.0}, {@param i}, {@throws NullPointerException}\n" + >+ " ^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "5. ERROR in X.java (at line 3)\n" + >- " * Description {@see value} , {@return value}, {@since value}, {@param i}, {@throws NullPointerException}\n" + >- " ^^^^^^\n" + >+ " * Description {@see String} , {@return int}, {@since 1.0}, {@param i}, {@throws NullPointerException}\n" + >+ " ^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "6. ERROR in X.java (at line 4)\n" + >- " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception Exception}, {@version 1.1}\n" + >+ " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception NullPointerException}, {@version 1.1}\n" + > " ^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "7. ERROR in X.java (at line 4)\n" + >- " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception Exception}, {@version 1.1}\n" + >+ " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception NullPointerException}, {@version 1.1}\n" + > " ^^^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "8. ERROR in X.java (at line 4)\n" + >- " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception Exception}, {@version 1.1}\n" + >+ " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception NullPointerException}, {@version 1.1}\n" + > " ^^^^^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "9. ERROR in X.java (at line 4)\n" + >- " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception Exception}, {@version 1.1}\n" + >+ " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception NullPointerException}, {@version 1.1}\n" + > " ^^^^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "10. ERROR in X.java (at line 4)\n" + >- " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception Exception}, {@version 1.1}\n" + >- " ^^^^^^^\n" + >+ " * and more {@author jay}, {@category cat}, {@deprecated}, {@exception NullPointerException}, {@version 1.1}\n" + >+ " ^^^^^^^\n" + > "Javadoc: Unexpected tag\n" + > "----------\n" + > "11. ERROR in X.java (at line 5)\n" + >#P org.eclipse.jdt.core >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.78 >diff -u -r1.78 JavadocParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 16 Apr 2009 14:59:22 -0000 1.78 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 22 Apr 2009 16:09:48 -0000 >@@ -508,22 +508,24 @@ > boolean valid = false; > switch (firstChar) { > case 'a': >- if (!this.inlineTagStarted && length == TAG_AUTHOR_LENGTH && CharOperation.equals(TAG_AUTHOR, tagName, 0, length)) { >+ if (length == TAG_AUTHOR_LENGTH && CharOperation.equals(TAG_AUTHOR, tagName, 0, length)) { > this.tagValue = TAG_AUTHOR_VALUE; > this.tagWaitingForDescription = this.tagValue; > } > break; > case 'c': >- if (!this.inlineTagStarted && length == TAG_CATEGORY_LENGTH && CharOperation.equals(TAG_CATEGORY, tagName, 0, length)) { >+ if (length == TAG_CATEGORY_LENGTH && CharOperation.equals(TAG_CATEGORY, tagName, 0, length)) { > this.tagValue = TAG_CATEGORY_VALUE; >- valid = parseIdentifierTag(false); // TODO (frederic) reconsider parameter value when @category will be significant in spec >+ if (!this.inlineTagStarted) { >+ 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, 0, length)) { > this.tagValue = TAG_CODE_VALUE; > this.tagWaitingForDescription = this.tagValue; > } > break; > case 'd': >- if (!this.inlineTagStarted && length == TAG_DEPRECATED_LENGTH && CharOperation.equals(TAG_DEPRECATED, tagName, 0, length)) { >+ if (length == TAG_DEPRECATED_LENGTH && CharOperation.equals(TAG_DEPRECATED, tagName, 0, length)) { > this.deprecated = true; > valid = true; > this.tagValue = TAG_DEPRECATED_VALUE; >@@ -536,9 +538,11 @@ > } > break; > case 'e': >- if (!this.inlineTagStarted && length == TAG_EXCEPTION_LENGTH && CharOperation.equals(TAG_EXCEPTION, tagName, 0, length)) { >+ if (length == TAG_EXCEPTION_LENGTH && CharOperation.equals(TAG_EXCEPTION, tagName, 0, length)) { > this.tagValue = TAG_EXCEPTION_VALUE; >- valid = parseThrows(); >+ if (!this.inlineTagStarted) { >+ valid = parseThrows(); >+ } > } > break; > case 'i': >@@ -571,65 +575,71 @@ > this.tagValue = TAG_LINK_VALUE; > if (this.inlineTagStarted || (this.kind & COMPLETION_PARSER) != 0) { > valid= parseReference(); >- } else { >+ } // else { // Commented to avoid being reported twice > // bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=53290 > // Cannot have @link outside inline comment >- valid = false; >- if (this.reportProblems) { >- this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >- } >- } >+// valid = false; >+// if (this.reportProblems) { >+// this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >+// } >+// } > } else if (length == TAG_LINKPLAIN_LENGTH && CharOperation.equals(TAG_LINKPLAIN, tagName, 0, length)) { > this.tagValue = TAG_LINKPLAIN_VALUE; > if (this.inlineTagStarted) { > valid = parseReference(); >- } else { >- valid = false; >- if (this.reportProblems) { >- this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >- } >- } >+ } //else { // Commented to avoid being reported twice >+// valid = false; >+// if (this.reportProblems) { >+// this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >+// } >+// } > } else if (length == TAG_LITERAL_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_LITERAL, tagName, 0, length)) { > this.tagValue = TAG_LITERAL_VALUE; > this.tagWaitingForDescription = this.tagValue; > } > break; > case 'p': >- if (!this.inlineTagStarted && length == TAG_PARAM_LENGTH && CharOperation.equals(TAG_PARAM, tagName, 0, length)) { >+ if (length == TAG_PARAM_LENGTH && CharOperation.equals(TAG_PARAM, tagName, 0, length)) { > this.tagValue = TAG_PARAM_VALUE; >- valid = parseParam(); >+ if (!this.inlineTagStarted) { >+ valid = parseParam(); >+ } > } > break; > case 'r': >- if (!this.inlineTagStarted && length == TAG_RETURN_LENGTH && CharOperation.equals(TAG_RETURN, tagName, 0, length)) { >+ if (length == TAG_RETURN_LENGTH && CharOperation.equals(TAG_RETURN, tagName, 0, length)) { > this.tagValue = TAG_RETURN_VALUE; >- valid = parseReturn(); >+ if (!this.inlineTagStarted) { >+ valid = parseReturn(); >+ } > } > break; > case 's': >- if (!this.inlineTagStarted) { >- if (length == TAG_SEE_LENGTH && CharOperation.equals(TAG_SEE, tagName, 0, length)) { >- this.tagValue = TAG_SEE_VALUE; >+ if (length == TAG_SEE_LENGTH && CharOperation.equals(TAG_SEE, tagName, 0, length)) { >+ this.tagValue = TAG_SEE_VALUE; >+ if (!this.inlineTagStarted) { > valid = parseReference(); >- } else if (length == TAG_SERIAL_LENGTH && CharOperation.equals(TAG_SERIAL, tagName, 0, length)) { >- this.tagValue = TAG_SERIAL_VALUE; >- this.tagWaitingForDescription = this.tagValue; >- } else if (length == TAG_SERIAL_DATA_LENGTH && CharOperation.equals(TAG_SERIAL_DATA, tagName, 0, length)) { >- this.tagValue = TAG_SERIAL_DATA_VALUE; >- this.tagWaitingForDescription = this.tagValue; >- } else if (length == TAG_SERIAL_FIELD_LENGTH && CharOperation.equals(TAG_SERIAL_FIELD, tagName, 0, length)) { >- this.tagValue = TAG_SERIAL_FIELD_VALUE; >- this.tagWaitingForDescription = this.tagValue; >- } else if (length == TAG_SINCE_LENGTH && CharOperation.equals(TAG_SINCE, tagName, 0, length)) { >- this.tagValue = TAG_SINCE_VALUE; >- this.tagWaitingForDescription = this.tagValue; >- } >- } >+ } >+ } else if (length == TAG_SERIAL_LENGTH && CharOperation.equals(TAG_SERIAL, tagName, 0, length)) { >+ this.tagValue = TAG_SERIAL_VALUE; >+ this.tagWaitingForDescription = this.tagValue; >+ } else if (length == TAG_SERIAL_DATA_LENGTH && CharOperation.equals(TAG_SERIAL_DATA, tagName, 0, length)) { >+ this.tagValue = TAG_SERIAL_DATA_VALUE; >+ this.tagWaitingForDescription = this.tagValue; >+ } else if (length == TAG_SERIAL_FIELD_LENGTH && CharOperation.equals(TAG_SERIAL_FIELD, tagName, 0, length)) { >+ this.tagValue = TAG_SERIAL_FIELD_VALUE; >+ this.tagWaitingForDescription = this.tagValue; >+ } else if (length == TAG_SINCE_LENGTH && CharOperation.equals(TAG_SINCE, tagName, 0, length)) { >+ this.tagValue = TAG_SINCE_VALUE; >+ this.tagWaitingForDescription = this.tagValue; >+ } > break; > case 't': >- if (!this.inlineTagStarted && length == TAG_THROWS_LENGTH && CharOperation.equals(TAG_THROWS, tagName, 0, length)) { >+ if (length == TAG_THROWS_LENGTH && CharOperation.equals(TAG_THROWS, tagName, 0, length)) { > this.tagValue = TAG_THROWS_VALUE; >- valid = parseThrows(); >+ if (!this.inlineTagStarted) { >+ valid = parseThrows(); >+ } > } > break; > case 'v': >@@ -638,10 +648,10 @@ > if (this.sourceLevel >= ClassFileConstants.JDK1_5) { > if (this.inlineTagStarted) { > valid = parseReference(); >- } else { >- valid = false; >- if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >- } >+ }// else { // Commented to avoid being reported twice >+// valid = false; >+// if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >+// } > } else { > if (this.validValuePositions == -1) { > if (this.invalidValuePositions != -1) { >@@ -657,7 +667,7 @@ > if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); > } > } >- } else if (!this.inlineTagStarted && length == TAG_VERSION_LENGTH && CharOperation.equals(TAG_VERSION, tagName, 0, length)) { >+ } else if (length == TAG_VERSION_LENGTH && CharOperation.equals(TAG_VERSION, tagName, 0, length)) { > this.tagValue = TAG_VERSION_VALUE; > this.tagWaitingForDescription = this.tagValue; > } else { >@@ -669,12 +679,20 @@ > break; > } > this.textStart = this.index; >- if (this.tagValue != TAG_OTHERS_VALUE && !this.inlineTagStarted) { >- this.lastBlockTagValue = this.tagValue; >- } >- if (this.inlineTagStarted && this.reportProblems >- && (this.tagValue >= JAVADOC_TAG_TYPE.length || JAVADOC_TAG_TYPE[this.tagValue] != TAG_TYPE_INLINE)) { >- this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >+ if (this.tagValue != TAG_OTHERS_VALUE) { >+ if (!this.inlineTagStarted) { >+ this.lastBlockTagValue = this.tagValue; >+ } >+ if ((this.inlineTagStarted && JAVADOC_TAG_TYPE[this.tagValue] == TAG_TYPE_BLOCK) >+ || (!this.inlineTagStarted && JAVADOC_TAG_TYPE[this.tagValue] == TAG_TYPE_INLINE)) { >+ valid = false; >+ // Do we have to reset these? >+ this.tagValue = TAG_OTHERS_VALUE; >+ this.tagWaitingForDescription = NO_TAG_VALUE; >+ if (this.reportProblems) { >+ this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); >+ } >+ } > } > return valid; > }
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 267833
:
129810
|
131000
|
131151
|
131908
|
131909
|
132025
|
132040
|
132079
|
133050
|
133083
|
133106