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 147524 Details for
Bug 287833
[formatter] Formatter removes the first character after the * in the <pre> tag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
Patch2 (text/plain), 6.14 KB, created by
Satyam Kandula
on 2009-09-18 02:45:26 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Satyam Kandula
Created:
2009-09-18 02:45:26 EDT
Size:
6.14 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.173 >diff -u -r1.173 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 25 Aug 2009 07:47:23 -0000 1.173 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 18 Sep 2009 06:40:29 -0000 >@@ -1897,9 +1897,27 @@ > CommentFormatterUtil.log(e); > return; > } >- int prefixOffset= inputBuffer.indexOf(contentPrefix, lineOffset); >- if (prefixOffset >= 0 && inputBuffer.substring(lineOffset, prefixOffset).trim().length() == 0) >- inputBuffer.delete(lineOffset, prefixOffset + 1 + 1); >+ int prefixOffset = inputBuffer.indexOf(contentPrefix, lineOffset); >+ if (prefixOffset >= 0 && inputBuffer.substring(lineOffset, prefixOffset).trim().length() == 0) { >+ int offsetEnd = prefixOffset + 1; >+ char ch = inputBuffer.charAt(offsetEnd); >+ switch (ch) { >+ case '\n': >+ case '\r': >+ break; >+ case ' ': >+ case '\t': >+ case '\u000c' : /* FORM FEED */ >+ offsetEnd++; >+ break; >+ default: >+ if (ScannerHelper.isWhitespace(ch)) { >+ offsetEnd++; >+ } >+ break; >+ } >+ inputBuffer.delete(lineOffset, offsetEnd); >+ } > } > > // 2 - convert HTML to Java (@see JavaDocRegion#convertHtml2Java) >@@ -3335,18 +3353,24 @@ > // Count the lines until the exact start position of the code > this.scanner.resetTo(end+1, nextStart-1); > int newLines = 0; >+ int realEnd = nextStart; >+ boolean spaceFound = true; > try { > int token = this.scanner.getNextToken(); > loop: while (true) { > switch (token) { > case TerminalTokens.TokenNameWHITESPACE: > if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) < 0) { >+ if (realEnd != nextStart) >+ realEnd++; >+ spaceFound = true; > break loop; > } > newLines++; > break; > case TerminalTokens.TokenNameMULTIPLY: >- nextStart = this.scanner.currentPosition + 1; >+ realEnd = this.scanner.currentPosition; >+ spaceFound = false; > break; > default: > break loop; >@@ -3358,7 +3382,11 @@ > // skip > } > if (newLines == 0) newLines=1; >- printJavadocGapLines(end+1, nextStart-1, newLines, false/* clear first blank lines inside <pre> tag as done by old formatter */, false, null); >+ printJavadocGapLines(end+1, realEnd-1, newLines, false/* clear first blank lines inside <pre> tag as done by old formatter */, false, null); >+ if (realEnd < nextStart) >+ nextStart = realEnd; >+ if (spaceFound == false) >+ addInsertEdit(realEnd, " "); //$NON-NLS-1$ > printCodeSnippet(nextStart, codeEnd); > nextStart = (int) text.separators[max]; > printJavadocGapLines(codeEnd+1, nextStart-1, 1, false/* clear blank lines inside <pre> tag as done by old formatter */, false, null); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v >retrieving revision 1.46 >diff -u -r1.46 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 22 Jun 2009 11:10:32 -0000 1.46 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 18 Sep 2009 06:40:34 -0000 >@@ -26,7 +26,9 @@ > public static Test suite() { > return buildModelTestSuite(FormatterCommentsBugsTest.class); > } >- >+static { >+ //TESTS_NAMES = new String[] { "testBug287833b" } ; >+ } > public FormatterCommentsBugsTest(String name) { > super(name); > } >@@ -4848,4 +4850,100 @@ > ); > } > >+/** >+ * [formatter] Formatter removes the first character after the * in the <pre> tag >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833 >+ */ >+public void testBug287833a() { >+ String source = >+ "public class test1 {\n" + >+ "/**\n"+ >+ "* <pre>\n"+ >+ "*void foo() {\n"+ >+ "*}\n"+ >+ "* </pre>\n"+ >+ "*/\n"+ >+ "void foo() {\n"+ >+ "}\n"+ >+ "}\n"; >+ >+ formatSource(source, >+ "public class test1 {\n"+ >+ " /**\n"+ >+ " * <pre>\n"+ >+ " * void foo() {\n"+ >+ " * }\n"+ >+ " * </pre>\n"+ >+ " */\n"+ >+ " void foo() {\n"+ >+ " }\n" + >+ "}\n"); >+} >+ >+/** >+ * [formatter] Formatter removes the first character after the * in the <pre> tag >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833 >+ */ >+public void testBug287833b() { >+ String source = >+ "public class test1 {\n" + >+ "/**\n"+ >+ "* <pre>\n"+ >+ "* void foo() {\n"+ >+ "*\r\n"+ >+ "* }\n"+ >+ "* </pre>\n"+ >+ "*/ \n"+ >+ "void foo() {\n"+ >+ "}\n"+ >+ "}\n"; >+ >+ formatSource(source, >+ "public class test1 {\n"+ >+ " /**\n"+ >+ " * <pre>\n"+ >+ " * void foo() {\n"+ >+ " * \r\n" + >+ " * }\n"+ >+ " * </pre>\n"+ >+ " */\n"+ >+ " void foo() {\n"+ >+ " }\n" + >+ "}\n"); >+} >+ >+/** >+ * [formatter] Formatter removes the first character after the * in the <pre> tag >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833 >+ */ >+public void testBug287833c() { >+ String source = >+ "public class test1 {\n" + >+ "/**\n"+ >+ "* <pre>\n"+ >+ "* void foo() {\n"+ >+ "*\n"+ >+ "* }\n"+ >+ "* </pre>\n"+ >+ "*/ \n"+ >+ "void foo() {\n"+ >+ "}\n"+ >+ "}\n"; >+ >+ formatSource(source, >+ "public class test1 {\n"+ >+ " /**\n"+ >+ " * <pre>\n"+ >+ " * void foo() {\n"+ >+ " * \n" + >+ " * }\n"+ >+ " * </pre>\n"+ >+ " */\n"+ >+ " void foo() {\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 287833
:
146280
|
147524
|
147536
|
147885