I'm writing to notify everyone about an important change in our
codebase that will be coming in PR #24239:
https://github.com/apache/pulsar/pull/24239

We are currently using multiple nullness annotation libraries.
Many JDK, tool and library vendors (https://jspecify.dev/about/) have
standardized on JSpecify nullness annotations so that each vendor
doesn't introduce its own classes for this purpose. We should migrate
too.

In addition, one additional motivation is that recent Google Guava
versions no longer contain a transitive dependency on the checker-qual
library 
(https://github.com/google/guava/commit/2cc8c5eddb587db3ac12dacdd5563e79a4681ec4).
Pulsar modules use checker-qual as a transitive dependency coming from
Guava, so Pulsar builds would no longer need modifications when we
upgrade Guava once we have migrated off checker-qual.

PR changes:

Migrate these to org.jspecify.annotations.NonNull:
- org.checkerframework.checker.nullness.qual.NonNull
- javax.annotation.Nonnull
- org.jetbrains.annotations.NotNull

Migrate these to org.jspecify.annotations.Nullable:
- org.checkerframework.checker.nullness.qual.Nullable
- javax.annotation.Nullable
- org.jetbrains.annotations.Nullable

In addition, there was code that was using javax.validation
annotations for nullness information. That's invalid since those
annotations are used for user input validation and not static code
analysis.

Add checkstyle rules:
- to prevent introducing the replaced deprecated annotations
- to prevent introducing javax.validation annotations

These changes should help standardize our codebase and align with
industry practices for nullness annotations. The PR is currently under
review and targeted for milestone 4.1.0, with backports planned for
releases 3.0.12, 3.3.7, and 4.0.5.

Please review the PR https://github.com/apache/pulsar/pull/24239 if
you have time. Your feedback is appreciated.

Thanks,

Lari

Reply via email to