-
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: Feature/#4876 more null checks #5055
Changes from 9 commits
3564b1c
4a03752
23185c3
91820c0
a05a1ad
96c1680
0d0c0ea
caf7309
79e9855
e3e824a
6acef0d
339b6b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,6 +246,7 @@ public void onNext(T t) { | |
|
||
if (i == size) { | ||
window = null; | ||
assert w != null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove these asserts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
w.onComplete(); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
import java.util.Arrays; | ||
import java.util.concurrent.atomic.*; | ||
|
||
import io.reactivex.annotations.NonNull; | ||
import io.reactivex.annotations.Nullable; | ||
import org.reactivestreams.*; | ||
|
||
import io.reactivex.disposables.Disposable; | ||
|
@@ -33,21 +35,22 @@ | |
* @param <R> the output type | ||
*/ | ||
public final class FlowableWithLatestFromMany<T, R> extends AbstractFlowableWithUpstream<T, R> { | ||
|
||
@Nullable | ||
final Publisher<?>[] otherArray; | ||
|
||
@Nullable | ||
final Iterable<? extends Publisher<?>> otherIterable; | ||
|
||
final Function<? super Object[], R> combiner; | ||
|
||
public FlowableWithLatestFromMany(Publisher<T> source, Publisher<?>[] otherArray, Function<? super Object[], R> combiner) { | ||
public FlowableWithLatestFromMany(@NonNull Publisher<T> source, @NonNull Publisher<?>[] otherArray, Function<? super Object[], R> combiner) { | ||
super(source); | ||
this.otherArray = otherArray; | ||
this.otherIterable = null; | ||
this.combiner = combiner; | ||
} | ||
|
||
public FlowableWithLatestFromMany(Publisher<T> source, Iterable<? extends Publisher<?>> otherIterable, Function<? super Object[], R> combiner) { | ||
public FlowableWithLatestFromMany(@NonNull Publisher<T> source, @NonNull Iterable<? extends Publisher<?>> otherIterable, Function<? super Object[], R> combiner) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
super(source); | ||
this.otherArray = null; | ||
this.otherIterable = otherIterable; | ||
|
@@ -59,6 +62,7 @@ protected void subscribeActual(Subscriber<? super R> s) { | |
Publisher<?>[] others = otherArray; | ||
int n = 0; | ||
if (others == null) { | ||
assert otherIterable != null; | ||
others = new Publisher[8]; | ||
|
||
try { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,4 +115,18 @@ public void run() { | |
|
||
assertEquals(0, calls[0]); | ||
} | ||
|
||
@Test | ||
public void npe() throws Exception { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be named a bit more informatively. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep. added some comments |
||
Scheduler s = getScheduler(); | ||
NewThreadWorker w = (NewThreadWorker) s.createWorker(); | ||
w.dispose(); | ||
|
||
w.scheduleActual(new Runnable() { | ||
@Override | ||
public void run() { | ||
} | ||
}, 0, TimeUnit.MILLISECONDS, 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.
Asserts are off by default but they increase the bytecode size; besides we don't use
assert
it anyway.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.
ok. removed it.
Do you have a standard way to suppress false positives?