users@jersey.java.net

Re: [Jersey] Spell out generics limitations?

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Wed, 2 Sep 2009 11:25:30 -0700

On Wed, Sep 2, 2009 at 12:44 AM, Paul Sandoz<Paul.Sandoz_at_sun.com> wrote:
> On Sep 1, 2009, at 7:38 PM, Tatu Saloranta wrote:
...
>
> Yes, Jersey can support the resolving of T for a request entity by
> traversing the class hierarchy and that is the solution i will use to solve
> the resolving of T in all contexts with the "abstract model" and will be
> able to report errors if T cannot be resolved.
>
> But say we have:
>
>  public class X<T> {
>    @GET
>    public Collection<T> get() { ... }
>  }
>
>  public class Y extends X<MyJAXBBean> { ... }
...
> Then there is no way to directly resolve the parameterized type
> Collection<T>, or Collection<V>, to Collection< MyJAXBBean> as the latter
> type does not exist at runtime using reflection, and would have to be
> created, and AFAIK the only way to create it would be to actually define a
> class, for example:
>
>  public class _Collection_MyJAXBBean_ {
>    public Collection<MyJAXBBean> _x;
>  }
>
> which means using some ASM. Essentially we are attempting to do what the
> compiler does, in part, to perform static typing.
...

Ok I see.

Personally I would probably be fine by declaring this as something to
be done later if ever. :-)
(given complexity of what it takes to tackle them)
But if this does end up being addressed, I'll be interested in seeing
the solution obviously.

-+ Tatu +-