Bug 196563

Summary: [formatter] makes long lines longer
Product: [Eclipse Project] JDT Reporter: Johan Walles <johan.walles>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, gwozdziu, jarthana
Version: 3.3   
Target Milestone: 3.6 M5   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Johan Walles CLA 2007-07-15 05:08:43 EDT
Build ID: I20070621-1340

Steps To Reproduce:
Take this line of code:
    a.thisIsAQuiteLongMethodName();

When the current (Eclipse 3.3 Europa) code formatter tries to shorten that line because it is too long, it does this:

    a.
        thisIsAQuiteLongMethodName();

Instead, I would have expected the formatter to realize it cannot do anything with this line and just leave it alone.

To work around this problem I've currently disabled line breaking at dots.
Comment 1 Jakub Gwozdz CLA 2007-08-07 06:25:33 EDT
It happens in very specific cases, like:

public class AA {

	public void nameWith17letters(Object o1, Object o2, Object o3) {
	}

	public static void main(String[] args) throws Exception {
		Object nameWith20letters___ = null;
		Object nameWith22letters_____ = null;
		AA aa = new AA();
		aa
				.nameWith17letters(nameWith20letters___,
						nameWith22letters_____, null);
	}

}

Names longer or shorter by one character causes code to format properly. 
The test case above was tested on "Eclipse" and "Java Conventions" built-in formatting styles.
Comment 2 Olivier Thomann CLA 2007-08-14 11:44:54 EDT

*** This bug has been marked as a duplicate of bug 147623 ***
Comment 3 Frederic Fusier CLA 2010-05-02 08:30:53 EDT

*** This bug has been marked as a duplicate of bug 264112 ***
Comment 4 Ayushman Jain CLA 2010-05-17 05:57:32 EDT
Verified for 3.6 RC 1 using build I20100513-1500.
Comment 5 Jay Arthanareeswaran CLA 2010-05-17 06:00:00 EDT
Verified.