Intersection bounds on 'throws' type variables

Neal Gafter neal at gafter.com
Sun Jun 22 20:07:55 PDT 2008


Mark-

It was probably just an oversight in the parser.  I'll look into this.

Thanks for the report!

Regards,
Neal


On Sun, Jun 22, 2008 at 7:15 PM, Mark Mahieu
<mark at twistedbanana.demon.co.uk> wrote:
> Should 'throws' type variables accept intersection type bounds?  The parser
> doesn't seem to like that at the moment:
>
>
> class MultipleBoundsOnThrowsTypeVar {
>
>        interface Marker {}
>        static class MyException extends Exception implements Marker {}
>
>        static <throws X extends Throwable & Marker> void foo({==>void throws
> X} block) throws X { block.invoke(); }
>
>        public static void main(String[] args) throws MyException {
>
>                foo({=> if (args.length == 1) throw new MyException(); });
>        }
> }
>
>
> MultipleBoundsOnThrowsTypeVar.java:6: > expected
>        static <throws X extends Throwable & Marker> void foo({==>void throws
> X} block) throws X { block.invoke(); }
>                                          ^
> MultipleBoundsOnThrowsTypeVar.java:6: illegal start of type
>        static <throws X extends Throwable & Marker> void foo({==>void throws
> X} block) throws X { block.invoke(); }
>                                           ^
> MultipleBoundsOnThrowsTypeVar.java:6: '(' expected
>        static <throws X extends Throwable & Marker> void foo({==>void throws
> X} block) throws X { block.invoke(); }
>                                                   ^
> 3 errors
>
>
> Regards,
>
> Mark
>



More information about the closures-dev mailing list