'improperly formed type' error

Neal Gafter neal at gafter.com
Fri Jun 20 12:32:53 PDT 2008


Mark-

This is definitely a bug.  It should work the same with or without the
qualification.

Thanks for the report!

Regards,
Neal

On Fri, Jun 20, 2008 at 2:06 AM, Mark Mahieu <mark at twistedbanana.demon.co.uk>
wrote:

> This one's a minor niggle - a non-static generic inner class nested in
> another generic class cannot be instantiated from within a closure unless
> qualified with the enclosing type:
>
>
> class ImproperlyFormedType<E> {
>
>        class Inner<T> {}
>
>        void makeInner() {
>
>                // this is ok
>                new Inner<String>();
>
>                // but not when wrapped in a closure
>                {=> new Inner<String>(); }.invoke();
>
>                // qualifying it solves the problem
>                {=> new ImproperlyFormedType<E>.Inner<String>(); }.invoke();
>        }
> }
>
>
> ImproperlyFormedType.java:11: improperly formed type, type parameters given
> on a raw type
>                {=> new Inner<String>(); }.invoke();
>                             ^
> 1 error
>
>
> Regards,
>
> Mark
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20080620/9203f55c/attachment.html 


More information about the closures-dev mailing list