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 152292 Details for
Bug 295238
[formatter] The comment formatter add an unexpected new line in block comment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 3.58 KB, created by
Frederic Fusier
on 2009-11-16 07:51:40 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-11-16 07:51:40 EST
Size:
3.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.181 >diff -u -r1.181 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 15 Nov 2009 19:35:07 -0000 1.181 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 16 Nov 2009 12:49:28 -0000 >@@ -1561,6 +1561,7 @@ > boolean hasMultiLines = false; > boolean hasTokens = false; > boolean bufferHasTokens = false; >+ boolean bufferHasNewLine = false; > boolean lineHasTokens = false; > int hasTextOnFirstLine = 0; > boolean firstWord = true; >@@ -1595,6 +1596,7 @@ > this.column += tokensBuffer.length(); > tokensBuffer.setLength(0); > bufferHasTokens = true; >+ bufferHasNewLine = false; > } > if (previousToken == -1) { > // do not remember the first whitespace >@@ -1710,6 +1712,7 @@ > this.column += BLOCK_LINE_PREFIX_LENGTH; > firstWord = true; > multiLines = true; >+ bufferHasNewLine = true; > } > insertSpace = insertSpace && linesGap == 0; > } >@@ -1745,7 +1748,7 @@ > this.column += tokensString.length(); > tokensBuffer.setLength(0); > } >- if (bufferHasTokens) { >+ if (bufferHasTokens && !bufferHasNewLine) { > buffer.append(this.lineSeparator); > this.column = 1; > printIndentationIfNecessary(buffer); >@@ -1759,6 +1762,7 @@ > } > buffer.append(this.scanner.source, tokenStart, tokenLength); > bufferHasTokens = true; >+ bufferHasNewLine = false; > this.column += tokenLength; > multiLines = true; > hasTextOnFirstLine = -1; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java,v >retrieving revision 1.9 >diff -u -r1.9 FormatterBugsTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 15 Nov 2009 19:35:09 -0000 1.9 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 16 Nov 2009 12:49:29 -0000 >@@ -1976,4 +1976,46 @@ > "}\n" > ); > } >+ >+/** >+ * @bug 295238: [formatter] The comment formatter add an unexpected new line in block comment >+ * @test Verify that formatting a block comment with a tag does not add an unexpected new line >+ * when the 'Never join lines' option is set >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295238" >+ */ >+public void testBug295238() { >+ String source = >+ "package wksp1;\n" + >+ "\n" + >+ "public interface X03 {\n" + >+ " \n" + >+ " class Inner {\n" + >+ " \n" + >+ " /* (non-Javadoc)\n" + >+ " * @see org.eclipse.jface.text.TextViewer#customizeDocumentCommand(org.eclipse.jface.text.DocumentCommand)\n" + >+ " */\n" + >+ " protected void foo() {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ formatSource(source, >+ "package wksp1;\n" + >+ "\n" + >+ "public interface X03 {\n" + >+ "\n" + >+ " class Inner {\n" + >+ "\n" + >+ " /*\n" + >+ " * (non-Javadoc)\n" + >+ " * \n" + >+ " * @see\n" + >+ " * org.eclipse.jface.text.TextViewer#customizeDocumentCommand(org.eclipse\n" + >+ " * .jface.text.DocumentCommand)\n" + >+ " */\n" + >+ " protected void foo() {\n" + >+ " }\n" + >+ " }\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 295238
:
152291
|
152292
|
152322