pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: How to debug JSONSerializer errors?
Date Thu, 25 Nov 2010 02:58:58 GMT
Turns out this doesn't work, presumably due to type erasure. I think I'll need to walk up the
type hierarchy to find the parameterized Sequence type and get the actual type arguments from
that.

On Nov 24, 2010, at 8:17 PM, Greg Brown wrote:

> 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.
>> 
>> 
> 


Mime
View raw message