-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
DefaultPromise may throw checked exceptions that are not advertised #8995
Conversation
Motivation: We should not throw check exceptions when the user calls sync*() but should better wrap it in a CompletionException to make it easier for people to reason about what happens. Modifications: - Change sync*() to throw CompletionException - Adjust tests - Add some more tests Result: Fixes #8521.
06344dd
to
fea799c
Compare
/cc @njhill @franz1981 |
any comments ? |
// expected | ||
Assert.assertThat(expected.getCause(), CoreMatchers.instanceOf(RejectedExecutionException.class)); |
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.
Just for readability: import static CoreMatchers.instanceOf
or both is(instanceOf(...
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.
LGTM
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 not familiar with CancellationException, but it looks to be the same thing as ExecutionException except it is a RuntimeException. Seems fair.
+1 for trashing a usage of PlatformDependent.throwException(). I hate that thing :-)
@ejona86 yes |
@@ -83,12 +83,20 @@ | |||
/** | |||
* Waits for this future until it is done, and rethrows the cause of the failure if this future | |||
* failed. | |||
* | |||
* @throws CancellationException if the computation was cancelled | |||
* @throws {@link java.util.concurrent.CompletionException} if the computation threw an exception. |
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.
Late, but this should be:
@throws CompletionException if the ....
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.
@trustin you mean removing the "package" ?
Motivation:
We should not throw check exceptions when the user calls sync*() but should better wrap it in a CompletionException to make it easier for people to reason about what happens.
Modifications:
Result:
Fixes #8521.