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 101272 Details for
Bug 232788
[formatter] Formatter misaligns stars when formatting block comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch updated with last HEAD contents
v03b.txt (text/plain), 16.22 KB, created by
Frederic Fusier
on 2008-05-21 10:24:37 EDT
(
hide
)
Description:
Proposed patch updated with last HEAD contents
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-05-21 10:24:37 EDT
Size:
16.22 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.138 >diff -u -r1.138 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 21 May 2008 14:17:47 -0000 1.138 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 21 May 2008 14:23:56 -0000 >@@ -1143,9 +1143,44 @@ > int maxColumn = this.formatter.preferences.comment_line_length + 1; > int indentLevel = this.indentationLevel; > int indentations = this.numberOfIndentations; >- this.indentationLevel = (this.column / this.tabLength) * this.tabLength; >- this.column = this.indentationLevel + 1; >- this.numberOfIndentations = this.indentationLevel / this.indentationSize; >+ switch (this.tabChar) { >+ case DefaultCodeFormatterOptions.TAB: >+ switch (this.tabLength) { >+ case 0: >+ this.indentationLevel = 0; >+ this.column = 1; >+ this.numberOfIndentations = 0; >+ break; >+ case 1: >+ this.indentationLevel = this.column - 1; >+ this.numberOfIndentations = this.indentationLevel; >+ break; >+ default: >+ this.indentationLevel = (this.column / this.tabLength) * this.tabLength; >+ this.column = this.indentationLevel + 1; >+ this.numberOfIndentations = this.indentationLevel / this.tabLength; >+ } >+ break; >+ case DefaultCodeFormatterOptions.MIXED: >+ if (this.tabLength == 0) { >+ this.indentationLevel = 0; >+ this.column = 1; >+ this.numberOfIndentations = 0; >+ } else { >+ this.indentationLevel = this.column - 1; >+ this.numberOfIndentations = this.indentationLevel / this.tabLength; >+ } >+ break; >+ case DefaultCodeFormatterOptions.SPACE: >+ if (this.indentationSize == 0) { >+ this.indentationLevel = 0; >+ this.column = 1; >+ this.numberOfIndentations = 0; >+ } else { >+ this.indentationLevel = this.column - 1; >+ } >+ break; >+ } > > // Consume the comment prefix > StringBuffer buffer = new StringBuffer(); >#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.5 >diff -u -r1.5 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 21 May 2008 14:17:44 -0000 1.5 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 21 May 2008 14:23:58 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.formatter.CodeFormatter; >+import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions; > > import junit.framework.Test; > >@@ -188,4 +189,70 @@ > this.preferences.comment_line_length = 40; > formatUnit("bugs.b232466", "X02.java"); > } >+ >+/** >+ * @bug 232788: [formatter] Formatter misaligns stars when formatting block comments >+ * @test Insure that block formatter is correct even with indentation size=1 >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232788" >+ */ >+public void testBug232788_Tabs01() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_size = 1; >+ this.preferences.indentation_size = 1; >+ formatUnit("bugs.b232788", "X01_tabs.java"); >+} >+public void testBug232788_Spaces01() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_char = DefaultCodeFormatterOptions.SPACE; >+ this.preferences.tab_size = 1; >+ this.preferences.indentation_size = 1; >+ formatUnit("bugs.b232788", "X01_spaces.java"); >+} >+public void testBug232788_Mixed01() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_char = DefaultCodeFormatterOptions.MIXED; >+ this.preferences.tab_size = 1; >+ this.preferences.indentation_size = 1; >+ formatUnit("bugs.b232788", "X01_mixed.java"); >+} >+public void testBug232788_Tabs02() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_size = 0; >+ this.preferences.indentation_size = 0; >+ formatUnit("bugs.b232788", "X02_tabs.java"); >+} >+public void testBug232788_Spaces02() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_char = DefaultCodeFormatterOptions.SPACE; >+ this.preferences.tab_size = 0; >+ this.preferences.indentation_size = 0; >+ formatUnit("bugs.b232788", "X02_spaces.java"); >+} >+public void testBug232788_Mixed02() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_char = DefaultCodeFormatterOptions.MIXED; >+ this.preferences.tab_size = 0; >+ this.preferences.indentation_size = 0; >+ formatUnit("bugs.b232788", "X02_mixed.java"); >+} >+public void testBug232788_Tabs03() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_size = 1; >+ this.preferences.indentation_size = 1; >+ formatUnit("bugs.b232788", "X03_tabs.java"); >+} >+public void testBug232788_Spaces03() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_char = DefaultCodeFormatterOptions.SPACE; >+ this.preferences.tab_size = 1; >+ this.preferences.indentation_size = 1; >+ formatUnit("bugs.b232788", "X03_spaces.java"); >+} >+public void testBug232788_Mixed03() throws JavaModelException { >+ this.preferences.comment_line_length = 40; >+ this.preferences.tab_char = DefaultCodeFormatterOptions.MIXED; >+ this.preferences.tab_size = 1; >+ this.preferences.indentation_size = 1; >+ formatUnit("bugs.b232788", "X03_mixed.java"); >+} > } >Index: workspace/FormatterJavadoc/test/bugs/b232788/X01_tabs.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X01_tabs.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X01_tabs.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X01_tabs.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package test.bugs.b232788; >+public class X01_tabs { >+/* >+ * Tabs mode, tab size=1 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X02_mixed.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X02_mixed.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X02_mixed.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X02_mixed.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+package test.bugs.b232788; >+ >+public class X02_mixed { >+/* >+ * Mixed mode, tab size=0, indentation >+ * size=0 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X03_spaces.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X03_spaces.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X03_spaces.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X03_spaces.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.bugs.b232788; >+ >+public class X03_spaces { >+ >+ public void foo(String str) /* >+ * Spaces >+ * mode, >+ * indentation >+ * size=1 >+ */{ >+ } >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X01_mixed.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X01_mixed.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X01_mixed.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X01_mixed.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package test.bugs.b232788; >+public class X01_mixed { >+/* >+ * Mixed mode, tab size=1, indentation size=1 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X03_tabs.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X03_tabs.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X03_tabs.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X03_tabs.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X03_tabs { >+ >+public void foo(String str) /* Tabs mode, tab size=1 */ { >+} >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X03_spaces.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X03_spaces.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X03_spaces.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X03_spaces.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X03_spaces { >+ >+public void foo(String str) /* Spaces mode, indentation size=1 */ { >+} >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X01_mixed.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X01_mixed.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X01_mixed.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X01_mixed.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+package test.bugs.b232788; >+ >+public class X01_mixed { >+ /* >+ * Mixed mode, tab size=1, indentation >+ * size=1 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X01_spaces.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X01_spaces.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X01_spaces.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X01_spaces.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X01_spaces { >+ /* >+ * Spaces mode, indentation size=1 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X02_spaces.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X02_spaces.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X02_spaces.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X02_spaces.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X02_spaces { >+/* >+ * Spaces mode, indentation size=0 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X02_tabs.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X02_tabs.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X02_tabs.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X02_tabs.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X02_tabs { >+/* >+ * Tabs mode, tab size=0 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X01_spaces.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X01_spaces.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X01_spaces.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X01_spaces.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package test.bugs.b232788; >+public class X01_spaces { >+/* >+ * Spaces mode, indentation size=1 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X03_tabs.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X03_tabs.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X03_tabs.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X03_tabs.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.bugs.b232788; >+ >+public class X03_tabs { >+ >+ public void foo(String str) /* >+ * Tabs >+ * mode, >+ * tab >+ * size=1 >+ */{ >+ } >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X02_tabs.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X02_tabs.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X02_tabs.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X02_tabs.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package test.bugs.b232788; >+public class X02_tabs { >+/* >+ * Tabs mode, tab size=0 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X02_mixed.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X02_mixed.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X02_mixed.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X02_mixed.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package test.bugs.b232788; >+public class X02_mixed { >+/* >+ * Mixed mode, tab size=0, indentation size=0 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X01_tabs.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X01_tabs.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X01_tabs.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X01_tabs.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X01_tabs { >+ /* >+ * Tabs mode, tab size=1 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X03_mixed.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X03_mixed.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X03_mixed.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X03_mixed.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test.bugs.b232788; >+ >+public class X03_mixed { >+ >+public void foo(String str) /* Mixed mode, tab size=1, indentation size=1 */ { >+} >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/X02_spaces.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/X02_spaces.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/X02_spaces.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/X02_spaces.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package test.bugs.b232788; >+public class X02_spaces { >+/* >+ * Spaces mode, indentation size=0 >+ */ >+} >Index: workspace/FormatterJavadoc/test/bugs/b232788/out/X03_mixed.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/bugs/b232788/out/X03_mixed.java >diff -N workspace/FormatterJavadoc/test/bugs/b232788/out/X03_mixed.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/bugs/b232788/out/X03_mixed.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.bugs.b232788; >+ >+public class X03_mixed { >+ >+ public void foo(String str) /* >+ * Mixed >+ * mode, >+ * tab >+ * size=1, >+ * indentation >+ * size=1 >+ */{ >+ } >+}
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 232788
:
100913
|
101266
| 101272