Introducing Error Prone: Google’s Open‑Source Java Static Analysis Tool and How to Use It
Error Prone is a Google‑released open‑source Java static analysis tool that integrates into build pipelines to catch code defects early, offering non‑intrusive checks, configurable severity levels, and extensibility, making it valuable for Java and Android development.
Error Prone is an open‑source static analysis tool for Java, released by Google in 2015, which can be integrated into existing build processes to detect code defects during compilation, especially useful for Java and Android projects.
Key features include non‑intrusive hooking into the standard build pipeline, immediate feedback on errors, and detailed fix suggestions that can be leveraged to build custom checks.
To use Error Prone, add the appropriate Gradle plugin (e.g., gradle-errorprone-plugin) or Maven/ANT configuration as described in the official documentation. The plugin requires Gradle 2.0+ and a JDK 7 or newer that matches the javac version.
Checks are controlled via bug‑template patterns; you can enable or disable specific checks and set their severity using the -Xep:<checkName>[:severity] compiler option, where severity can be OFF, WARN, or ERROR.
Example: -Xep:StringSplitter:WARN Exclude paths to reduce noise, e.g., -XepExcludedPaths=**/build/generated/** Compared with FindBugs, Error Prone offers advantages such as active Google backing, clear remediation guidance, a bug‑pattern based checking model, early detection by hooking into compilation, and extensibility (e.g., NullAway). Its drawbacks include Java‑only support, requirement of JDK 7+, limited built‑in checks, and increased compilation time.
Adopting Error Prone can improve code quality early in development, complement other tools like FindBugs in CI pipelines, and is supported by an active open‑source community including companies like Google, Uber, and Flipboard.
References: GitHub – error‑prone , Gradle plugin , Official site .
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
360 Quality & Efficiency
360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
