Bug 196563 - [formatter] makes long lines longer
Summary: [formatter] makes long lines longer
Status: VERIFIED DUPLICATE of bug 264112
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-15 05:08 EDT by Johan Walles CLA
Modified: 2010-05-17 06:00 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.