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 129193 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.txt (text/plain), 19.35 KB, created by
Jay Arthanareeswaran
on 2009-03-18 07:12:59 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2009-03-18 07:12:59 EDT
Size:
19.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java,v >retrieving revision 1.196 >diff -u -r1.196 Scanner.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java 7 Mar 2009 00:58:59 -0000 1.196 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java 18 Mar 2009 11:12:00 -0000 >@@ -1364,110 +1364,7 @@ > } > throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); > case '"' : >- try { >- // consume next character >- this.unicodeAsBackSlash = false; >- boolean isUnicode = false; >- if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >- getNextUnicodeChar(); >- isUnicode = true; >- } else { >- if (this.withoutUnicodePtr != 0) { >- unicodeStore(); >- } >- } >- >- while (this.currentCharacter != '"') { >- /**** \r and \n are not valid in string literals ****/ >- if ((this.currentCharacter == '\n') || (this.currentCharacter == '\r')) { >- // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed >- if (isUnicode) { >- int start = this.currentPosition; >- for (int lookAhead = 0; lookAhead < 50; lookAhead++) { >- if (this.currentPosition >= this.eofPosition) { >- this.currentPosition = start; >- break; >- } >- if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) { >- isUnicode = true; >- getNextUnicodeChar(); >- } else { >- isUnicode = false; >- } >- if (!isUnicode && this.currentCharacter == '\n') { >- this.currentPosition--; // set current position on new line character >- break; >- } >- if (this.currentCharacter == '\"') { >- throw new InvalidInputException(INVALID_CHAR_IN_STRING); >- } >- } >- } else { >- this.currentPosition--; // set current position on new line character >- } >- throw new InvalidInputException(INVALID_CHAR_IN_STRING); >- } >- if (this.currentCharacter == '\\') { >- if (this.unicodeAsBackSlash) { >- this.withoutUnicodePtr--; >- // consume next character >- this.unicodeAsBackSlash = false; >- if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) { >- getNextUnicodeChar(); >- isUnicode = true; >- this.withoutUnicodePtr--; >- } else { >- isUnicode = false; >- } >- } else { >- if (this.withoutUnicodePtr == 0) { >- unicodeInitializeBuffer(this.currentPosition - this.startPosition); >- } >- this.withoutUnicodePtr --; >- this.currentCharacter = this.source[this.currentPosition++]; >- } >- // we need to compute the escape character in a separate buffer >- scanEscapeCharacter(); >- if (this.withoutUnicodePtr != 0) { >- unicodeStore(); >- } >- } >- // consume next character >- this.unicodeAsBackSlash = false; >- if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >- getNextUnicodeChar(); >- isUnicode = true; >- } else { >- isUnicode = false; >- if (this.withoutUnicodePtr != 0) { >- unicodeStore(); >- } >- } >- >- } >- } catch (IndexOutOfBoundsException e) { >- this.currentPosition--; >- throw new InvalidInputException(UNTERMINATED_STRING); >- } catch (InvalidInputException e) { >- if (e.getMessage().equals(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.currentPosition + lookAhead == this.eofPosition) >- break; >- if (this.source[this.currentPosition + lookAhead] == '\n') >- break; >- if (this.source[this.currentPosition + lookAhead] == '\"') { >- this.currentPosition += lookAhead + 1; >- break; >- } >- } >- >- } >- throw e; // rethrow >- } >- return TokenNameStringLiteral; >+ return scanStringLiteral(); > case '/' : > if (!this.skipComments) { > int test = getNextChar('/', '*'); >@@ -1717,6 +1614,113 @@ > } > return TokenNameEOF; > } >+ >+protected int scanStringLiteral() throws InvalidInputException { >+ try { >+ // consume next character >+ this.unicodeAsBackSlash = false; >+ boolean isUnicode = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ } else { >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } >+ >+ while (this.currentCharacter != '"') { >+ /**** \r and \n are not valid in string literals ****/ >+ if ((this.currentCharacter == '\n') || (this.currentCharacter == '\r')) { >+ // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed >+ if (isUnicode) { >+ int start = this.currentPosition; >+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) { >+ if (this.currentPosition >= this.eofPosition) { >+ this.currentPosition = start; >+ break; >+ } >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) { >+ isUnicode = true; >+ getNextUnicodeChar(); >+ } else { >+ isUnicode = false; >+ } >+ if (!isUnicode && this.currentCharacter == '\n') { >+ this.currentPosition--; // set current position on new line character >+ break; >+ } >+ if (this.currentCharacter == '\"') { >+ throw new InvalidInputException(INVALID_CHAR_IN_STRING); >+ } >+ } >+ } else { >+ this.currentPosition--; // set current position on new line character >+ } >+ throw new InvalidInputException(INVALID_CHAR_IN_STRING); >+ } >+ if (this.currentCharacter == '\\') { >+ if (this.unicodeAsBackSlash) { >+ this.withoutUnicodePtr--; >+ // consume next character >+ this.unicodeAsBackSlash = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ this.withoutUnicodePtr--; >+ } else { >+ isUnicode = false; >+ } >+ } else { >+ if (this.withoutUnicodePtr == 0) { >+ unicodeInitializeBuffer(this.currentPosition - this.startPosition); >+ } >+ this.withoutUnicodePtr --; >+ this.currentCharacter = this.source[this.currentPosition++]; >+ } >+ // we need to compute the escape character in a separate buffer >+ scanEscapeCharacter(); >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } >+ // consume next character >+ this.unicodeAsBackSlash = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ } else { >+ isUnicode = false; >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } >+ >+ } >+ } catch (IndexOutOfBoundsException e) { >+ this.currentPosition--; >+ throw new InvalidInputException(UNTERMINATED_STRING); >+ } catch (InvalidInputException e) { >+ if (e.getMessage().equals(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.currentPosition + lookAhead == this.eofPosition) >+ break; >+ if (this.source[this.currentPosition + lookAhead] == '\n') >+ break; >+ if (this.source[this.currentPosition + lookAhead] == '\"') { >+ this.currentPosition += lookAhead + 1; >+ break; >+ } >+ } >+ >+ } >+ throw e; // rethrow >+ } >+ return TokenNameStringLiteral; >+} > public void getNextUnicodeChar() > throws InvalidInputException { > //VOID >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.87 >diff -u -r1.87 AbstractCommentParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 9 Jan 2009 15:10:20 -0000 1.87 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 18 Mar 2009 11:11:58 -0000 >@@ -95,7 +95,7 @@ > > protected AbstractCommentParser(Parser sourceParser) { > this.sourceParser = sourceParser; >- this.scanner = new Scanner(false, false, false, ClassFileConstants.JDK1_3, null, null, true/*taskCaseSensitive*/); >+ this.scanner = new CommentScanner(false, false, false, ClassFileConstants.JDK1_3, null, null, true/*taskCaseSensitive*/, this); > this.identifierStack = new char[20][]; > this.identifierPositionStack = new long[20]; > this.identifierLengthStack = new int[10]; >@@ -1152,7 +1152,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++; >Index: compiler/org/eclipse/jdt/internal/compiler/parser/CommentScanner.java >=================================================================== >RCS file: compiler/org/eclipse/jdt/internal/compiler/parser/CommentScanner.java >diff -N compiler/org/eclipse/jdt/internal/compiler/parser/CommentScanner.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/CommentScanner.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,175 @@ >+package org.eclipse.jdt.internal.compiler.parser; >+ >+import org.eclipse.jdt.core.compiler.InvalidInputException; >+ >+public class CommentScanner extends Scanner { >+ >+ protected AbstractCommentParser parser; >+ >+ public CommentScanner( >+ boolean tokenizeComments, >+ boolean tokenizeWhiteSpace, >+ boolean checkNonExternalizedStringLiterals, >+ long sourceLevel, >+ char[][] taskTags, >+ char[][] taskPriorities, >+ boolean isTaskCaseSensitive, >+ AbstractCommentParser parser) { >+ >+ super( >+ tokenizeComments, >+ tokenizeWhiteSpace, >+ checkNonExternalizedStringLiterals, >+ sourceLevel, >+ taskTags, >+ taskPriorities, >+ isTaskCaseSensitive); >+ this.parser = parser; >+ } >+ >+ protected int scanStringLiteral() throws InvalidInputException { >+ try { >+ // consume next character >+ boolean isUnicode = consumeNextCharacter(); >+ boolean possibleNextTag = true; >+ int lastClosingBrace = -1; >+ int endOfToken = this.currentPosition; >+ while (this.currentCharacter != '"') { >+ // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed >+ if (isUnicode) { >+ int start = this.currentPosition; >+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) { >+ if (this.currentPosition >= this.eofPosition) { >+ this.currentPosition = start; >+ break; >+ } >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) { >+ isUnicode = true; >+ getNextUnicodeChar(); >+ } else { >+ isUnicode = false; >+ } >+ if (!isUnicode && this.currentCharacter == '\n') { >+ this.currentPosition--; // set current position on new line character >+ break; >+ } >+ if (this.currentCharacter == '\"') { >+ throw new InvalidInputException(INVALID_CHAR_IN_STRING); >+ } >+ } >+ } >+ else { >+ switch(this.currentCharacter) { >+ case '@': >+ if (possibleNextTag) { >+ if (lastClosingBrace != -1) { >+ this.currentPosition = lastClosingBrace; >+ } >+ else { >+ this.currentPosition = endOfToken; >+ } >+ throw new InvalidInputException(UNTERMINATED_STRING); >+ } >+ break; >+ case '}': >+ lastClosingBrace = this.currentPosition; >+ if (this.parser.inlineTagStarted) { >+ throw new InvalidInputException(UNTERMINATED_STRING); >+ } >+ break; >+ case '*': >+ break; >+ case '\n': >+ case '\r': >+ if (!possibleNextTag) { >+ if (lastClosingBrace != -1) { >+ endOfToken = this.currentPosition -1; >+ } >+ else { >+ endOfToken = this.currentPosition -1; >+ } >+ } >+ possibleNextTag = true; >+ break; >+ case '\\': >+ lastClosingBrace = -1; >+ if (this.unicodeAsBackSlash) { >+ this.withoutUnicodePtr--; >+ // consume next character >+ this.unicodeAsBackSlash = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ this.withoutUnicodePtr--; >+ } else { >+ isUnicode = false; >+ } >+ } else { >+ if (this.withoutUnicodePtr == 0) { >+ unicodeInitializeBuffer(this.currentPosition - this.startPosition); >+ } >+ this.withoutUnicodePtr --; >+ this.currentCharacter = this.source[this.currentPosition++]; >+ } >+ // we need to compute the escape character in a separate buffer >+ scanEscapeCharacter(); >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ break; >+ default: >+ if ( possibleNextTag && this.currentCharacter == '{') { >+ possibleNextTag = true; >+ } >+ else if (!ScannerHelper.isWhitespace(this.currentCharacter)) { >+ lastClosingBrace = -1; >+ possibleNextTag = false; >+ } >+ break; >+ } >+ } >+ >+ // consume next character >+ isUnicode = consumeNextCharacter(); >+ >+ } >+ } catch (IndexOutOfBoundsException e) { >+ this.currentPosition--; >+ throw new InvalidInputException(UNTERMINATED_STRING); >+ } catch (InvalidInputException e) { >+ if (e.getMessage().equals(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.currentPosition + lookAhead == this.eofPosition) >+ break; >+ if (this.source[this.currentPosition + lookAhead] == '\n') >+ break; >+ if (this.source[this.currentPosition + lookAhead] == '\"') { >+ this.currentPosition += lookAhead + 1; >+ break; >+ } >+ } >+ >+ } >+ throw e; // rethrow >+ } >+ return TokenNameStringLiteral; >+ } >+ >+ private boolean consumeNextCharacter() throws InvalidInputException { >+ this.unicodeAsBackSlash = false; >+ boolean isUnicode = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ } else { >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } >+ return isUnicode; >+ >+ >+ } >+} >#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.59 >diff -u -r1.59 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 16 Feb 2009 17:53:47 -0000 1.59 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 18 Mar 2009 11:12:04 -0000 >@@ -7529,7 +7529,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" + >@@ -8321,4 +8321,106 @@ > } > } > >-} >\ No newline at end of file >+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"); >+} >+ >+}
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