Comparing Java Formatters: Why Open Java Format Is My New Favorite
Recently, I read Alex Abashev’s article on Foojay.io, My love-hate relationship with Java formatters.
Unlike Go with gofmt or Rust with rustfmt, Java has never shipped a built-in source code formatter in the JDK, leaving teams to argue in pull requests over Checkstyle rules, IntelliJ XML exports, or where the dot goes in a stream pipeline.
In his post, Alex made two points that immediately resonated with me:
- Once you experience an opinionated, zero-configuration formatter as a CI gate, you never want to go back to bikeshedding over indentation in code reviews.
- AI coding agents make deterministic formatters matter more than ever. Every model and every session has its own idea of code style, regardless of what you write in your
AGENTS.mdorGEMINI.mdfiles. One agent puts every method parameter on its own line, another crams a whole stream pipeline into a 200-character line, and a third reformats untouched methods, turning a two-line bug fix into a 400-line whitespace diff.
In his article, Alex also introduced open-java-format (GitHub), an open-source fork of palantir-java-format that he created to fix long-standing bugs, modernize the build and IDE tooling, and keep pace with recent JDK releases.
