Bug 310642 - [formatter] problem in line wrapping in nested method calls
Summary: [formatter] problem in line wrapping in nested method calls
Status: VERIFIED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: 4.13 M1   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard: To be verified for 4.13 M1
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-27 10:32 EDT by Ayushman Jain CLA
Modified: 2019-07-10 00:52 EDT (History)
10 users (show)

See Also:


Attachments
testcase (415 bytes, text/plain)
2010-04-27 10:32 EDT, Ayushman Jain CLA
no flags Details
Zipped samples (9.60 KB, application/zip)
2010-05-25 10:24 EDT, Laurent Goubet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2010-04-27 10:32:02 EDT
Build Identifier: I20100426-0852

This is FUP of bug 59891. The fix for bug 59891 doesnt cover the corner case given in the attached file. Hence opening a new bug according to bug 59891 comment 41.

the expected output should be

 abc.foo(abc.getString("sadldwdqd", "adadw", "qwdwwfr", "WFs"), 
         abc.getString("sadlaawddwdqd", "adawqrdw", "qwdwqrfqwfr",
            "dwqFRFRQEWFs"));

but isn't. Indeed, when the string arguments are small in length, we get the correct output.



Reproducible: Always

Steps to Reproduce:
1.Use the attached testcase and set the formatter profile to "Java conventions"
2.Press CTRL+SHIFT+F
3.See that the formatted code differs from the expected output given above
Comment 1 Ayushman Jain CLA 2010-04-27 10:32:44 EDT
Created attachment 166204 [details]
testcase
Comment 2 Frederic Fusier CLA 2010-04-29 10:09:29 EDT
As I said in bug 59891 comment 41:
> Yes, this is a corner case, where the second argument is over the max line,
> hence the formatter enters into the "panic" mode and breaks the line as it did
> before (i.e. the sooner as it can).
Comment 3 Laurent Goubet CLA 2010-05-25 10:24:01 EDT
Created attachment 169835 [details]
Zipped samples

This bug seems generic enough for me to add the issues I outlined in bug 59891 , keeping only the obvious issues and not the things that account to taste. If you'd rather I open a separate bug for each, please let me know.

I didn't really know how to provide the samples, went with a sample project. The attached is a zipped project containing three files : AcceleoFormatter.xml contains my exported formatter configuration, NewFormatterTest.java contains a set of samples that have been formatted with the new option turned on, and OldFormatterTest.java contain these very same samples, before the formatter came and wrecked things up. For one of the sample, reformatting after the new formatter did its thing doesn't give back the previous result, probably because of the NON-NLS tag. I'm not necessarily saying the old formatter was good for these samples, but it was less bad :p.

Whatever the "old" and "new" formatter are doing on these, I believe they outline bugs in the new wrapping policy.
Comment 4 Frederic Fusier CLA 2010-12-27 04:32:44 EST
Ayush, may be can you have a look on this?
Comment 5 Stepan Kolesnik CLA 2014-08-20 05:45:30 EDT
Still present in 4.4
Comment 6 Eclipse Genie CLA 2019-05-21 05:36:33 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Mauro Molinari CLA 2019-05-21 05:45:54 EDT
If I repeat the steps to repro I get:

abc.foo(abc.getString("sadldwdqd", "adadw", "qwdwwfr", "WFs"),
	abc.getString("sadlaawddwdqd", "adawqrdw", "qwdwqrfqwfr", "dwqFRFRQEWFs"));

that is, the second call is kept in the same line as a whole (unless Bugzilla wraps it). Perhaps this is because the Java conventions now has a line width of 120.
If I lower the max line width to 80, I get:

abc.foo(abc.getString("sadldwdqd", "adadw", "qwdwwfr", "WFs"),
	abc.getString("sadlaawddwdqd", "adawqrdw", "qwdwqrfqwfr",
		"dwqFRFRQEWFs"));

which seems quite like the desired behaviour.

Am I missing something? Otherwise this may probably be considered fixed.
Comment 8 Mateusz Matela CLA 2019-06-10 16:54:03 EDT
Yes, it must have been fixed with the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 9 Manoj N Palat CLA 2019-07-10 00:52:47 EDT
Verified for Eclipse 4.13 M1 with Build id: I20190709-1800