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 165411 Details for
Bug 309706
[formatter] doesn't work when code has three semicolons side by side
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 3.64 KB, created by
Frederic Fusier
on 2010-04-20 07:52:23 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2010-04-20 07:52:23 EDT
Size:
3.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java,v >retrieving revision 1.230 >diff -u -r1.230 CodeFormatterVisitor.java >--- formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 2 Mar 2010 18:28:49 -0000 1.230 >+++ formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 20 Apr 2010 10:22:02 -0000 >@@ -1505,7 +1505,7 @@ > isChunkStart = memberAlignment.checkChunkStart(TYPE, i, this.scribe.scanner.currentPosition); > format((TypeDeclaration)member, null, isChunkStart, i == 0); > } >- if (isNextToken(TerminalTokens.TokenNameSEMICOLON)) { >+ while (isNextToken(TerminalTokens.TokenNameSEMICOLON)) { > this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon); > this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); > } >@@ -2021,7 +2021,7 @@ > isChunkStart = memberAlignment.checkChunkStart(Alignment.CHUNK_TYPE, i, this.scribe.scanner.currentPosition); > format((TypeDeclaration)member, typeDeclaration.scope, isChunkStart, i == 0); > } >- if (isNextToken(TerminalTokens.TokenNameSEMICOLON)) { >+ while (isNextToken(TerminalTokens.TokenNameSEMICOLON)) { > this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon); > this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); > } >#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.25 >diff -u -r1.25 FormatterBugsTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 3 Mar 2010 16:32:13 -0000 1.25 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 20 Apr 2010 10:22:06 -0000 >@@ -5373,4 +5373,59 @@ > ); > } > >+/** >+ * @bug 309706: [formatter] doesn´t work when code has three semicolons side by side >+ * @test Verify that formatter does get puzzled by three consecutive semicolons >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=309706" >+ */ >+public void testBug309706() { >+ String source = >+ "public class Test {\n" + >+ "\n" + >+ " private int id;;;\n" + >+ "\n" + >+ " private void dummy() {\n" + >+ "\n" + >+ " if (true) {\n" + >+ " System.out.println(\"bla\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ formatSource(source, >+ "public class Test {\n" + >+ "\n" + >+ " private int id;;;\n" + >+ "\n" + >+ " private void dummy() {\n" + >+ "\n" + >+ " if (true) {\n" + >+ " System.out.println(\"bla\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ ); >+} >+public void testBug309706b() { >+ String source = >+ " private int id;;;\n" + >+ "\n" + >+ " private void dummy() {\n" + >+ "\n" + >+ " if (true) {\n" + >+ " System.out.println(\"bla\");\n" + >+ " }\n" + >+ " }\n"; >+ formatSource(source, >+ "private int id;;;\n" + >+ "\n" + >+ "private void dummy() {\n" + >+ "\n" + >+ " if (true) {\n" + >+ " System.out.println(\"bla\");\n" + >+ " }\n" + >+ "}", >+ CodeFormatter.K_CLASS_BODY_DECLARATIONS >+ ); >+} >+ > }
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 309706
: 165411