Mar 24, 2018

Reformats Java source code to comply with Google Java Style.

google-java-format is a program that reformats Java source code to comply with Google Java Style.

Using the formatter from the command-line
Download the formatter and run it with:

java -jar /path/to/google-java-format-1.5-all-deps.jar <options> [files...]

The formatter can act on whole files, on limited lines (--lines), on specific offsets (--offset), passing through to standard-out (default) or altered in-place (--replace).

To reformat changed lines in a specific patch, use google-java-format-diff.py.