I see the problem now. When you create a subclass of a generic, it is no longer 
considered a parameterized type, so the code that obtains the raw type and type 
parameters from the generic isn't executed. Instead, the actual class type is 
instantiated, and the item type is set to Object.class. This is wrong - the 
item type should be obtained by using reflection to get the return value of 
get(int). The same applies to Dictionary types (get(String) should be used to 
get the value type).

I'll try to fix this later tonight or tomorrow.

On Nov 24, 2010, at 7:26 PM, Bill van Melle wrote:

> Good, the TypeLiteral works okay now.  Any idea why the other way doesn't 
> work (using a class that extends ArrayList<Foo>)?  Perhaps the element type 
> is hard to find when it's in a parent class.
> 
> 

Reply via email to