Skip to content

mikybars/error-prone-gradle-demo

Repository files navigation

error-prone-gradle-demo

Error Prone is a static analysis tool for Java that catches common programming mistakes at compile-time

Error Prone Support logo

Rationale

After watching a presentation showing off the possibilities of Error Prone I decided to give it a go and set up a little POC project reflecting my current stack, namely Java 17 and Gradle 8. Common use cases implemented which are required for Real-World™ projects are the following:

  • Enable or disable specific Error Prone checks (whitelist vs blacklist)
  • Enable or disable specific Refaster rules (whitelist vs blacklist)
  • Apply additional bug checks and Refaster rules from the Error Prone Support project
  • Apply custom Refaster rules defined inside the project
  • Suppression of false positives
  • Disable Error Prone in test code
  • Multiple excluded paths
  • Enable patch mode by using a build flag (= Gradle property)

Usage

./gradlew build [-PepAutoPatch]

Links