-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Some code clean ups. #3500
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
Some code clean ups. #3500
Conversation
@@ -195,7 +195,7 @@ public void call(final Subscriber<? super T> child) { | |||
final AtomicBoolean resumeBoundary = new AtomicBoolean(true); | |||
|
|||
// incremented when requests are made, decremented when requests are fulfilled | |||
final AtomicLong consumerCapacity = new AtomicLong(0l); | |||
final AtomicLong consumerCapacity = new AtomicLong(0L); |
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.
Unnecessary default value.
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.
Fixed.
@@ -112,8 +112,7 @@ public OperatorZip(Func9 f) { | |||
final Zip<R> zipper = new Zip<R>(child, zipFunction); | |||
final ZipProducer<R> producer = new ZipProducer<R>(zipper); | |||
child.setProducer(producer); | |||
final ZipSubscriber subscriber = new ZipSubscriber(child, zipper, producer); | |||
return subscriber; | |||
return new ZipSubscriber(child, zipper, producer); |
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.
This will conflict with a zip patch. Could you undo this?
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.
Done :).
Could you also squash the commits? |
Squashed :) |
👍 |
} else { | ||
return true; | ||
} | ||
return i++ != 2; |
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.
Programming on side effects 😿
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.
Well I didn't want to change any existing logic there...
I don't know code base well enough to feel comfortable with that.
I could take that "i++" one separate line higher.
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.
I could take that "i++" one separate line higher.
That's why I don't like such code, it's non-obvious (but short), in fact, "post ++
" will be applied after the condition check, so correct transformation would be:
final boolean result = i != 2;
i++;
return result;
At least, we don't have undefined behavior here, so, you can leave it as is, but personally, I'd rewrite it.
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.
i++;
return i != 3;
Should also be fine, right?
We increment both sides by 1.
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.
Yep.
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.
Changed.
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.
Thanks!
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.
My pleasure 😃
👍 |
Nothing that could change logic or application flow, just minor refactors to be consistent with good practices and clean code.
looks good. |
Nothing that could change logic or application flow, just minor refactors to be consistent with good practices and clean code.
To sum up changes: