Hello,
i have notice that the current example
public class gsonTest {
public static void main(String[] args) {
Response r = new Response().add(new B()).add(new A());
Gson gson = new GsonBuilder().create();
System.out.println(gson.toJson(r, r.getClass()));
}
public static class Response {
Vector<A> a = new Vector<A>();
public Response add(A aa) {
a.add(aa);
return this;
}
}
public static class A {
int A = 1;
}
public static class B extends A {
int B = 2;
}
}
produce
{"a":[{"A":1},{"A":1}]}
instead
{"a":[{"A":1},{"A":1,"B":2}]}
tested on mac/linux/win 1.6 jvm and 1.7.1 gson lib.
Original issue reported on code.google.com by ramarr...@gmail.com on 4 May 2011 at 1:47
Original issue reported on code.google.com by
ramarr...@gmail.com
on 4 May 2011 at 1:47