Seems like an invalid bug report as Gson can deserialize primitive values in Integer fields.
This commit is contained in:
Inderjeet Singh 2010-07-19 23:32:24 +00:00
parent 341c4ce5d1
commit c3f61ee5ad

View File

@ -568,4 +568,14 @@ public class PrimitiveTest extends TestCase {
result = gson.toJson(target);
assertTrue(result.equals('"' + target + '"'));
}
public void testDeserializePrimitiveWrapperAsObjectField() {
String json = "{i:10}";
ClassWithIntegerField target = gson.fromJson(json, ClassWithIntegerField.class);
assertEquals(10, target.i.intValue());
}
private static class ClassWithIntegerField {
Integer i;
}
}