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: WIP removes anonymous inner classes. #5174

Merged

Conversation

SleimanJneidi
Copy link
Contributor

@SleimanJneidi SleimanJneidi commented Mar 11, 2017

This is a WIP. Since the changes are big, an incremental review and PR was recommended by @akarnokd

  • Removes them from flowable/observable/operators.
  • Issue #5150

@codecov
Copy link

codecov bot commented Mar 11, 2017

Codecov Report

Merging #5174 into 2.x will decrease coverage by 0.03%.
The diff coverage is 98.78%.

@@             Coverage Diff             @@
##               2.x    #5174      +/-   ##
===========================================
- Coverage       96%   95.96%   -0.04%     
+ Complexity    5663     5654       -9     
===========================================
  Files          621      621              
  Lines        39974    40247     +273     
  Branches      5610     5610              
===========================================
+ Hits         38378    38625     +247     
- Misses         630      649      +19     
- Partials       966      973       +7
Impacted Files Coverage Δ Complexity Δ
...operators/flowable/FlowableWithLatestFromMany.java 97.69% <100%> (+0.01%) 7 <0> (ø)
...al/operators/observable/ObservableSubscribeOn.java 100% <100%> (ø) 2 <0> (ø)
...ternal/operators/flowable/FlowableBufferTimed.java 90.94% <100%> (-0.07%) 5 <0> (ø)
...vex/internal/operators/single/SingleDoOnEvent.java 100% <100%> (ø) 2 <1> (ø)
...vex/internal/operators/flowable/FlowableDelay.java 100% <100%> (ø) 3 <0> (ø)
...rnal/operators/flowable/FlowableCombineLatest.java 92.46% <100%> (+0.03%) 8 <0> (ø)
...x/internal/operators/flowable/FlowablePublish.java 96.03% <100%> (+1.86%) 10 <0> (+1)
...nternal/operators/observable/ObservableReplay.java 97.74% <100%> (-0.14%) 18 <3> (-1)
...x/internal/operators/single/SingleZipIterable.java 100% <100%> (ø) 9 <0> (ø)
...internal/operators/observable/ObservableDelay.java 100% <100%> (ø) 3 <0> (ø)
... and 82 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 f059ded...2377ea8. Read the comment docs.

Copy link
Member

@akarnokd akarnokd left a comment

Choose a reason for hiding this comment

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

Looks good so far, minus a couple of private modifiers that need to be removed.

throw ExceptionHelper.wrapOrThrow(NotificationLite.getError(buf));
}
return NotificationLite.getValue(buf);
private class Iterator implements java.util.Iterator<T> {
Copy link
Member

Choose a reason for hiding this comment

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

final

Copy link
Member

Choose a reason for hiding this comment

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

and no private

}

@Override
public boolean accept(Subscriber<? super U> a, U v) {
a.onNext(v);
return true;
}

private final class RemoveFromBuffer implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

No private

@@ -557,4 +552,11 @@ public void requestOne() {

}
}

private final class SingletonArrayFunc implements Function<T, R> {
Copy link
Member

Choose a reason for hiding this comment

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

No private

@@ -125,5 +102,45 @@ public void cancel() {
w.dispose();
}

private final class OnNext implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

No private

}
}

private class OnError implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

No private but final

Copy link
Member

Choose a reason for hiding this comment

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

Here too.

@@ -289,5 +279,35 @@ public void request(long n) {
public void cancel() {
dispose();
}

private final class TimeoutTask implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

No private

}
}

private final class Cancellation implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

No private

@@ -839,6 +829,19 @@ public void run() {
this.open = open;
}
}

private final class Completion implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

no private

@@ -138,4 +116,34 @@ public void otherError(Throwable e) {
actual.onError(e);
}
}

private final class FlowableWithLatestSubscriber<U> implements FlowableSubscriber<U> {
Copy link
Member

Choose a reason for hiding this comment

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

no private

@@ -298,4 +293,11 @@ public void dispose() {
SubscriptionHelper.cancel(this);
}
}

private final class SingletonArrayFunc implements Function<T, R> {
Copy link
Member

Choose a reason for hiding this comment

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

no private

Copy link
Member

@akarnokd akarnokd left a comment

Choose a reason for hiding this comment

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

A couple of places still require attention.

other.subscribe(otherSubscriber);
}

private final class DelaySubscriber implements FlowableSubscriber<U> {
Copy link
Member

Choose a reason for hiding this comment

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

Still private

main.subscribe(new OnCompleteSubscriber());
}

private class DelaySubscription implements Subscription {
Copy link
Member

Choose a reason for hiding this comment

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

no private but final

co.connect(new DisposableConsumer(srw));
}

private final class DisposableConsumer implements Consumer<Disposable> {
Copy link
Member

Choose a reason for hiding this comment

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

Here too.

@akarnokd akarnokd changed the title WIP removes anonymous inner classes from flowable 2.x: WIP removes anonymous inner classes from flowable Mar 11, 2017
@SleimanJneidi
Copy link
Contributor Author

@akarnokd on it

@SleimanJneidi SleimanJneidi changed the title 2.x: WIP removes anonymous inner classes from flowable 2.x: WIP removes anonymous inner classes. Mar 11, 2017
Copy link
Member

@akarnokd akarnokd left a comment

Choose a reason for hiding this comment

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

Still two missing. Look at the main page where there should be a bunch of collapsed comment along with the remaining problems in FlowableDelay.

}
}

private class OnError implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

Here too.

}
}

private class OnComplete implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

Here too.

@akarnokd
Copy link
Member

Great job! I'll merge this so the changes don't get too numerous.

@akarnokd akarnokd merged commit 4c22f96 into ReactiveX:2.x Mar 11, 2017
@SleimanJneidi SleimanJneidi deleted the refactor-remove-anonymous-inner-classes branch March 12, 2017 01:20
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