-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
2.x composite disposable docs #6432
2.x composite disposable docs #6432
Conversation
…m in vararg param is null
…aming at methods, added @throws javadoc where applicable
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.
The wording needs further adjustments.
for (Disposable d : resources) { | ||
ObjectHelper.requireNonNull(d, "Disposable item is null"); | ||
public CompositeDisposable(@NonNull Disposable... disposables) { | ||
ObjectHelper.requireNonNull(disposables, "Disposables are null"); |
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.
Please use lowercase as it refers to the argument: disposables is null
.
ObjectHelper.requireNonNull(disposables, "Disposables are null"); | ||
this.resources = new OpenHashSet<Disposable>(disposables.length + 1); | ||
for (Disposable d : disposables) { | ||
ObjectHelper.requireNonNull(d, "Disposable item in Disposables is null"); |
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.
Again, lowercase: A Disposable in the disposables array is null
.
public CompositeDisposable(@NonNull Iterable<? extends Disposable> resources) { | ||
ObjectHelper.requireNonNull(resources, "resources is null"); | ||
public CompositeDisposable(@NonNull Iterable<? extends Disposable> disposables) { | ||
ObjectHelper.requireNonNull(disposables, "Disposables are null"); |
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.
disposables is null
.
@@ -38,26 +38,28 @@ public CompositeDisposable() { | |||
|
|||
/** | |||
* Creates a CompositeDisposables with the given array of initial elements. | |||
* @param resources the array of Disposables to start with | |||
* @param disposables the array of Disposables to start with | |||
* @throws NullPointerException if disposables param is null, or a Disposable item in the disposables is null |
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.
if {@code disposables} or any of its array items is null
this.resources.add(d); | ||
} | ||
} | ||
|
||
/** | ||
* Creates a CompositeDisposables with the given Iterable sequence of initial elements. | ||
* @param resources the Iterable sequence of Disposables to start with | ||
* @param disposables the Iterable sequence of Disposables to start with | ||
* @throws NullPointerException if disposables param is null, or a Disposable item in the disposables is null |
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.
if {@code disposables} or any of its returned items is null
* @return true if the operation was successful, false if the container has been disposed | ||
* @throws NullPointerException if disposables param is null, or a Disposable item in the disposables is null |
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.
if {@code disposables} or any of its array items is null
public boolean addAll(@NonNull Disposable... ds) { | ||
ObjectHelper.requireNonNull(ds, "ds is null"); | ||
public boolean addAll(@NonNull Disposable... disposables) { | ||
ObjectHelper.requireNonNull(disposables, "Disposables are null"); |
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.
disposables is null
for (Disposable d : ds) { | ||
ObjectHelper.requireNonNull(d, "d is null"); | ||
for (Disposable d : disposables) { | ||
ObjectHelper.requireNonNull(d, "Disposable item in Disposables is null"); |
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.
A Disposable in the disposables array is null
* @return true if the operation was successful | ||
* @throws NullPointerException if disposable param is null |
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.
if {@code disposable} is null
public boolean delete(@NonNull Disposable d) { | ||
ObjectHelper.requireNonNull(d, "Disposable item is null"); | ||
public boolean delete(@NonNull Disposable disposable) { | ||
ObjectHelper.requireNonNull(disposable, "Disposable item is null"); |
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.
disposable is null
Codecov Report
@@ Coverage Diff @@
## 2.x #6432 +/- ##
============================================
- Coverage 98.34% 98.27% -0.07%
+ Complexity 6300 6299 -1
============================================
Files 675 675
Lines 45172 45172
Branches 6246 6246
============================================
- Hits 44425 44394 -31
- Misses 229 244 +15
- Partials 518 534 +16
Continue to review full report at Codecov.
|
Thanks for your feedback, I think I addressed all of your suggestions. |
On CompositeDisposable add and addAll methods, if the param is null, currently the NPE error message (produced by ObjectHelper) is "d is null" which is not very helpful.
This is a small refactor for making the message a bit more helpful.
Resolves #6430