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 139303 Details for
Bug 279359
[formatter] Formatter with 'never join lines' produces extra level of indent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 3.09 KB, created by
Frederic Fusier
on 2009-06-16 11:13:30 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-06-16 11:13:30 EDT
Size:
3.09 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.162 >diff -u -r1.162 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 10 Mar 2009 08:33:45 -0000 1.162 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 11 Jun 2009 09:40:11 -0000 >@@ -935,7 +935,7 @@ > // preserve line breaks in wrapping if specified > // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=198074 > if (this.currentAlignment != null && this.memberAlignment != null && !this.formatter.preferences.join_wrapped_lines) { >- if (this.memberAlignment.depth() <= this.currentAlignment.depth()) { >+ if (this.scanner.currentCharacter != '}' && this.memberAlignment.depth() <= this.currentAlignment.depth()) { > int savedIndentation = this.indentationLevel; > StringBuffer buffer = new StringBuffer(getNewLine()); > this.indentationLevel = this.currentAlignment.breakIndentationLevel; >#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.38 >diff -u -r1.38 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 10 Mar 2009 08:33:47 -0000 1.38 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 11 Jun 2009 09:40:12 -0000 >@@ -4495,4 +4495,45 @@ > ); > } > >+/** >+ * @bug 279359: [formatter] Formatter with 'never join lines' produces extra level of indent >+ * @test Ensure that no extra indentation is produced at the end of a body when >+ * 'never join lines' preference is set. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=279359" >+ */ >+public void testBug279359() throws JavaModelException { >+ this.formatterPrefs.join_wrapped_lines = false; >+ String source = >+ "public class Formatter {\n" + >+ "\n" + >+ " public static void main(String[] args) {\n" + >+ "\n" + >+ " Executors.newCachedThreadPool().execute(new Runnable() {\n" + >+ "\n" + >+ " public void run() {\n" + >+ " throw new UnsupportedOperationException(\"stub\");\n" + >+ " }\n" + >+ "\n" + >+ " });\n" + >+ "\n" + >+ " }\n" + >+ "}\n"; >+ formatSource(source, >+ "public class Formatter {\n" + >+ "\n" + >+ " public static void main(String[] args) {\n" + >+ "\n" + >+ " Executors.newCachedThreadPool().execute(new Runnable() {\n" + >+ "\n" + >+ " public void run() {\n" + >+ " throw new UnsupportedOperationException(\"stub\");\n" + >+ " }\n" + >+ "\n" + >+ " });\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 279359
:
138488
|
138489
| 139303