Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2641

Add JSR-305-compatible NonNull annotations to the driver API

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.7.0
    • None
    • API
    • None

    Description

      Annotating the public API with NonNull annotations will allow tools like IntelliJ and other JVM languages like Kotlin to enforce constraints on application code that uses the driver.

      See for an example the recent support for null-safety added to Spring Framework 5.0 here.

      A couple of strange things about JSR-305 that need to be considered:

      • It was never actually approved and incorporated into the JDK. Rather, it's available at the following Maven coordinates: com.google.code.findbugs:jsr305:3.0.2
      • The package javax.annotation is exported by the java.xml.ws.annotation module in Java 9, and, though it's deprecated and slated for removal, I think that will conflict with any other module that also contains classes in the same package (like the JSR-305 one). However, this doesn't appear to affect Spring, perhaps because the JSR-305 jar file is a compileOnly dependency.

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: