[JAVA-2886] Incorrect JSR-305 nullability annotations Created: 11/Jun/18  Updated: 28/Oct/23  Resolved: 21/Jun/18

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 3.7.0
Fix Version/s: 3.8.0

Type: Improvement Priority: Minor - P4
Reporter: Elan Kugelmass Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by JAVA-2641 Add JSR-305-compatible NonNull annota... Closed
Related
is related to JAVA-2901 ChangeStreamDocument.getFullDocument ... Closed

 Description   

Including nullness annotations in the 3.7.x series driver was a welcome addition. Thanks for adding this very useful metadata.

There are a few places in the API where methods and parameters are (meta-)labeled with the wrong nullness annotation.

Some examples, but far from exhaustive:

  1. com.mongodb.client.MongoCollection: The package has the NonNullApi meta-annotation. Methods in the findOneAnd$OP class can all return null, but are not annotated with @CheckForNull or @Nullable
  2. com.mongodb.client.model.Aggregates#group: The package has NonNullApi, but `null` has been an accepted parameter for TExpression id
  3. com.mongodb.client.model.Filters#eq: The package has NonNullApi, but `null` has been an accepted parameter for TItem value


 Comments   
Comment by Jeffrey Yemin [ 21/Jun/18 ]

Audited the builders and MongoCollection and fixed all the issues I found there. There may be more lurking, but wanted to get these in for the 3.8 release.

If more are found subsequently, please open a new issue.

Comment by Githook User [ 21/Jun/18 ]

Author:

{'username': 'jyemin', 'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com'}

Message: JAVA-2886: Add missing Nullable annotations

Added to:

Comment by Jeffrey Yemin [ 20/Jun/18 ]

PR: https://github.com/jyemin/mongo-java-driver/pull/157

Comment by Ross Lawley [ 12/Jun/18 ]

Thanks for the ticket epkugelmass, we'll investigate and update for 3.8

Generated at Thu Feb 08 08:58:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.