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
| Author | Aditya Kousik |
| Status | Discussion |
| JIRA | KAFKA-20833 |
| Wiki | View on Apache Wiki |
| Created | 2026-07-24 |
| Last Modified | 2026-07-24 |
Explore how this KIP affects the Kafka protocol in the Protocol Explorer, or see the full KIP database.