Skip to content

Commit 49d7a0c

Browse files
committed
add annotations and assert to help static code analysis
1 parent 0554fb6 commit 49d7a0c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/io/reactivex/internal/operators/observable/ObservableWithLatestFromMany.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import java.util.concurrent.atomic.*;
1717

1818
import io.reactivex.*;
19+
import io.reactivex.annotations.NonNull;
20+
import io.reactivex.annotations.Nullable;
1921
import io.reactivex.disposables.Disposable;
2022
import io.reactivex.exceptions.Exceptions;
2123
import io.reactivex.functions.Function;
@@ -33,20 +35,23 @@
3335
*/
3436
public final class ObservableWithLatestFromMany<T, R> extends AbstractObservableWithUpstream<T, R> {
3537

38+
@Nullable
3639
final ObservableSource<?>[] otherArray;
3740

41+
@Nullable
3842
final Iterable<? extends ObservableSource<?>> otherIterable;
3943

44+
@NonNull
4045
final Function<? super Object[], R> combiner;
4146

42-
public ObservableWithLatestFromMany(ObservableSource<T> source, ObservableSource<?>[] otherArray, Function<? super Object[], R> combiner) {
47+
public ObservableWithLatestFromMany(@NonNull ObservableSource<T> source, @NonNull ObservableSource<?>[] otherArray, @NonNull Function<? super Object[], R> combiner) {
4348
super(source);
4449
this.otherArray = otherArray;
4550
this.otherIterable = null;
4651
this.combiner = combiner;
4752
}
4853

49-
public ObservableWithLatestFromMany(ObservableSource<T> source, Iterable<? extends ObservableSource<?>> otherIterable, Function<? super Object[], R> combiner) {
54+
public ObservableWithLatestFromMany(@NonNull ObservableSource<T> source, @NonNull Iterable<? extends ObservableSource<?>> otherIterable, @NonNull Function<? super Object[], R> combiner) {
5055
super(source);
5156
this.otherArray = null;
5257
this.otherIterable = otherIterable;
@@ -58,6 +63,7 @@ protected void subscribeActual(Observer<? super R> s) {
5863
ObservableSource<?>[] others = otherArray;
5964
int n = 0;
6065
if (others == null) {
66+
assert otherIterable!=null;
6167
others = new ObservableSource[8];
6268

6369
try {

0 commit comments

Comments
 (0)