Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350895

Summary: [1.7][formatter] New option to wrap before/after '|' in multi-catch
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: deepakazad, markus.kell.r, Olivier_Thomann
Version: 3.7Flags: Olivier_Thomann: review+
Target Milestone: 3.7.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 351081    
Attachments:
Description Flags
proposed fix v1.0 + regression tests none

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.