We recently open-sourced our support for Error Prone. Error Prone checks for common mistakes in Java code that will not be caught by the compiler.

We turned Error Prone on by default but you can easily turn it off by using the Javac option -XepDisableAllChecks. To do so, simply specify --javacopt='XepDisableAllChecks to the list of Bazel’s options. You can also tune the checks error-prone will perform by using the -Xep: flags.

See the documentation of Error Prone for more on Error Prone.