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

Bug 109381

Summary: [formatter] bug with wrapping assigments
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Mateusz Matela <mateusz.matela>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P5 CC: Andrzej.Miazga, john.ferg, mateusz.matela
Version: 3.2   
Target Milestone: 4.5 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard: To be verified for 4.6 M7

Description Martin Aeschlimann CLA 2005-09-13 07:44:39 EDT
20050906

For the following code, use a smaller line width and use 'wrap only when
necessary'. It seems to me that this is more than necessary....

String s, t, u, v;
s = t = u = v = "TextTextText";

->

String s, t, u, v;
s =
		t =
				u =
						v =
								"TextTextText";
Comment 1 Olivier Thomann CLA 2005-09-15 14:56:24 EDT
This is due to the fact that the assignment aligment was set to use the outer
most alignement to split.
So s = t = u = v = "TextTextText";
would split first:
s and then t and then u and finally v.
Because splitting ends up being wider than no split we end up with this weird
wrapping.
I can either fix it using the inner most alignment first or disable the wrapping
if it doesn't help.
I will investigate the latter.
Comment 2 Jason Bennett CLA 2006-02-20 17:26:36 EST
I believe I have a similar instance of this bug (regardless, it's related).

The following code goes from column 9 to column 97:
psp = this.poolSetPosDao.findByPoolSetSampleNumber( ps, tecanRecord.getSampleNumber() );

If it were to wrap after the "ps," parameter, it would be at column 64 and fit within 80 just fine. Instead, Eclipse first wraps at the assignment, which does not get the (now second) line under 80 characters, and then it wraps the parameters. This produces an extra (useless) line of code.
Comment 3 Frederic Fusier CLA 2008-08-18 08:07:00 EDT
Ownership has changed for the formatter, but 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 4 Mateusz Matela CLA 2016-03-26 16:45:18 EDT
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 5 Mateusz Matela CLA 2020-01-11 16:49:44 EST
*** Bug 250636 has been marked as a duplicate of this bug. ***