Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350895 - [1.7][formatter] New option to wrap before/after '|' in multi-catch
Summary: [1.7][formatter] New option to wrap before/after '|' in multi-catch
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.7.1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 351081
  Show dependency tree
 
Reported: 2011-07-01 01:49 EDT by Ayushman Jain CLA
Modified: 2011-08-05 02:54 EDT (History)
3 users (show)

See Also:
Olivier_Thomann: review+


Attachments
proposed fix v1.0 + regression tests (16.39 KB, patch)
2011-07-04 08:55 EDT, Ayushman Jain CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-07-01 01:49:11 EDT
BETA_JAVA7

For arguments in a mutli-catch statement, we currently always wrap after the '|' operator i.e.

catch ( ExceptionA |
        ExceptionB |
        Exception C) 

It will be good to have an option to allow wrapping before '|' i.e.

catch ( ExceptionA
        | ExceptionB
        | Exception C) 

This is on the lines of a similar "wrap before operator" option for Binary Expression's Line wrapping options.
Comment 1 Markus Keller CLA 2011-07-01 05:52:35 EDT
Good point. Please also change the default to wrap *before* the operator, so as to match http://www.oracle.com/technetwork/java/codeconventions-136091.html#248 .
Comment 2 Ayushman Jain CLA 2011-07-04 08:55:56 EDT
Created attachment 199045 [details]
proposed fix v1.0 + regression tests

Adds the new option 
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants.FORMATTER_WRAP_BEFORE_OR_OPERATOR_MULTICATCH

and set the default to true. So now wrapping is always 'before' the '|' operator. Adjusted tests to reflect this.
Comment 3 Ayushman Jain CLA 2011-07-04 08:56:44 EDT
Olivier, can you please review? Thanks!
Comment 4 Deepak Azad CLA 2011-07-11 05:01:11 EDT
Ping!
Comment 5 Olivier Thomann CLA 2011-07-11 11:47:00 EDT
Patch looks good. Ayushman, please release.
Comment 6 Ayushman Jain CLA 2011-07-11 15:35:07 EDT
Released in BETA_JAVA7 branch
Comment 7 Deepak Azad CLA 2011-07-19 08:09:31 EDT
Verified with v20110714-1300.