conduktor.io ↗

KIP-1369 — API-Contract Annotations for Nullity/Thread Safety

Discussion Client

Annotates Kafka's public API with CLASS-retained SpotBugs and JSR-305 contract annotations — `@Nullable`/`@NonNull` for null-safety and `@GuardedBy`/`@Immutable`/`@ThreadSafe`/`@NotThreadSafe` for concurrency — added `compileOnly` so nothing lands in shipped runtime dependencies. These contracts currently exist only in Javadoc prose, so a method that starts returning null or a field read without its lock compiles clean and fails at runtime, and SpotBugs already in the check phase can enforce the annotated form with no new setup.

Details

AuthorAditya Kousik
StatusDiscussion
JIRAKAFKA-20833
WikiView on Apache Wiki
Created2026-07-24
Last Modified2026-07-24
Explore how this KIP affects the Kafka protocol in the Protocol Explorer, or see the full KIP database.