Bug 250753 - [formatter] Insert space between empty braces in array initializers ignored without "Keep empty array initializer on one line"
Summary: [formatter] Insert space between empty braces in array initializers ignored w...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: Other Linux
: P5 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2008-10-14 06:53 EDT by Matt Whitlock CLA
Modified: 2008-10-28 06:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock CLA 2008-10-14 06:53:12 EDT
Build ID: M20080911-1700

Steps To Reproduce:
If "Keep empty array initializer on one line" is checked, then "Insert space" "between empty braces" in "array initializers" works as expected.  However, if "Keep empty array initializer on one line" is not checked, the space is never inserted.  This is true even if "Brace positions" for "Array initializer" is set to "Same line", which grays out the "Keep empty array initializer on one line" check box.  (Toggling the "Keep empty array initializer on one line" check box requires first changing the "Array initializer" setting to "Next line", then toggling the check box, then changing back to "Same line".)


Array initializer: Same line
Keep empty array initializer on one line: no
White Space, Array initializers, between empty braces: yes

Preview:
int[] array0 = new int[] {};
int[] array1 = new int[] { 1, 2, 3 };
int[] array2 = new int[3];


Array initializer: Same line
Keep empty array initializer on one line: yes
White Space, Array initializers, between empty braces: yes

Preview:
int[] array0 = new int[] { };
int[] array1 = new int[] { 1, 2, 3 };
int[] array2 = new int[3];


Expected results:
The first preview should look identical to the second preview, since the "Keep empty array initializer on one line" option should have no bearing if "Array initializer" is set to "Same line".
Comment 1 Frederic Fusier CLA 2008-10-14 07:52:52 EDT
Unfortunately, I surely will not have enough time to fix your bug during the 3.5 development process, hence set its priority to P5.
Please provide a patch if you definitely need the bug to be fixed in this
version and I'll have a look at it...
TIA
Comment 2 Olivier Thomann CLA 2008-10-14 12:26:11 EDT
Fix is trivial.
Released for 3.5M3.
Added regression test org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test719
Comment 3 Frederic Fusier CLA 2008-10-28 06:48:13 EDT
Verified for 3.5M3 using I20081026-2000.