Skip to content

SYSTEM Cited by 1 source

Nullsafe (Meta / Infer)

Nullsafe is Meta's static-analysis tool for Java null-safety. Ships as part of the Infer-adjacent annotation set. Source: github.com/facebook/infer/blob/main/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java. The @Nullsafe class-level annotation opts the class into Nullsafe's static-analysis rules.

Role in the wiki

Nullsafe is the Java-side null-safety prerequisite for Meta's Java→Kotlin translation pipeline. Before the Kotlinator can safely translate a file, the file (and ideally its dependents) must be @Nullsafe so that the Kotlinator can infer accurate nullability for parameters, return types, and fields.

The fundamental limitation Meta calls out

The 2024-12-18 post is explicit about why Nullsafe alone is insufficient to eliminate NPEs: "[static analysis is only 100% effective for 100% code coverage], which is simply not viable in any large mobile codebase that interacts with the server and third-party libraries." A single non-@Nullsafe dependent can pass null into a @Nullsafe-protected method and crash the caller. This is the wiki's interlanguage null safety problem.

The solution Meta pursues: runtime nullability telemetry via a javac compiler plugin that collects actual null flows. See concepts/runtime-nullability-telemetry.

Seen in

Last updated · 319 distilled / 1,201 read