Bug 71766 - [format] Formatter fails to wrap lines for assignment statements
Summary: [format] Formatter fails to wrap lines for assignment statements
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 minor with 3 votes (vote)
Target Milestone: 3.2 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 63631 87189 90239 93433 124792 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-11 07:17 EDT by Gopakumar CLA
Modified: 2018-01-20 17:37 EST (History)
7 users (show)

See Also:


Attachments
Proposed fix (11.91 KB, patch)
2005-08-30 16:53 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gopakumar CLA 2004-08-11 07:17:42 EDT
Select 'Java Conventions(built-in)' in code formatter.
Here the max line width is 80.

Try to format the following statement.

public static final AliasLabelType ALLOWANCE_TAB_COMMAND_DELETE = new 
AliasLabelType("ALLOWANCE_TAB_COMMAND_DELETE");

The formatter fails to fit the code in 80 columns. 
This works properly in 2.1.2
Comment 1 Olivier Thomann CLA 2005-06-09 09:59:55 EDT
This is a known problem that will be investigated post 3.1.
Comment 2 Olivier Thomann CLA 2005-08-30 16:53:03 EDT
Created attachment 26654 [details]
Proposed fix

This patch seems to fix this issue. I will do some further testing before
releasing it.
Comment 3 Olivier Thomann CLA 2005-08-31 10:59:40 EDT
Should we use the same option for all assignments (initialization of local
variables and field declarations, assignment, compound assignment)?
I don't think this should apply to assignment inside annotations, because we
might end up with bad line wrapping.
Comment 4 Olivier Thomann CLA 2005-08-31 11:59:29 EDT
*** Bug 87189 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thomann CLA 2005-08-31 12:07:33 EDT
Right now I share the same option. I called it:
FORMATTER_ALIGNMENT_FOR_ASSIGNMENT

This will be available only at the code level for now.
It needs to be added in the code formatter preference page.
See bug 108478.

Fixed and released in HEAD.
Regression tests in
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests.test593/596.
Comment 6 Olivier Thomann CLA 2005-08-31 12:12:10 EDT
*** Bug 93433 has been marked as a duplicate of this bug. ***
Comment 7 David Audel CLA 2005-09-20 12:45:23 EDT
Verified in I20050920-0010 for 3.2M2
Comment 8 Olivier Thomann CLA 2005-10-19 15:13:06 EDT
*** Bug 63631 has been marked as a duplicate of this bug. ***
Comment 9 Olivier Thomann CLA 2006-01-25 09:56:45 EST
*** Bug 124792 has been marked as a duplicate of this bug. ***
Comment 10 Mateusz Matela CLA 2018-01-20 17:37:30 EST
*** Bug 90239 has been marked as a duplicate of this bug. ***