What steps will reproduce the problem?
Try to parse {"version": 1.0} into class A { String version; }
What is the expected output? What do you see instead?
I expect a JsonParsingException, but instead get:
java.lang.IllegalArgumentException: Can not adapt type class java.lang.Double
to class
java.lang.String
at com.google.gson.PrimitiveTypeAdapter.adaptType(PrimitiveTypeAdapter.java:64)
at com.google.gson.TypeAdapterNotRequired.adaptType(TypeAdapterNotRequired.java:51)
at
com.google.gson.JsonObjectDeserializationVisitor.visitPrimitiveField(JsonObjectD
eserializationVis
itor.java:131)
at com.google.gson.ObjectNavigator.navigateClassFields(ObjectNavigator.java:177)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:152)
at
com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializa
tionContextD
efault.java:75)
at
com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializatio
nContextDefaul
t.java:47)
at com.google.gson.Gson.fromJson(Gson.java:326)
at com.google.gson.Gson.fromJson(Gson.java:299)
What version of the product are you using? On what operating system?
v1_1 on Linux
Please provide any additional information below.
Original issue reported on code.google.com by ch...@gmail.com on 29 Jul 2008 at 10:21
Original issue reported on code.google.com by
ch...@gmail.com
on 29 Jul 2008 at 10:21