Bug 267551 - [formatter] Wrong spacing in default array parameter for annotation type
Summary: [formatter] Wrong spacing in default array parameter for annotation type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-08 13:00 EDT by Tamas Mezei CLA
Modified: 2009-08-04 05:47 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (2.84 KB, patch)
2009-06-19 12:16 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tamas Mezei CLA 2009-03-08 13:00:36 EDT
Build ID: M20090211-1700

Steps To Reproduce:
We'd like to create some formatting rules where the following lines are valid and will remain intact after formatting:

@Target({ ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Foo { }

and 

int[] ints = new int[] { 1, 2, 3 };

The problem is that when I set Eclipse to add a space after the first and before the last curly bracket AND a space before the array initialization, it adds a space for the default annotation parameter initialization, so it becomes

@Retention( { ElementType.ANNOTATION_TYPE })

which is unsymmetrical and a bit ugly.

If it's possible to do this formatting in 3.4.2, please forgive me.

More information:
Comment 1 Frederic Fusier CLA 2009-06-19 12:16:36 EDT
Created attachment 139650 [details]
Proposed patch

Disable the formatter preference inserting a space before the array initializer while traversing an annotation...
Comment 2 Frederic Fusier CLA 2009-06-22 07:09:19 EDT
Released for 3.6M1
Comment 3 Ayushman Jain CLA 2009-08-04 05:38:27 EDT
Verified for 3.6M1 using build I20090802-2000