-
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: additional warnings for fromPublisher() #5640
Conversation
2bc9f23
to
755937f
Compare
755937f
to
ef611ab
Compare
Codecov Report
@@ Coverage Diff @@
## 2.x #5640 +/- ##
============================================
- Coverage 96.27% 96.22% -0.06%
+ Complexity 5852 5844 -8
============================================
Files 634 634
Lines 41539 41539
Branches 5752 5752
============================================
- Hits 39993 39972 -21
- Misses 611 623 +12
- Partials 935 944 +9
Continue to review full report at Codecov.
|
* <p> | ||
* Note that even though {@link Publisher} appears to be a functional interface, it | ||
* is not recommended to implement it through a lambda as the specification requires | ||
* state management not achievable with a stateless lambda. |
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.
maybe add which is
here? state management which is
not achievable with a stateless lambda.
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.
Or that is
. Grammarly doesn't complain about the PR's text.
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.
That is would also work.
This PR adds JavaDoc warnings for
fromPublisher
as people still try to implement a source through it and fail to follow the specification like this:Even though
Publisher
is a single abstract method (SAM) type, it is almost never reasonable to write a source with it that doesn't require a per-subscriber state. The example above fails to setup backpressure properly and it didn't calls.onSubscribe()
for that, causingNullPointerException
whenever theSubscription
would be needed (i.e., for cancellation and requesting) by the downstream operator.Maybe
doesn't havefromPublisher
.