Bug 214743 - [formatter] Code formatter does line breaks too easily on '.'
Summary: [formatter] Code formatter does line breaks too easily on '.'
Status: VERIFIED DUPLICATE of bug 264112
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-09 08:53 EST by Nils Hammar CLA
Modified: 2010-03-08 05:43 EST (History)
2 users (show)

See Also:


Attachments
Current formatting rules. (27.77 KB, text/xml)
2008-01-09 08:53 EST, Nils Hammar CLA
no flags Details
Screen shot (41.64 KB, image/png)
2008-01-10 02:21 EST, Nils Hammar CLA
no flags Details
Example code to test formatting with. (3.07 KB, application/octet-stream)
2008-01-10 02:21 EST, Nils Hammar CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nils Hammar CLA 2008-01-09 08:53:10 EST
Build ID: M20071023-1652

Steps To Reproduce:
When formatting code the formatter sometimes thinks it's best to do a break on the '.' in a line - even if the result is worser than the original. It isn't even consistent, but seems to do the line break insert in an inconsistent manner.

The attached picture shows a really 'stupid' line break at a '.'. Notice that the second case in the same picture didn't get a line break.
Comment 1 Nils Hammar CLA 2008-01-09 08:53:49 EST
Created attachment 86464 [details]
Current formatting rules.
Comment 2 Eric Jodet CLA 2008-01-09 11:02:44 EST
(In reply to comment #0)
> Build ID: M20071023-1652
> 
> Steps To Reproduce:
> When formatting code the formatter sometimes thinks it's best to do a break on
> the '.' in a line - even if the result is worser than the original. It isn't
> even consistent, but seems to do the line break insert in an inconsistent
> manner.
> 
"sometimes" is a bit vague to me.
May you please attach 2 code formatting scenarios where:
1 - code formatter behaves as expected
2 - code formatter inserts an unexpected line break

> The attached picture shows a really 'stupid' line break at a '.'. Notice that
> the second case in the same picture didn't get a line break.
> 
May you please attach the screen shots.

Thanks.
Comment 3 Nils Hammar CLA 2008-01-10 02:21:15 EST
Created attachment 86542 [details]
Screen shot

Seems like Bugzilla didn't attach this when creating the report initally - so here I try again.
Comment 4 Nils Hammar CLA 2008-01-10 02:21:46 EST
Created attachment 86543 [details]
Example code to test formatting with.
Comment 5 Nils Hammar CLA 2008-01-10 02:23:58 EST
Please note also that since the variable preceding the dot is very short in my case the reformatting where a line break is inserted actually make the code harder to read.
Comment 6 David Barri CLA 2008-04-10 06:33:10 EDT
I've seen a lot of occurances of this too. This happens a lot with debug lines where I have a long string and each component of System.out.println or String.format gets put on its own line like in the example attached.
Comment 7 Frederic Fusier CLA 2010-02-02 06:20:50 EST
This issue has been fixed for 3.6M5...

*** This bug has been marked as a duplicate of bug 264112 ***
Comment 8 Srikanth Sankaran CLA 2010-03-08 05:43:22 EST
Verified for 3.6M6 using build I20100305-1011