Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 470433 - Eclipse Formatter ignores braces when line wrapping disabled
Summary: Eclipse Formatter ignores braces when line wrapping disabled
Status: CLOSED DUPLICATE of bug 354626
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-17 17:26 EDT by John Gaquin CLA
Modified: 2015-06-28 16:51 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Gaquin CLA 2015-06-17 17:26:22 EDT
We discovered today that when the Eclipse Java Code Style Formatter is configured as follows:

Braces -> ALL set to "Same line"
Line Wrapping -> CHECKED "Never join already wrapped lines"

Then the formatter will leave braces on new lines.

Example:

if (a == b)
{
    doStuff();
}

Running the above configured formatter would expect the below output based on the braces configuration:

if (a == b) {
    doStuff();
}

But instead, the formatter does nothing. 

This is very unfortunate because we have inherited a large code base with braces on new lines, and we'd like to adopt our own code style of braces on the same line. However, we usually have all line wrapping disabled so that we can manually define correct line wrapping based on context. This bug prevents us from auto-formatting the braces without ruining the wrapped lines.
Comment 1 Mateusz Matela CLA 2015-06-22 17:31:23 EDT
Good news: this is fixed in Eclipse 4.5.
So you can wait for the release next week or try out the latest release candidate.

BTW, this duplicates bug 354626.
Comment 2 Mateusz Matela CLA 2015-06-28 16:51:47 EDT

*** This bug has been marked as a duplicate of bug 354626 ***