Category · 1 tool · 1 guide
Java developer tools
Java remains one of the most widely used languages for backend services, Android apps, big data pipelines and enterprise systems. Java codebases tend to be large and long-lived, often maintained by many teams over many years, which makes consistency and readability more important than in almost any other ecosystem.
IDEs like IntelliJ IDEA and Eclipse format code well, but only for code that is already in your project. Developers constantly handle Java outside the IDE: snippets in code reviews, stack overflow answers, generated sources, code pasted into tickets or chat with its indentation lost. Modern syntax such as records, sealed classes, switch expressions and text blocks also trips up older formatters.
The tools in this category format Java quickly in the browser using a full Java parser, so modern language features are handled correctly. Your code never leaves your machine, which matters for proprietary source.
Tools in this category
Common tasks
- Clean up a pasted snippetRestore indentation to Java copied from a chat, ticket or PDF before reading or committing it.
- Agree on team formatting rulesCompare the common Java style guides and choose settings that keep diffs small.
- Create model classes from an API responseGenerate POJOs, Lombok classes or records from a JSON sample instead of writing them by hand.
- Format a Spring configuration fileValidate and tidy application.yml before a deployment.
- Containerise a Spring Boot serviceGenerate a multi-stage Dockerfile that builds with Maven or Gradle and runs on a slim JRE.
Key concepts
- Compilation unit
- A single Java source file with an optional package and imports followed by type declarations. Formatters need a complete unit, so wrap a lone method in a class to format it.
- Record
- A concise class for immutable data, added in Java 16. record Point(int x, int y) {} generates the constructor, accessors, equals, hashCode and toString.
- Google Java Style
- A widely used style guide with 2-space indentation and a 100-column limit. The Oracle conventions and most IDE defaults use 4 spaces instead.
- Switch expression
- Introduced in Java 14, case X -> value arms return a value and do not fall through, replacing many error-prone switch statements.
- Import order
- Formatters and style guides also decide how imports are grouped and sorted, and whether wildcard imports such as java.util.* are allowed. Inconsistent import order is one of the most common sources of noisy diffs in Java projects.
- Text block
- A multi-line string literal delimited by three double quotes, added in Java 15. It keeps SQL, JSON and HTML readable inside Java code.
Best practices
- Pick one formatter and configuration for the whole codebase and enforce it in the build, for example with Spotless.
- Reformat a whole codebase in a single dedicated commit, and list it in .git-blame-ignore-revs.
- Prefer records for immutable data carriers instead of hand-written POJOs with boilerplate.
- Keep lines within the agreed width so side-by-side diffs in code review stay readable.
- Do not mix formatting changes with logic changes in the same pull request.