Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 110569 - [formatter] Code Formatting: Line Wrapping. Maximum line width problem with method declarations.
Summary: [formatter] Code Formatting: Line Wrapping. Maximum line width problem with m...
Status: CLOSED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P5 normal with 8 votes (vote)
Target Milestone: 4.5   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 135519 299473 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-26 05:03 EDT by Geoff Gibbs CLA
Modified: 2015-11-30 18:05 EST (History)
10 users (show)

See Also:


Attachments
Java source affected by this bug (3.10 KB, text/plain)
2006-09-20 15:33 EDT, Tim Moore CLA
no flags Details
Formatter settings for the previous attachment (26.58 KB, text/xml)
2006-09-20 16:36 EDT, Tim Moore CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Geoff Gibbs CLA 2005-09-26 05:03:41 EDT
In the java code formatter, when specifying line wrapping options for Method
declarations, it seems that the final bracket is being ignored.

To test:
In the line wrapping tab of the code formatting "Edit Profile" dialog, set the
line width for preview window to 69.
Select "Method Declarations: Parameters"

The final bracket from the method declaration is beyond the 69 character limit.
Comment 1 Olivier Thomann CLA 2005-09-30 09:08:02 EDT
Right now the final bracket is not part of the wrapping mecanism.
Comment 2 Olivier Thomann CLA 2006-04-20 09:56:38 EDT
*** Bug 135519 has been marked as a duplicate of this bug. ***
Comment 3 Jason Yip CLA 2006-08-23 00:32:46 EDT
By "bracket", I'm assuming you mean brace?  At first I thought this was an off-by-one error since you can work around it by reducing your allowed line length by one.  This one is high on the annoying list for me.
Comment 4 Tim Moore CLA 2006-09-20 15:24:04 EDT
See also Bug 69585
Comment 5 Tim Moore CLA 2006-09-20 15:33:47 EDT
Created attachment 50589 [details]
Java source affected by this bug

Here's an example of Java source affected by this bug.  Note that on lines 49 & 50, the method parameter itself exceeds the maximum line length and is correctly wrapped, but line 58 is not wrapped despite exceeding the maximum line length with the space and { at the end of the line.  Note that in this situation, I wouldn't want the { to be wrapped by itself, but rather I would want it to break at column 41 and wrap the method parameter onto the next line as with lines 49 & 50.
Comment 6 Tim Moore CLA 2006-09-20 16:36:42 EDT
Created attachment 50594 [details]
Formatter settings for the previous attachment
Comment 7 Jamie Meyers CLA 2007-05-30 19:16:08 EDT
I don't know if this bug was ever solved, but it has resurfaced in 3.2.2 [build M20070212-1330].

Here is my example. I have the line wrap set at 115. And here is the output:

<TAB>public ItemModel(String name, String description, double length, double width, double height, double strength) {

However, the output should be:
<TAB>public ItemModel(String name, String description, double length, double width, double height, 
<TAB><TAB>double strength) {

Comment 8 Frederic Fusier CLA 2008-08-19 10:30:08 EDT
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 9 Krzysztof Daniel CLA 2008-08-25 04:07:01 EDT
There is a workaround:
 go to the 'Braces' tab while editing formatter
 select 'Next line on wrap' in the 'Method declaration'

Then the opening brace will be moved to the next line if necessary.
Comment 10 Frederic Fusier CLA 2010-01-13 06:23:31 EST
*** Bug 299473 has been marked as a duplicate of this bug. ***
Comment 11 Stepan Kolesnik CLA 2014-08-19 12:53:47 EDT
Still present in 4.4
Comment 12 Mateusz Matela CLA 2015-11-30 18:05:59 EST
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***