explaingit

google/error-prone

7,169JavaAudience · developerComplexity · 3/5Setup · moderate

TLDR

A Google tool that catches common Java programming mistakes at compile time, before your code ever runs. It plugs into Maven, Gradle, Bazel, or Ant and reports bugs with plain explanations at the exact line.

Mindmap

mindmap
  root((Error Prone))
    What it does
      Catch bugs at compile
      Explain each error
      No separate step
    Build integrations
      Maven
      Gradle
      Bazel
      Ant
    Bug patterns
      Type mismatches
      API misuse
      Common Java mistakes
    From Google
      Open source
      External docs site
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add Error Prone to a Maven or Gradle build so every developer on the team automatically gets bug checks during normal compilation.

USE CASE 2

Catch type mismatches and API misuse bugs in Java code that the standard compiler would silently accept.

USE CASE 3

Enforce code quality rules across a large Java codebase without a separate static analysis step or scheduled scan.

Tech stack

JavaBazelMavenGradleAnt

Getting it running

Difficulty · moderate Time to first run · 30min

Requires modifying your existing Maven, Gradle, Bazel, or Ant build configuration to enable the Error Prone compiler plugin.

License is not stated in the README, check the repository's license file for full terms.

In plain English

Error Prone is a tool from Google that checks Java code for common mistakes while it is being compiled, before the code ever runs. The idea is to catch bugs at the earliest possible moment rather than discovering them later during testing or in production. A typical example it catches: if you have a collection typed to hold Short values and you accidentally pass an int to the remove method, Java will not flag that as an error on its own, but Error Prone will. It reports the exact line and explains why it is wrong. There are dozens of patterns like this that experienced Java developers have learned to avoid, and Error Prone encodes that knowledge so every developer on a project benefits automatically. It integrates with the standard Java build tools: Bazel, Maven, Ant, and Gradle. Once configured, it runs as part of the normal compilation step, so there is no separate analysis phase to remember. The project's documentation and full list of patterns it detects are at errorprone.info. The README is short and points to that external site for most details.

Copy-paste prompts

Prompt 1
I want to add Error Prone to my Maven project. Show me the exact pom.xml configuration needed to enable it during compilation.
Prompt 2
Error Prone flagged a warning about a method call in my Java code. How do I look up what the check means and understand why it's flagged?
Prompt 3
I want to suppress a specific Error Prone warning on one line of code without disabling the whole check project-wide. How do I do that?
Prompt 4
How do I add Error Prone to a Gradle build so it runs automatically on every compile without a separate task?
Prompt 5
Can I write a custom Error Prone check for a bug pattern specific to my own codebase? Where do I start?
Open on GitHub → Explain another repo

← google on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.