I don't understand. You want to transform "Class<T> type" into
"List<T>"? I don't think that's possible (or necessary) because
"List<T>" is actually a "List". You can just construct a List and cast
it to the right type and you will end up with as much runtime
information as your proposed solution.
Gili
On 20/11/2014 5:34 PM, Robert DiFalco wrote:
> 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!