Bug 99026 - formatter wraps line improperly
Summary: formatter wraps line improperly
Status: VERIFIED DUPLICATE of bug 264112
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 99027 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-08 14:29 EDT by Trevor Janes CLA
Modified: 2010-04-27 07:05 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trevor Janes CLA 2005-06-08 14:29:12 EDT
Eclipse 3.1 M6
I'm writing Java code with all the code styles at default. The following lines
wrap correctly:

public class testc {
    public void func() {
        if (x) {
button.setLayoutData(new RowData(buttonWidth, tpl
	                .getButton1Height()));
	}
    }
}

But removing a single character causes it to wrap like this:

public class testc {
    public void func() {
        if (x) {
	    button
	            .setLayoutData(new RowData(buttonWidth, tpl
				.getButtonHeight()));
	}
    }
}
Comment 1 Dani Megert CLA 2005-06-08 15:40:48 EDT
*** Bug 99027 has been marked as a duplicate of this bug. ***
Comment 2 Dani Megert CLA 2005-06-08 16:01:33 EDT
Do you type this in or format? In neither scenario I can reproduce the problem
using N20050608-0010.

If you can reproduce using N20050608-0010 or newer please reopen and add more
detailed steps to reproduce.
Comment 3 Trevor Janes CLA 2005-06-08 17:09:03 EDT
I tried it in N20050608-0010 and got the same problem.  My co-worker gets the
problem too.  Here's a simpler example:

public class junk {
    public void func() {
        object.methodcall(new objectname(parameter1, VeryLongFunctionCallName()));
    }
}

Paste that code segment into a java code file and then format it. (Make sure all
the code formatter options are default).  I get the following result:

public class junk {
    public void func() {
        object
                .methodcall(new objectname(parameter1,
                        VeryLongFunctionCallName()));
    }
}

Obviously, the break between "object" and ".methodcall" is incorrect.  If I
shorten "VeryLongFunctionCallName" by two characters and then reformat, then the
problem goes away because the line is now 80 chars and doesn't need to wrap,
like so:

public class junk {
    public void func() {
        object.methodcall(new objectname(parameter1, ryLongFunctionCallName()));
    }
}

If I lengthen "VeryLongFunctionCallName" by one character and then reformat,
then the problem also goes away and the line wraps correctly, like so:

public class junk {
    public void func() {
        object.methodcall(new objectname(parameter1,
                AVeryLongFunctionCallName()));
    }
}

The problem seems to exist only when the line is 1 or 2 chars longer than the
wrap length.
Comment 4 Dani Megert CLA 2005-06-08 17:29:46 EDT
Adapted the summary to better reflect the problem.
Comment 5 Olivier Thomann CLA 2007-06-21 12:05:18 EDT

*** This bug has been marked as a duplicate of bug 59891 ***
Comment 6 Frederic Fusier CLA 2010-04-14 06:04:17 EDT
It was in fact more a duplicate of bug 264112, hence it's fixed since 3.6M5.

*** This bug has been marked as a duplicate of bug 264112 ***
Comment 7 Satyam Kandula CLA 2010-04-27 07:00:45 EDT
Verified for 3.6M7 using build I20100424-2000
Comment 8 Jay Arthanareeswaran CLA 2010-04-27 07:05:54 EDT
Verified.