users@jersey.java.net

[Jersey] GenericType

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Thu, 20 Nov 2014 14:34:22 -0800

Why isn't it possible to construct a GenericType if I know getType and
getRawType?

My situation is something like this:

     public <T> List<T> listType(Class<T> type) {
         return new GenericType(List.class, type);
     }

Seems like that should be possible. What am I missing about erasure? In
GenericType wouldn't new GenericType<List<String>>{} create a type of
List.class with a rawType of String.class? Why can't that be done
programmatically if I know the two types?

Thanks!