Software Open Access

NullAway: Practical Type-Based Null Safety for Java

Subarno Banerjee; Lazaro Clapp; Manu Sridharan

NullAway is a tool to help eliminate NullPointerExceptions (NPEs) in your Java code. To use NullAway, first add @Nullable annotations in your code wherever a field, method parameter, or return value may be null. Given these annotations, NullAway performs a series of type-based, local checks to ensure that any pointer that gets dereferenced in your code cannot be null. NullAway is similar to the type-based nullability checking in the Kotlin and Swift languages, and the Checker Framework and Eradicate null checkers for Java.

NullAway is fast. It is built as a plugin to Error Prone and can run on every single build of your code. In our measurements, the build-time overhead of running NullAway is usually less than 10%. NullAway is also practical: it does not prevent all possible NPEs in your code, but it catches most of the NPEs we have observed in production while imposing a reasonable annotation burden.

Files (1.3 MB)
Name Size
NullAway.zip
md5:75e5d0832a11be2694576dc28db1d7e2
1.3 MB Download
21
2
views
downloads
All versions This version
Views 2121
Downloads 22
Data volume 2.5 MB2.5 MB
Unique views 1616
Unique downloads 22

Share

Cite as