Best Eclipse Code Formatters?

Sheehan Alam picture Sheehan Alam · Sep 20, 2010 · Viewed 86.8k times · Source

The default Eclipse formatter formats my Java code in a really funny way.

For example: hello.show().x().y() would oddly be formatted as x() and .y(), and be placed on a separate line.

Are there any other basic formatters that can do a better job?

Examples and links are very welcome.

Answer

Anupam Saini picture Anupam Saini · Aug 24, 2013

I would highly recommend the google's style guide, it's a collection of coding style guide for commonly used programming languages.

The eclipse configurable Java guide can be found here. Installing the guide is quite simple, Save the style xml to a file and import it using the following dialogue box:

Window -> Preferences -> Java -> Code Style -> Formatter

Finally select the active profile as GoogleStyle.