Exception transparency vs constructors

Neal Gafter neal at gafter.com
Thu May 15 19:22:45 PDT 2008


Got it, thanks!  I suspect some of these are symptoms of existing problems,
but either way I'll track them down.

Regards,
Neal

On Thu, May 15, 2008 at 6:22 PM, Mark Mahieu <mark at twistedbanana.demon.co.uk>
wrote:

> It looks like exception transparency isn't working quite right with
> constructors - I think the following class should compile, but it doesn't:
>
>
> public class ExTrans {
>
>    <throws X> ExTrans({=> void throws X} block) throws X {
>        block.invoke();
>    }
>
>    public static void main(String[] args) throws Exception {
>        new ExTrans({=> throw new Exception(); });
>    }
> }
>
>
>
> ExTrans.java:8: unreported exception X; must be caught or declared to be
> thrown
>        new ExTrans({=> throw new Exception(); });
>        ^
> 1 error
>
>
>
> Regards,
>
> Mark
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20080515/b6da6cf2/attachment.html 


More information about the closures-dev mailing list