-1

Here's what I have:

if (something) throw new Exception("whatever");

I would like to find a tool which will do a one-time pass over all my code and change statements like the above one to this:

if (something) { throw new Exception("whatever"); }

Note that I want everything to stay on the same single line (if it was like this).

Any tool/editor/plugin/script/anything which can do the job, just once, for all my code - is helpful.

Thank you.

Wanna Know All
  • 681
  • 2
  • 8
  • 18
  • See related question http://stackoverflow.com/questions/3704308/how-to-make-eclipse-automatically-add-braces-to-an-if-statement. – Mihai8 May 03 '15 at 13:29

1 Answers1

0

Apparently IntelliJ can do this via a combination of 2 settings:

  1. Code Style > Java > If() statement > Force braces > Always
  2. Code Style > Java > Keep when reformatting > Simple blocks in one line
Wanna Know All
  • 681
  • 2
  • 8
  • 18