Bug 214743

Summary: [formatter] Code formatter does line breaks too easily on '.'
Product: [Eclipse Project] JDT Reporter: Nils Hammar <nils.hammar>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: japgolly, srikanth_sankaran
Version: 3.3.1   
Target Milestone: 3.6 M5   
Hardware: PC   
OS: Windows All   
Whiteboard:
Attachments:
Description Flags
Current formatting rules.
none
Screen shot
none
Example code to test formatting with. none

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