0

I prefer to have all opening curly braces on a new line:

if (foo)
{
    bar();
}

Can I configure the Eclipse code formatter to put empty catch blocks in the same line?

try
{
    foo();
}
catch (ImpossibleCheckedException ignore) {}

I have already found the option to put the curly braces of an empty block on a single line (New Lines, [ ] in empty block), but not on the same line as the catch. And yes, I really want that empty catch block.

fredoverflow
  • 256,549
  • 94
  • 388
  • 662
  • 4
    You really should think about that. Empty catch blocks can be overlooked when the code in the try block is changed. Also there is no indication as to _why_ you deem the exception ignorable. The best is to provide a small comment that explains that. – musiKk Jun 08 '11 at 10:08

1 Answers1

4

Can't be done, at least the Eclipse formatter does not support this.

p.s. Due to the discussion on the other answers (which are now deleted), I feel obliged to stay on topic but add this comment: Empty catch blocks are bad m'kay Why are empty catch blocks a bad idea?

Community
  • 1
  • 1
mark-cs
  • 4,677
  • 24
  • 32
  • 1
    @FredOverflow - you should remove your down-vote now. This is the only correct, on-topic answer you will get. – Stephen C Jun 08 '11 at 09:57