~/talk

Null Safety in Java with JSpecify and NullAway

Talkat Spring I/O 2025 · 2025-05-22..05-23· [java, security]
slides:none on file

Shows a concrete migration: add org.jspecify:jspecify:1.0.0 and enable JSpecify + NullAway (as an Error Prone plugin) to turn nullness warnings into compilation errors, catching missing checks early; Spring Framework annotation sweep finds ~80–90% of type usages are non-null by default so packages use a package-level non-null default and only mark nullable cases; Kotlin 2.1 treats JSpecify mismatches as errors; lazy Spring‑initialized fields need suppressions like newway.init for now, and the build-time checks successfully break CI on null-safety violations.

AI-written summary · about

  1. 0:00Null safety in Java
  2. 2:33Problem with implicit nullness
  3. 3:16Introducing JSpecify
  4. 5:25Adding JSpecify dependencies
  5. 6:07Annotating with @NonNull and @Nullable
  6. 7:08Why Optional fails
  7. 9:37JSpecify versus other annotations
  8. 11:23Setting default nullness
  9. 13:52JSpecify syntax quirks
  10. 16:44Enforcing with NullAway
  11. 18:54Handling null paths
  12. 20:20Advanced generics and arrays
  13. 22:10Kotlin interoperability
  14. 26:07Spring Framework null safety
  15. 31:33Lazy initialization
  16. 34:24Spring Boot 4 null-safe APIs
  17. 36:51Benefits of annotations
  18. 37:55Future of null safety in JDK
  19. 39:59Contributing to NullAway and JSpecify
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.