-
Notifications
You must be signed in to change notification settings - Fork 530
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
Modifies rules 1.09 and 2.13 to mandate java.lang.NullPointerException
...
#209
The head ref may contain hidden characters: "wip-204-spec-nulls-\u221A"
Conversation
@@ -65,6 +65,7 @@ onError | (onSubscribe onNext* (onError | onComplete)?) | |||
- The specifications below use binding words in capital letters from https://www.ietf.org/rfc/rfc2119.txt | |||
- The terms `emit`, `signal` or `send` are interchangeable. The specifications below will use `signal`. | |||
- The terms `synchronously` or `synchronous` refer to executing in the calling `Thread`. | |||
- The term "return normally" means "only throws exceptions that are explicitly allowed by the rule". |
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.
Does this need to be even clearer as in:
"is only allowed to throw exceptions that are explicitly allowed by the rule"
e85c7b9
to
46cdc0a
Compare
@@ -119,7 +120,7 @@ public interface Subscriber<T> { | |||
| <a name="2.10">10</a> | A `Subscriber` MUST be prepared to receive an `onError` signal with or without a preceding `Subscription.request(long n)` call. | | |||
| <a name="2.11">11</a> | A `Subscriber` MUST make sure that all calls on its `onXXX` methods happen-before [[1]](#footnote-2-1) the processing of the respective signals. I.e. the Subscriber must take care of properly publishing the signal to its processing logic. | | |||
| <a name="2.12">12</a> | `Subscriber.onSubscribe` MUST be called at most once for a given `Subscriber` (based on object equality). | | |||
| <a name="2.13">13</a> | Calling `onSubscribe`, `onNext`, `onError` or `onComplete` MUST return normally. The only legal way for a `Subscriber` to signal failure is by cancelling its `Subscription`. In the case that this rule is violated, any associated `Subscription` to the `Subscriber` MUST be considered as cancelled, and the caller MUST raise this error condition in a fashion that is adequate for the runtime environment. | | |||
| <a name="2.13">13</a> | Calling `onSubscribe`, `onNext`, `onError` or `onComplete` MUST return normally except in the case where any provided parameter is `null` in which case it MUST throw a `java.lang.NullPointerException` to the caller, this aside the only legal way for a `Subscriber` to signal failure is by cancelling its `Subscription`. In the case that this rule is violated, any associated `Subscription` to the `Subscriber` MUST be considered as cancelled, and the caller MUST raise this error condition in a fashion that is adequate for the runtime environment. | |
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 don't understand the grammar of "this aside". I read this as meaning "this being the only legal way ...".
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.
@benjchristensen Thanks for sanity-checking my English! You are indeed right.
What do you think about:
". Besides this, the only legal way for a Subscriber
to signal failure is by cancelling its Subscription
."?
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.
@benjchristensen Or perhaps even clearer:
" to the caller, for all other situtations the only legal way for a Subscriber
to signal failure is by cancelling its Subscription
."
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.
@reactive-streams/contributors Any other suggestions here? :)
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'm okay with -> " to the caller, for all other situtations the only legal way for a Subscriber
to signal failure is by cancelling its Subscription
."
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.
Excellent, thanks for pointing this out!
I'm 👍 on the changes other than the wording comment I added. |
Thanks @benjchristensen! |
env.verifyNoAsyncErrors(); | ||
} | ||
}); | ||
} |
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.
simplicity wins over duplication here I guess (whitebox + blackbox), is fine as-is I'd say.
Looks good 👍 Though it's missing the "anti tck-regression tests" we've been keeping recently, whipped them up for you here @viktorklang: ktoso@dade909#diff-f058033d69037e8082bda05ee49d781aR144 Feel free to cherry pick or include at will. (splits test in 3 parts, so it's actually testable for these separate messages). |
46cdc0a
to
4fbf91c
Compare
@ktoso Thanks Konrad, I amended my commit with your update! |
You're welcome :) LGTM |
4fbf91c
to
9ed52b9
Compare
…on` be thrown. Updates the TCK, Spec and example implementations.
9ed52b9
to
e2df130
Compare
@@ -86,7 +87,7 @@ public interface Publisher<T> { | |||
| <a name="1.6">6</a> | If a `Publisher` signals either `onError` or `onComplete` on a `Subscriber`, that `Subscriber`’s `Subscription` MUST be considered cancelled. | | |||
| <a name="1.7">7</a> | Once a terminal state has been signaled (`onError`, `onComplete`) it is REQUIRED that no further signals occur. | | |||
| <a name="1.8">8</a> | If a `Subscription` is cancelled its `Subscriber` MUST eventually stop being signaled. | | |||
| <a name="1.9">9</a> | Calling `Publisher.subscribe` MUST return normally. The only legal way to signal failure (or reject a `Subscriber`) is via the `onError` method. | | |||
| <a name="1.9">9</a> | Calling `Publisher.subscribe` MUST return normally except when the provided `Subscriber` is `null` in which case it MUST throw a `java.lang.NullPointerException` to the caller, for all other situations the only legal way to signal failure (or reject a `Subscriber`) is via the `onError` method. | |
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.
@benjchristensen Wdyt?
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.
👍
@reactive-streams/contributors Merging without objection :) |
Modifies rules 1.09 and 2.13 to mandate `java.lang.NullPointerException`...
RC2 or wait for the onSubscribe|onComplete|onError sequence resolution ? |
@smaldini I was hoping we'd be able to solve the onSubscribe|onComplete|onError before we cut RC2. (I don't think we ought to, or need to, put a "dummy subscription" in the RS project.) |
I'm waiting for consensus and then go RC2. But yeah I'm for that too, I think @rkuhn and I shared the concern by necessity (meaning facing not nice issues when implementing a more relaxed version). And I don't think this brings much more to bypass it. It seems we already have a consensus for it anyway. |
I was about to unleash a reactor RC1 too but I can wait slightly more to be sure I'm in sync with the RS dep :) |
But yeah I'm standing for the community order to issue the release Sent from my iPhone
|
... be thrown.
Updates the TCK, Spec and example implementations.
@reactive-streams/contributors As discussed in #204, here is my proposed spec, tck, example amendment for
null
handling. Please comment and vote before the 9th of February 2015 as we should attempt to ship 1.0.0.RC2 STAT.