discomarathon / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Gson should support Parameterized types with variable types as parameters #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If a field is of wild-card type, Gson should be able to handle it. 

class Foo<? extends Number> {
}

Class Bar {
  Foo<Integer> foo;
} 

should serialize and deserialize correctly.

Original issue reported on code.google.com by inder123 on 21 Aug 2008 at 7:50

GoogleCodeExporter commented 9 years ago
We also need to handle the following:

public class B<T> {
  List<T> list;
  List<T>[] arrayList;
}

NOTE: I've added some tests that are currently failing, but should pass once 
this is
supported.

Original comment by joel.leitch@gmail.com on 25 Aug 2008 at 3:38

GoogleCodeExporter commented 9 years ago

Original comment by joel.leitch@gmail.com on 25 Aug 2008 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by joel.leitch@gmail.com on 25 Aug 2008 at 3:40

GoogleCodeExporter commented 9 years ago
The supporting code is in r211.  With this change, an instance of class B above 
can
be serialized/deserialized properly.

- Added support for ParameterizedTypes where at least one type parameter is a
TypeVariable.
- Added support for GenericArrayTypes where the ParameterizedType has a
"TypeVariable" as one of its type parameters.

Marking this issue as fixed and will reopen another issue for the Wildcard 
types.

Original comment by joel.leitch@gmail.com on 28 Aug 2008 at 7:55