Skip to content
Vladimir Sitnikov edited this page Sep 5, 2026 · 12 revisions

NullAway is a tool to help eliminate NullPointerExceptions in Java code, built as a plugin to Error Prone so that it runs on every build. The README covers what NullAway is and how to add it to a Gradle build.

Getting NullAway running

  • Installation covers the Gradle setup and the annotations to depend on.
  • Compatibility states which JDK and Error Prone versions each NullAway version needs, and the combinations that do not work.
  • Adopting NullAway gives the order to switch an existing codebase on, and the two migrations that come later.
  • Configuration lists every command-line flag, and shows how to wire NullAway into Maven, Bazel, and other build systems.
  • Suppressing Warnings covers @SuppressWarnings, castToNonNull, and auto-suppressing the warnings an existing codebase starts with.

Writing the annotations

  • Supported Annotations lists the @Nullable, @Initializer, @Contract, and field-contract annotations NullAway reads.
  • JSpecify Support covers JSpecify annotations, JSpecify mode for generics, and the two optional Error Prone checks NullAway ships.

When NullAway reports something

  • Error Messages explains every message NullAway emits, what causes it, and how to fix it.
  • Deliberate Unsoundness lists the null dereferences NullAway knowingly does not catch, and why.
  • Maps explains what NullAway concludes from containsKey, get, and put.
  • Stream Handling covers nullness through filter, and through callbacks in java.util.stream and RxJava.

How the checker works

  • How NullAway Works describes the dataflow analysis, the handler mechanism, and the JSpecify implementation.

Clone this wiki locally