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 110305 Details for
Bug 244477
[formatter] Formatter fails on special Java array construct
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_244477.txt (text/plain), 8.92 KB, created by
Olivier Thomann
on 2008-08-18 20:59:36 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2008-08-18 20:59:36 EDT
Size:
8.92 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java,v >retrieving revision 1.233 >diff -u -r1.233 FormatterRegressionTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 1 Jul 2008 15:11:02 -0000 1.233 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 19 Aug 2008 00:58:37 -0000 >@@ -55,8 +55,8 @@ > private long time; > > static { >-// TESTS_NUMBERS = new int[] { 669 }; >-// TESTS_RANGE = new int[] { 658, -1 }; >+// TESTS_NUMBERS = new int[] { 715 }; >+// TESTS_RANGE = new int[] { 715, -1 }; > } > public static Test suite() { > return buildModelTestSuite(FormatterRegressionTests.class); >@@ -10142,4 +10142,40 @@ > DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); > runTest(codeFormatter, "test714", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=244477 >+ public void test715() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.keep_empty_array_initializer_on_one_line = true; >+ preferences.insert_space_before_comma_in_array_initializer = false; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ runTest(codeFormatter, "test715", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=244477 >+ public void test716() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.keep_empty_array_initializer_on_one_line = true; >+ preferences.insert_space_before_comma_in_array_initializer = true; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ runTest(codeFormatter, "test716", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=244477 >+ public void test717() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.keep_empty_array_initializer_on_one_line = false; >+ preferences.insert_space_before_comma_in_array_initializer = false; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ runTest(codeFormatter, "test717", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=244477 >+ public void test718() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.keep_empty_array_initializer_on_one_line = false; >+ preferences.insert_space_before_comma_in_array_initializer = true; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ runTest(codeFormatter, "test718", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ >+ } > } >Index: workspace/Formatter/test718/A_out.java >=================================================================== >RCS file: workspace/Formatter/test718/A_out.java >diff -N workspace/Formatter/test718/A_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test718/A_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+public class X { >+ final String[] empty = new String[] { ,}; >+ >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test717/A_out.java >=================================================================== >RCS file: workspace/Formatter/test717/A_out.java >diff -N workspace/Formatter/test717/A_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test717/A_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+public class X { >+ final String[] empty = new String[] {,}; >+ >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test716/A_out.java >=================================================================== >RCS file: workspace/Formatter/test716/A_out.java >diff -N workspace/Formatter/test716/A_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test716/A_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+public class X { >+ final String[] empty = new String[] { ,}; >+ >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test715/A_out.java >=================================================================== >RCS file: workspace/Formatter/test715/A_out.java >diff -N workspace/Formatter/test715/A_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test715/A_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+public class X { >+ final String[] empty = new String[] {,}; >+ >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test715/A_in.java >=================================================================== >RCS file: workspace/Formatter/test715/A_in.java >diff -N workspace/Formatter/test715/A_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test715/A_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+public class X { final String[] empty = >+ new String[] {,}; >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test716/A_in.java >=================================================================== >RCS file: workspace/Formatter/test716/A_in.java >diff -N workspace/Formatter/test716/A_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test716/A_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+public class X { final String[] empty = >+ new String[] {,}; >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test717/A_in.java >=================================================================== >RCS file: workspace/Formatter/test717/A_in.java >diff -N workspace/Formatter/test717/A_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test717/A_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+public class X { final String[] empty = >+ new String[] {,}; >+ public static void main(String[] args) { >+ } >+ >+} >Index: workspace/Formatter/test718/A_in.java >=================================================================== >RCS file: workspace/Formatter/test718/A_in.java >diff -N workspace/Formatter/test718/A_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test718/A_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+public class X { final String[] empty = >+ new String[] {,}; >+ public static void main(String[] args) { >+ } >+ >+} >#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.209 >diff -u -r1.209 CodeFormatterVisitor.java >--- formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 27 Jun 2008 16:04:08 -0000 1.209 >+++ formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 19 Aug 2008 00:58:41 -0000 >@@ -2598,9 +2598,17 @@ > String array_initializer_brace_position = this.preferences.brace_position_for_array_initializer; > if (keepEmptyArrayInitializerOnTheSameLine) { > this.scribe.printNextToken(TerminalTokens.TokenNameLBRACE, this.preferences.insert_space_before_opening_brace_in_array_initializer); >+ if (isNextToken(TerminalTokens.TokenNameCOMMA)) { >+ this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_array_initializer); >+ this.scribe.printTrailingComment(); >+ } > this.scribe.printNextToken(TerminalTokens.TokenNameRBRACE, this.preferences.insert_space_between_empty_braces_in_array_initializer); > } else { > formatOpeningBrace(array_initializer_brace_position, this.preferences.insert_space_before_opening_brace_in_array_initializer); >+ if (isNextToken(TerminalTokens.TokenNameCOMMA)) { >+ this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_array_initializer); >+ this.scribe.printTrailingComment(); >+ } > this.scribe.printNextToken(TerminalTokens.TokenNameRBRACE, false); > if (array_initializer_brace_position.equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED)) { > this.scribe.unIndent();
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 244477
: 110305