-
Notifications
You must be signed in to change notification settings - Fork 366
Compatibility
NullAway runs as an Error Prone plugin inside javac, so three versions have to agree: the JDK running the build, Error Prone, and NullAway. The README has the build setup itself.
As of NullAway 0.13.0, the build must run on JDK 17 or later with Error Prone 2.36.0 or later. Version 0.13.0 raised both, from JDK 11 and from Error Prone 2.10.0. These are requirements on the JVM that runs the compiler, not on the bytecode you produce; see Targeting an older JDK below.
The com.uber.nullaway:nullaway-annotations artifact is compiled for JDK 11, so putting it on a runtime classpath does not raise that classpath's requirement.
Error Prone 2.43.0 dropped JDK 17. On JDK 17 the newest Error Prone that runs is 2.42.0, and NullAway's own test suite has a JDK 17 job pinned to that version. To move past 2.42.0, raise the JDK the build runs on; --release keeps the bytecode where it is.
JSpecify mode needs a javac that reads type-use annotations from bytecode: JDK 22 or later, or -XDaddTypeAnnotationsToSymbol=true on a JDK that supports it. NullAway fails the build when neither holds. Supported JDK versions has the exact rule, the JDK 17 and 21 releases that accept the flag, and the error text.
Error Prone's patch mode, which Suppressing Warnings uses to suppress an existing codebase's warnings in bulk, does not work with NullAway in Error Prone versions after 2.25.0 and before 2.37.0, because of NullAway's requirement that an AnnotatedPackages option be passed (#1080). Use Error Prone 2.37.0 or later, or 2.25.0 or earlier, for that step.
The JDK requirements above apply to the JVM that runs the compiler. To produce bytecode for an older JDK, pass --release to javac and keep building with a recent JDK. This is the recommended setup: it picks up the latest javac and Error Prone fixes without changing what you ship.
Guava annotates most of its packages @NullMarked as of 33.4.1, so NullAway checks calls into Guava more strictly whether or not JSpecify mode is on, and an upgrade can surface new errors. JSpecify and Guava explains what those errors are and how to address them.
Getting NullAway running
Writing the annotations
When NullAway reports something
Internals