Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse 4.5 Java Formatter changed

Tags:

java

eclipse

Today I upgraded Eclipse to Version 4.5. Since then, it formates differently:

Before:

@Override
public void close() {
    try {
        engine.closeSession(session);
        status = NOT_CONNECTED;
    } catch (final OpenpagesException e) {
        log.error("Closing connection failed", e);
    }
}

Now:

@Override
public void close() {
try {
    engine.closeSession(session);
    status = NOT_CONNECTED;
} catch (final OpenpagesException e) {
    log.error("Closing connection failed", e);
}
}

This also happens for: switch, for, if and others...
It looks like the first indention level within a method body is broken.
I reviewed formatting settings but haven't seen something that may be responsible for this.

Is this a bug, or is there a setting?

Update: 01.07.2015
It only happens, if the tab size is set to 2, If it's set to 4 everything looks fine besides the waste of space...

Workaround At the formatter settings, switch from Tabs only to mixed.
Then add 2 for Indention size and 2 for Tab size.
Switch setting back to Tabs only and apply everything.
Now formatting works like it did with version 4.4 and it uses 2 for a tab, not 4.

like image 460
Nabor Avatar asked Nov 10 '22 10:11

Nabor


1 Answers

Workaround

At the formatter settings, switch from Tabs only to mixed. Then add 2 for Indention size and 2 for Tab size. Switch setting back to Tabs only and apply everything. Now formatting works like it did with version 4.4 and it uses 2 for a tab, not 4.

like image 196
Nabor Avatar answered Nov 14 '22 22:11

Nabor