[concurrency-interest] More Javadoc problems

cowwoc cowwoc at bbs.darktech.org
Sun Dec 21 17:51:35 EST 2014


On 20/12/2014 1:23 PM, Doug Lea [via JSR166 Concurrency] wrote:
> > because if it did it would throw exception2.addSuppressed(exception1)
> > instead of exception1. Would it not?
>
> Not. This is only done in try-with-resources.
> See the (adjacent) JLS sections:
>
> http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.20.2
>
> http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.20.3
>

My interpretation of the first link is that:

try
{
   throw X;
}
finally
{
   throw Y;
}

will end up throwing Y. My interpretation of the second link is that:

try (resource)
{
   throw X;
}
finally
{
   throw Y;
}

will end up throwing X.addSuppressed(Y). But according to our 
discussion, CompletableFuture ends up throwing X, which does not match 
the behavior of try-finally or try-with-resources. Am I missing anything?

Thanks,
Gili




--
View this message in context: http://jsr166-concurrency.10961.n7.nabble.com/More-Javadoc-problems-tp11669p11710.html
Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20141221/748b36f0/attachment.html>


More information about the Concurrency-interest mailing list