we have here at work a very strange coding convention, and I didn't managed to setup the Java Formatter in Eclipse right to do what I want. The convention says:
- Before a curly brace "{" there should always be a new Line
[UPDATE] There is no rule in our convention saying, if after a "{" should be a line break or not. The examples actually use a line break (and almost ANY convention I saw so far says or implies that after a "{" and a "}" should always be a line break). So sample 1 and 2 are both "syntactically correct". [/UPDATE]
As this blows the code, our team have decided to write code like this (no, this wasn't my choice!):
public void methode(final boolean b)
{ if (b)
{ do.something();
}
else
{ do.somethingElse();
}
}
But in the formatter I only managed to get this:
public void methode(final boolean b)
{
if (b)
{
do.something();
}
else
{
do.somethingElse();
}
}
or this:
public void methode(final boolean b) {
if (b) {
do.something();
}
else {
do.somethingElse();
}
}
Is there a way to tell the formatter to break lines before a "{" but not after that? I know the first style is awful, and I would be pleased to use one of the last two, but this is a company decision.