-
Notifications
You must be signed in to change notification settings - Fork 615
Change DocumentOverlayCache.saveOverlays() to require non-null values in the given Map #3518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… in the given Map
Coverage Report 1Affected Products
Test Logs
Notes |
Size Report 1Affected Products
Test Logs
Notes |
if (mutation == null) { | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should assert mutation != null, since mutation.getKey()
is being used below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or does removing the @Nullable
achieve the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an explicit null check in saveOverlays()
. @nullable is just a compile-time check and doesn't affect runtime behavior. I also added a unit test.
…uming that they are not null
…putations on the happy path
…dependent path META-INF/DEPENDENCIES` build error
…th OS independent path META-INF/DEPENDENCIES` build error" This reverts commit f141041.
… in the given Map (#3518)
… in the given Map (#3518)
… in the given Map (#3518)
… in the given Map (#3518)
* Integrate Document Overlay with the SDK. * we should call ObjectValue.delete if value is null. * Remove unnecessary null check from MemoryDocumentOverlayCache.saveOverlay(), like is done in firebase/firebase-android-sdk#3518 * Address comments. * Port changes from Android SDK PR#3420. Note that we are not going to do any processing in the background. * Port overlay recalculation bug (Android SDK PR #3495). * Fix overlay bug when offline (Port Android SDK PR #3537). * Address feedback. * Better null check. Co-authored-by: Denver Coneybeare <[email protected]>
The current implementations of
DocumentOverlayCache.saveOverlays()
checks that each value in the givenMap
is non-null, and if it is null it ignores it, as if the key/value pair wasn't even present in the map.This PR changes the logic to assume that none of the values in the
Map
are null and modifies the call sites to ensure that they avoid putting null values into the map.This is a slightly cleaner implementation and makes the null behavior more explicit at the call site.