Skip to content
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

Merged
merged 12 commits into from
Feb 3, 2017

Conversation

jschneider
Copy link
Contributor

I have added some more null checks to help the static code analysis.
I think I have also fixed one possible NPE in NewThreadWorker

@jschneider jschneider force-pushed the feature/#4876-more-null-checks branch from 49d7a0c to 79e9855 Compare February 3, 2017 11:23
@akarnokd akarnokd changed the title Feature/#4876 more null checks 2.x: Feature/#4876 more null checks Feb 3, 2017
@codecov
Copy link

codecov bot commented Feb 3, 2017

Codecov Report

Merging #5055 into 2.x will increase coverage by 0.05%.

@@             Coverage Diff              @@
##                2.x    #5055      +/-   ##
============================================
+ Coverage     95.53%   95.58%   +0.05%     
- Complexity     5540     5544       +4     
============================================
  Files           612      612              
  Lines         39576    39577       +1     
  Branches       5553     5554       +1     
============================================
+ Hits          37807    37831      +24     
+ Misses          775      754      -21     
+ Partials        994      992       -2
Impacted Files Coverage Δ Complexity Δ
...operators/flowable/FlowableWithLatestFromMany.java 97.67% <ø> (ø) 7 <ø> (ø)
...rnal/operators/flowable/FlowableCombineLatest.java 92.43% <ø> (ø) 8 <ø> (ø)
...ators/observable/ObservableWithLatestFromMany.java 99.19% <ø> (ø) 7 <ø> (ø)
...perators/maybe/MaybeFlatMapIterableObservable.java 100% <100%> (+1.33%) 2 <ø> (ø)
...reactivex/internal/schedulers/NewThreadWorker.java 100% <100%> (ø) 15 <ø> (+1)
...ivex/internal/schedulers/ComputationScheduler.java 96.96% <100%> (ø) 13 <ø> (ø)
...rnal/subscribers/SinglePostCompleteSubscriber.java 94.87% <ø> (-5.13%) 14% <ø> (-1%)
...vex/internal/operators/single/SingleTakeUntil.java 86.88% <ø> (-4.92%) 2% <ø> (ø)
...rnal/subscriptions/DeferredScalarSubscription.java 93.84% <ø> (-4.62%) 27% <ø> (-1%)
...reactivex/internal/operators/maybe/MaybeUsing.java 95.95% <ø> (-4.05%) 4% <ø> (ø)
... and 40 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00f53ae...339b6b8. Read the comment docs.

@@ -73,6 +76,7 @@ public void subscribeActual(Subscriber<? super R> s) {
Publisher<? extends T>[] a = array;
int n;
if (a == null) {
assert iterable != null; //either array or iterable are initialized with non null values
Copy link
Member

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.

Copy link
Contributor Author

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?

@@ -246,6 +246,7 @@ public void onNext(T t) {

if (i == size) {
window = null;
assert w != null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these asserts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combiner needs annotation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -115,4 +115,18 @@ public void run() {

assertEquals(0, calls[0]);
}

@Test
public void npe() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be named a bit more informatively.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. added some comments

@jschneider jschneider force-pushed the feature/#4876-more-null-checks branch from 05d5986 to 339b6b8 Compare February 3, 2017 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants