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

Modifies rules 1.09 and 2.13 to mandate java.lang.NullPointerException... #209

Merged
merged 1 commit into from
Feb 9, 2015

Conversation

viktorklang
Copy link
Contributor

... 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.

@@ -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".
Copy link
Contributor Author

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"

@@ -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. |
Copy link
Contributor

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 ...".

Copy link
Contributor Author

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."?

Copy link
Contributor Author

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."

Copy link
Contributor Author

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? :)

Copy link
Contributor

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."

Copy link
Contributor Author

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!

@benjchristensen
Copy link
Contributor

I'm 👍 on the changes other than the wording comment I added.

@viktorklang
Copy link
Contributor Author

Thanks @benjchristensen!

env.verifyNoAsyncErrors();
}
});
}
Copy link
Contributor

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.

@ktoso
Copy link
Contributor

ktoso commented Feb 5, 2015

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).

@viktorklang
Copy link
Contributor Author

@ktoso Thanks Konrad, I amended my commit with your update!

@ktoso
Copy link
Contributor

ktoso commented Feb 5, 2015

You're welcome :) LGTM

…on` be thrown.

Updates the TCK, Spec and example implementations.
@@ -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. |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@viktorklang viktorklang added this to the 1.0.0.RC2 milestone Feb 8, 2015
@viktorklang viktorklang self-assigned this Feb 8, 2015
@viktorklang
Copy link
Contributor Author

@reactive-streams/contributors Merging without objection :)

viktorklang added a commit that referenced this pull request Feb 9, 2015
Modifies rules 1.09 and 2.13 to mandate `java.lang.NullPointerException`...
@viktorklang viktorklang merged commit 9333df9 into master Feb 9, 2015
@viktorklang viktorklang deleted the wip-204-spec-nulls-√ branch February 9, 2015 09:11
@smaldini
Copy link
Contributor

smaldini commented Feb 9, 2015

RC2 or wait for the onSubscribe|onComplete|onError sequence resolution ?

@viktorklang
Copy link
Contributor Author

@smaldini I was hoping we'd be able to solve the onSubscribe|onComplete|onError before we cut RC2.
Want to help out getting that done?
It seems like the current majority opinion is that we should aim for onSubscribe ~ onNext* ~ (onError | onComplete)

(I don't think we ought to, or need to, put a "dummy subscription" in the RS project.)

@smaldini
Copy link
Contributor

smaldini commented Feb 9, 2015

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.

@smaldini
Copy link
Contributor

smaldini commented Feb 9, 2015

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 :)

@smaldini
Copy link
Contributor

smaldini commented Feb 9, 2015

But yeah I'm standing for the community order to issue the release

Sent from my iPhone

On 9 Feb 2015, at 12:16 pm, Viktor Klang (√) [email protected] wrote:

@smaldini I was hoping we'd be able to solve the onSubscribe|onComplete|onError before we cut RC2.
Want to help out getting that done?
It seems like the current majority opinion is that we should aim for onSubscribe ~ onNext* ~ (onError | onComplete)


Reply to this email directly or view it on GitHub.

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.

4 participants