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 130273 Details for
Bug 200207
[javadoc] Incorrect flagging of @see as malformed javadoc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
bug_200207_4.txt (text/plain), 8.30 KB, created by
Jay Arthanareeswaran
on 2009-03-30 12:44:44 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2009-03-30 12:44:44 EDT
Size:
8.30 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.60 >diff -u -r1.60 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 24 Mar 2009 08:51:00 -0000 1.60 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 30 Mar 2009 16:42:14 -0000 >@@ -7526,7 +7526,7 @@ > "1. ERROR in pkg\\X.java (at line 5)\n" + > " * {@link \"http://www.eclipse.org/}\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Javadoc: Invalid reference\n" + >+ "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + > "----------\n" + > "2. ERROR in pkg\\X.java (at line 6)\n" + > " * @see \"http://www.eclipse.org/\n" + >@@ -8487,4 +8487,104 @@ > JavacTestOptions.Excuse.EclipseWarningConfiguredAsError > ); > } >+public void testBug200207() { >+ runNegativeTest( >+ new String[] { >+ "XYZ.java", >+ "/** \n" + >+ "* " + >+ "* @see \"Unterminated\n" + >+ "* @see String\"\n" + >+ "*/ \n" + >+ "public class XYZ { \n"+ >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in XYZ.java (at line 2)\n" + >+ " * * @see \"Unterminated\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "2. ERROR in XYZ.java (at line 3)\n" + >+ " * @see String\"\n" + >+ " ^^^^^^^\n" + >+ "Javadoc: Malformed reference (missing end space separator)\n" + >+ "----------\n"); >+} >+public void testBug200207_2() { >+ runConformTest( >+ new String[] { >+ "XYZ.java", >+ "/** \n" + >+ "* " + >+ "* @see \"Unterminated\n" + >+ "* String\"\n" + >+ "* @author jay\n" + >+ "* @see \"Alice in \n" + >+ "* still ** @@{} not closed @\n" + >+ "* wonder*land@\"\n" + >+ "*/ \n" + >+ "public class XYZ { \n"+ >+ "}\n" >+ }); >+} >+ >+public void testBug200207_3() { >+ runConformTest( >+ new String[] { >+ "XYZ.java", >+ "/** \n" + >+ "* " + >+ "* @see <a href=\"http://www.eclipse.org" + >+ "* \">Eclipse</a>" + >+ "*/ \n" + >+ "public class XYZ { \n"+ >+ "}\n" >+ }, >+ ""); >+} >+ >+public void testBug200207_4() { >+ runNegativeTest( >+ new String[] { >+ "XYZ.java", >+ "/** \n" + >+ "* This test includes valid {@link \"http://www.eclipse.org\"}, {@author jay} \n" + >+ "* invalid {@link \"http://eclipse.org} inline tags \n" + >+ "* " + >+ "*/ \n" + >+ "public class XYZ { \n"+ >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in XYZ.java (at line 3)\n" + >+ " * invalid {@link \"http://eclipse.org} inline tags \n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + >+ "----------\n"); >+} >+ >+public void testBug200207_5() { >+ runNegativeTest( >+ new String[] { >+ "XYZ.java", >+ "/** \n" + >+ "* This test checks for two invalid {@link \"http://www.eclipse.org} inline {@link http://eclipse.org\"} tags \n" + >+ "* " + >+ "*/ \n" + >+ "public class XYZ { \n"+ >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in XYZ.java (at line 2)\n" + >+ " * This test checks for two invalid {@link \"http://www.eclipse.org} inline {@link http://eclipse.org\"} tags \n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + >+ "----------\n" + >+ "2. ERROR in XYZ.java (at line 2)\n" + >+ " * This test checks for two invalid {@link \"http://www.eclipse.org} inline {@link http://eclipse.org\"} tags \n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + >+ "----------\n"); >+} > } >\ No newline at end of file >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java,v >retrieving revision 1.88 >diff -u -r1.88 AbstractCommentParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 24 Mar 2009 08:51:03 -0000 1.88 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 30 Mar 2009 16:42:19 -0000 >@@ -1158,7 +1158,7 @@ > if (currentError.length>0 && currentError[0] == '"') { > if (this.reportProblems) { > boolean isUrlRef = false; >- if (this.tagValue == TAG_SEE_VALUE) { >+ if (this.tagValue == TAG_SEE_VALUE || this.tagValue == TAG_LINK_VALUE) { > int length=currentError.length, i=1 /* first char is " */; > while (i<length && ScannerHelper.isLetter(currentError[i])) { > i++; >@@ -1433,12 +1433,106 @@ > return c; > } > >+protected int scanJavadocString() throws InvalidInputException { >+ int startPosition = this.index; >+ boolean possibleNextTag = false; >+ boolean seekAhead = true; >+ int endOfToken = -1; >+ try { >+ while (seekAhead) { >+ >+ if (this.index >= this.javadocTextEnd) { >+ if (endOfToken != -1) { >+ this.index = endOfToken; >+ } >+ throw new InvalidInputException(Scanner.UNTERMINATED_STRING); >+ } >+ char currentChar = readChar(); >+ >+ switch(currentChar) { >+ case '@': >+ if (possibleNextTag) { >+ this.index = endOfToken; >+ throw new InvalidInputException(Scanner.UNTERMINATED_STRING); >+ } >+ break; >+ case '}': >+ case '{': >+ if (this.inlineTagStarted) { >+ throw new InvalidInputException(Scanner.UNTERMINATED_STRING); >+ } >+ break; >+ case '*': >+ break; >+ case '\n': >+ case '\r': >+ if (!possibleNextTag) { >+ endOfToken = this.index -1; >+ possibleNextTag = true; >+ } >+ break; >+ case '"': >+ seekAhead = false; >+ break; >+ case '\\': >+ if (this.index >= this.javadocTextEnd) { >+ throw new InvalidInputException(Scanner.UNTERMINATED_STRING); >+ } >+ // We need to call scanner.getNextChar because the scanner.scanEscapeCharacter expects the character >+ // after the '\\' as the currentCharacter. >+ this.scanner.currentPosition = this.index; >+ this.scanner.getNextChar(); >+ this.scanner.scanEscapeCharacter(); >+ this.index = this.scanner.currentPosition; >+ break; >+ default: >+ if (!ScannerHelper.isWhitespace(currentChar)) { >+ possibleNextTag = false; >+ } >+ break; >+ } >+ } >+ } catch (InvalidInputException invalidInput) { >+ if (invalidInput.getMessage().equals(Scanner.INVALID_ESCAPE)) { >+ // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed >+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) { >+ if (this.index + lookAhead == this.javadocTextEnd) >+ break; >+ if (this.source[this.index + lookAhead] == '\n') >+ break; >+ if (this.source[this.index + lookAhead] == '\"') { >+ this.index += lookAhead + 1; >+ break; >+ } >+ } >+ } >+ this.scanner.currentPosition = this.index; >+ this.index = startPosition; >+ throw invalidInput; >+ } >+ this.scanner.resetTo(this.index, this.javadocEnd); >+ return TerminalTokens.TokenNameStringLiteral; >+} >+ > /* > * Read token only if previous was consumed > */ > protected int readToken() throws InvalidInputException { > if (this.currentTokenType < 0) { > this.tokenPreviousPosition = this.scanner.currentPosition; >+ if (this.tagValue == TAG_LINK_VALUE || this.tagValue == TAG_SEE_VALUE) { >+ int oldIndex = this.index; >+ char charAhead; >+ do{ >+ charAhead = readChar(); >+ if (charAhead == '"') { >+ this.scanner.resetTo(this.index-1, this.javadocEnd); >+ return scanJavadocString(); >+ } >+ } >+ while( charAhead == ' ' || charAhead == '\t'); // The other whitespace characters are now allowed? >+ this.index = oldIndex; >+ } > this.currentTokenType = this.scanner.getNextToken(); > if (this.scanner.currentPosition > (this.lineEnd+1)) { // be sure to be on next line (lineEnd is still on the same line) > this.lineStarted = false;
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 200207
:
101724
|
129193
| 130273