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 99343 Details for
Bug 231053
[formatter] Comment formatter fails to format long strings in @see references
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New proposed patch
v01.txt (text/plain), 13.13 KB, created by
Frederic Fusier
on 2008-05-08 14:10:26 EDT
(
hide
)
Description:
New proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-05-08 14:10:26 EDT
Size:
13.13 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java,v >retrieving revision 1.10 >diff -u -r1.10 FormatterCommentParser.java >--- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 6 May 2008 08:47:45 -0000 1.10 >+++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 8 May 2008 18:07:37 -0000 >@@ -582,6 +582,37 @@ > } > } > >+/* (non-Javadoc) >+ * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#verifyEndLine(int) >+ */ >+protected boolean verifyEndLine(int textPosition) { >+ int endPosition = this.scanner.currentPosition; >+ this.scanner.resetTo(textPosition, this.javadocEnd); >+ boolean tokenizeWhiteSpace = this.scanner.tokenizeWhiteSpace; >+ this.scanner.tokenizeWhiteSpace = true; >+ try { >+ int token = this.scanner.getNextToken(); >+ int startPosition = textPosition; >+ if (token == TerminalTokens.TokenNameWHITESPACE) { >+ while (this.scanner.currentCharacter == '*' || ScannerHelper.isWhitespace(this.scanner.currentCharacter)) { >+ token = this.scanner.getNextToken(); >+ } >+ startPosition = this.scanner.currentPosition; >+ } >+ createTag(); >+ pushText(startPosition, endPosition); >+ } >+ catch (InvalidInputException iie) { >+ // skip >+ } >+ finally { >+ this.scanner.tokenizeWhiteSpace = tokenizeWhiteSpace; >+ } >+ this.scanner.resetTo(endPosition, this.javadocEnd); >+ this.index = endPosition; >+ return true; >+} >+ > protected boolean verifySpaceOrEndComment() { > // Don't care if there's no spaces after a reference... > return true; >Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v >retrieving revision 1.134 >diff -u -r1.134 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 6 May 2008 17:42:28 -0000 1.134 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 8 May 2008 18:07:38 -0000 >@@ -2899,8 +2899,9 @@ > if (newLines == 0) { > newLines = printJavadocBlockNodesNewLines(block, node, previousEnd); > } >- if (newLines > 0 || (idx > 1 && (previousEnd+1) <= (nextStart-1))) { >- printJavadocGapLines(previousEnd+1, node.sourceStart-1, newLines, clearBlankLines, false, null); >+ int nodeStart = node.sourceStart; >+ if (newLines > 0 || (idx > 1 && nodeStart > (previousEnd+1))) { >+ printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null); > } > if (newLines > 0) textOnNewLine = true; > buffer = new StringBuffer(); >@@ -2937,6 +2938,7 @@ > } > boolean firstText = idx==1; > if (idx > 1 && (previousEnd+1) > (nextStart-1)) { >+ // There's no space between text and html tag or inline block => do not insert space a the beginning of the text > firstText = true; > } > printJavadocTextLine(buffer, nextStart, end, block, firstText, needIndentation, idx==0/* opening html tag?*/ || text.htmlIndexes[idx-1] != -1); >@@ -3015,7 +3017,9 @@ > if (!needIndentation && !isHtmlBreakTag && text.htmlIndexes != null && text.isTextAfterHtmlSeparatorTag(max)) { > needIndentation = true; > } >- printJavadocTextLine(buffer, nextStart, text.sourceEnd, block, max<=0 /*not the first text*/, needIndentation, closingTag/* closing html tag*/); >+ boolean firstText = max <= 0 // single tag (e.g. <br>) >+ || (previousEnd+1) > (nextStart-1); // There's no space between text and html tag or inline block => do not insert space a the beginning of the text >+ printJavadocTextLine(buffer, nextStart, text.sourceEnd, block, firstText, needIndentation, closingTag/* closing html tag*/); > if (textStart < text.sourceEnd) { > addReplaceEdit(textStart, text.sourceEnd, buffer.toString()); > } >@@ -3193,6 +3197,8 @@ > continue; > } > int tokensBufferLength = tokensBuffer.length(); >+ int tokenStart = this.scanner.getCurrentTokenStartPosition(); >+ boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE || (tokenStart == textStart && this.column > firstColumn && !(firstText || isHtmlTag)); > switch (token) { > case TerminalTokens.TokenNameWHITESPACE: > previousToken = token; >@@ -3203,13 +3209,6 @@ > } > textOnNewLine = false; > continue; >- case TerminalTokens.TokenNameStringLiteral: >- if (this.scanner.currentPosition > this.scanner.eofPosition) { >- this.scanner.resetTo(this.scanner.startPosition, textEnd); >- this.scanner.getNextChar(); >- token = 1; >- } >- break; > case TerminalTokens.TokenNameCharacterLiteral: > if (this.scanner.currentPosition > this.scanner.eofPosition) { > this.scanner.resetTo(this.scanner.startPosition, textEnd); >@@ -3218,9 +3217,7 @@ > } > break; > } >- int tokenStart = this.scanner.getCurrentTokenStartPosition(); > int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart; >- boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE || (tokenStart == textStart && this.column > firstColumn && !(firstText || isHtmlTag)); > int lastColumn = this.column + tokensBufferLength + tokenLength; > if (insertSpace) lastColumn++; > if (headerLine) { >@@ -3233,7 +3230,7 @@ > } > if (lastColumn > maxColumn && token != TerminalTokens.TokenNameAT && (tokensBufferLength == 0 || tokensBuffer.charAt(tokensBufferLength-1) != '@')) { > // not enough space on the line >- if (!isHtmlTag && (firstColumn+tokensBufferLength+tokenLength) >= maxColumn) { >+ if (!isHtmlTag && tokensBufferLength > 0 && (firstColumn+tokensBufferLength+tokenLength) >= maxColumn) { > // there won't be enough room even if we break the line before the buffered tokens > // So add the buffered tokens now > buffer.append(tokensBuffer); >#P org.eclipse.jdt.core.tests.model >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java,v >retrieving revision 1.1 >diff -u -r1.1 X29.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java 6 May 2008 08:47:48 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java 8 May 2008 18:07:40 -0000 >@@ -5,14 +5,14 @@ > /** > * @param <code>text</code>, the string to match > * @param <code>start</code>, the starting index in the text for search, >- * inclusive >+ * inclusive > * @param <code>end</code>, the stopping point of search, exclusive > * @param code > * >p</code>, a string that has no wildcard > * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> >- * is case sensitive >+ * is case sensitive > * @return the starting index in the text of the pattern , or -1 if not >- * found >+ * found > */ > void foo() { > } >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java,v >retrieving revision 1.14 >diff -u -r1.14 FormatterCommentsTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java 6 May 2008 19:34:27 -0000 1.14 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java 8 May 2008 18:07:40 -0000 >@@ -988,12 +988,18 @@ > public void testWkspEclipse28d() throws JavaModelException { > formatUnit("wksp.eclipse", "X28d.java"); > } >-public void _testWkspEclipse29() throws JavaModelException { >+public void testWkspEclipse29() throws JavaModelException { > formatUnit("wksp.eclipse", "X29.java"); > } >-public void _testWkspEclipse30() throws JavaModelException { >+public void testWkspEclipse30() throws JavaModelException { > formatUnit("wksp.eclipse", "X30.java"); > } >+public void testWkspEclipse31() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X31.java"); >+} >+public void testWkspEclipse32() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X32.java"); >+} > // Ganymede > // TODO pass this test > public void _testWkspGanymede01() throws JavaModelException { >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java,v >retrieving revision 1.1 >diff -u -r1.1 X29.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java 6 May 2008 08:47:48 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java 8 May 2008 18:07:40 -0000 >@@ -5,14 +5,14 @@ > /** > * @param <code>text</code>, the string to match > * @param <code>start</code>, the starting index in the text for search, >- * inclusive >+ * inclusive > * @param <code>end</code>, the stopping point of search, exclusive > * @param code > * >p</code>, a string that has no wildcard > * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> >- * is case sensitive >+ * is case sensitive > * @return the starting index in the text of the pattern , or -1 if not >- * found >+ * found > */ > void foo() { > } >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X32.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X32.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X32.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X32.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+package test.wksp.eclipse; >+ >+public class X32 { >+ >+ /** >+ * This method calls >+ * <tt>realHandler.setURL(URL,String,String,int,String,String,String,String)</tt> >+ * . >+ * >+ * @see >+ * "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)" >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X32.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X32.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X32.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X32.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.wksp.eclipse; >+ >+public class X32 { >+ >+ /** >+ * This method calls <tt>realHandler.setURL(URL,String,String,int,String,String,String,String)</tt>. >+ * >+ * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)" >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X31.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X31.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X31.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X31.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+package test.wksp.eclipse; >+ >+public class X31 { >+ >+ /** >+ * <p> >+ * _li_A {@link BundleEvent}of type {@link BundleEvent#STARTED}is broadcast. >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+package test.wksp.eclipse; >+ >+public class X32 { >+ >+ /** >+ * This method calls >+ * <tt>realHandler.setURL(URL,String,String,int,String,String,String,String)</tt> >+ * . >+ * >+ * @see >+ * "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)" >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X31.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X31.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X31.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X31.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.wksp.eclipse; >+ >+public class X31 { >+ >+ /** >+ * <p> >+ * _li_A {@link BundleEvent}of type {@link BundleEvent#STARTED}is >+ * broadcast. >+ */ >+ void foo() { >+ } >+}
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 231053
:
99231
|
99259
| 99343