Add nullability annotations to ContentSet methods. #650#651
Add nullability annotations to ContentSet methods. #650#651lemonboston wants to merge 3 commits into
Conversation
| mAfterContentValues = values; | ||
| // also create mAfterKeys | ||
| mAfterKeys = new HashSet<String>(); | ||
| mAfterKeys = new HashSet<>(); |
There was a problem hiding this comment.
Please remove mAfterKeys while you're at it. It was only a workaround for the absence of ContentValues.keySet() on Android 2.x. Since we don't support Android 2 any more you can remove it in most places and replace by mAfterContentValues.keySet() where it's being read.
There was a problem hiding this comment.
Ok, I've removed mAfterKeys.
|
|
||
|
|
||
| public void addOnChangeListener(OnContentChangeListener listener, String key, boolean notify) | ||
| public void addOnChangeListener(@NonNull OnContentChangeListener listener, @Nullable String key, boolean notify) |
There was a problem hiding this comment.
I think it doesn't make sense to add a listener for changes to a null key. So key should be @NonNull.
There was a problem hiding this comment.
There are usages of these methods with null key, so that's why I used Nullable. I've checked now and null actually has a special usage here, see:
So now I've just added some javadoc to the methods about the key parameter.
Let me know if you'd prefer it to be changed somehow.
There was a problem hiding this comment.
I right, I forgot about that. Passing null will cause the listener to be called for any update on any key. Did you check if we actually use that?
There was a problem hiding this comment.
Yes, they are called with null key from ViewTaskFragment and EditTaskFragment.
|
|
||
|
|
||
| public void removeOnChangeListener(OnContentChangeListener listener, String key) | ||
| public void removeOnChangeListener(@NonNull OnContentChangeListener listener, @Nullable String key) |
No description provided.