Automating Java Codebase Annotations for Null Safety
Blog post from Sonar
NullAway is a Java null-safety checker that uses @Nullable annotations and non-null defaults to prevent null dereferences, but migrating large unannotated codebases is difficult because annotations can propagate through fields and method signatures, produce iterative compiler errors, create false positives for invariants the type system cannot express, and require widespread cross-team code reviews. To address this, Uber and UC Riverside developed the open-source NullAwayAnnotator, which automates onboarding by repeatedly analyzing NullAway errors, exploring alternative chains of annotations through bounded backtracking, and selecting changes that minimize unresolved errors rather than blindly marking values nullable. The tool accelerates this search with program-structure graph coloring, accounts for build-target and downstream dependency boundaries, and suppresses remaining unresolved locations so annotation-only, behavior-preserving changes can be merged automatically. At Uber, it was used to annotate more than 160 production targets covering over 1.3 million lines of code, leaving an average of 6.32% of each target unchecked, while enabling future changes outside suppressed areas to receive null-safety guarantees.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| Serverless | 1 | 1,024 | 191 | 85 | +26% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.