Skip to content

Commit

Permalink
add annotations and assert to help static code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneider committed Feb 3, 2017
1 parent caf7309 commit 79e9855
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.util.concurrent.atomic.*;

import io.reactivex.*;
import io.reactivex.annotations.NonNull;
import io.reactivex.annotations.Nullable;
import io.reactivex.disposables.Disposable;
import io.reactivex.exceptions.Exceptions;
import io.reactivex.functions.Function;
Expand All @@ -33,20 +35,23 @@
*/
public final class ObservableWithLatestFromMany<T, R> extends AbstractObservableWithUpstream<T, R> {

@Nullable
final ObservableSource<?>[] otherArray;

@Nullable
final Iterable<? extends ObservableSource<?>> otherIterable;

@NonNull
final Function<? super Object[], R> combiner;

public ObservableWithLatestFromMany(ObservableSource<T> source, ObservableSource<?>[] otherArray, Function<? super Object[], R> combiner) {
public ObservableWithLatestFromMany(@NonNull ObservableSource<T> source, @NonNull ObservableSource<?>[] otherArray, @NonNull Function<? super Object[], R> combiner) {
super(source);
this.otherArray = otherArray;
this.otherIterable = null;
this.combiner = combiner;
}

public ObservableWithLatestFromMany(ObservableSource<T> source, Iterable<? extends ObservableSource<?>> otherIterable, Function<? super Object[], R> combiner) {
public ObservableWithLatestFromMany(@NonNull ObservableSource<T> source, @NonNull Iterable<? extends ObservableSource<?>> otherIterable, @NonNull Function<? super Object[], R> combiner) {
super(source);
this.otherArray = null;
this.otherIterable = otherIterable;
Expand All @@ -58,6 +63,7 @@ protected void subscribeActual(Observer<? super R> s) {
ObservableSource<?>[] others = otherArray;
int n = 0;
if (others == null) {
assert otherIterable!=null;
others = new ObservableSource[8];

try {
Expand Down

0 comments on commit 79e9855

Please sign in to comment.