Viability of jspecify for nullability handling

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • 6.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Java Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Replace javax.annotation.Nullable and related annotations in the MongoDB Java Driver with JSpecify annotations to improve compatibility with modern static analysis tools and align with evolving Java ecosystem standards around null-safety.

      The Java ecosystem is converging on JSpecify as the de facto standard for nullness annotations, with tooling support from IntelliJ, Error Prone, Checker Framework, and other static analysis tools. Our current use of javax.annotation.Nullable has limited IDE support and does not provide as strong nullness guarantees or interop with modern tools. Migrating to JSpecify enhances developer experience by enabling better null-safety checking, reducing potential for null-related bugs.

      What:

      • Replace usages of javax.annotation.Nullable and javax.annotation.Nonnull with org.jspecify.annotations.Nullable and @NullMarked at the package/class level.
      • Audit all public API surfaces in mongo-java-driver, mongodb-driver-sync, and mongodb-driver-core for consistency.
      • Add the JSpecify dependency in a compileOnly scope to avoid runtime impact.
      • Update docs to reflect JSpecify as the new standard for null annotations.

            Assignee:
            Unassigned
            Reporter:
            Alex Bevilacqua
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: