Bug 201602 - Add more options to Options > Formatting > Braces Placement
Add more options to Options > Formatting > Braces Placement
Status: NEW
Product: java
Classification: Unclassified
Component: Source
7.0.1
PC Linux
: P3 with 4 votes (vote)
: TBD
Assigned To: Dusan Balek
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-04 14:33 UTC by Geertjan Wielenga
Modified: 2012-12-11 15:19 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments
screenshot of 7.3 beta anonymous class layout (12.91 KB, image/png)
2012-12-11 15:16 UTC, java_dev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2011-09-04 14:33:47 UTC
Under Options > Formatting > Braces Placement, the only sections are Class Declaration, Method Declaration and Other. What about Array Initializer, Annotations, Try, Catch, Finally, If, Else, etc...? 

I would like to have most of those on a new line, but keep array initializer braces on the same line. 

Or perhaps there should be an option in all cases to respect existing code that has the opening brace on the same line as long as the closing brace is also on that line. 

And I'd like to keep space around the = operator when used for assignment, bbut not when used in annotations.
Comment 1 darkest_fright 2012-05-01 14:44:48 UTC
I find that we need *at least* braces placement for array and anonymous class initializers.  I use the same brace placement for if/for/while/try/catch blocks because semantically, they are more or less the same thing (new scope) but with array and anonymous class initializers the braces mean something different (the interntal definition/state of an instance of an object).
Comment 2 java_dev 2012-12-11 15:16:15 UTC
Created attachment 129212 [details]
screenshot of 7.3 beta anonymous class layout

RFE for anonymous class indentation
Comment 3 java_dev 2012-12-11 15:19:06 UTC
Not sure what happened to my comment that went with that screenshot above. Anyways, what i was adding was an RFE that would permit the anonymous class to be indented such that its defining braces aligned under the "new" keyword. It's pretty self explanatory if you look at the screenshot.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo