google/gson

java.util.date Java 11 vs Java 8 different serialization

Opened this issue · 6 comments

I don't know what to make of this, whether its a bug or not - but I think its worth mentioning. If you serialize a java.util.Date object, this is what you get with gson 2.8.0

Java 8 {"creationDate":"Jun 10, 2020 11:13:39 AM"}
Java 11 {"creationDate":"Jun 10, 2020, 11:14:17 AM"}

see the extra , after the year? Java 11 serialized java.util.Date is not deserializable in Java 8.

Java 11 serialized java.util.Date is not deserializable in Java 11.

You probably meant "Java 8", right? The date format change comes from the JDK, see #1210.
It appears #1682 already describes the incompability issues you are describing here.

Is this still open?...Can I work on this?

Probably it's related to the CLDR version included in the JDK.
Here you can find some information: Link.

has been fixed ?

@Jarvan-Song, not as far as I know. In general it might be good to avoid the default Gson date format though and choose a stable and machine readable one, see also this Stack Overflow question.

@Jarvan-Song, not as far as I know. In general it might be good to avoid the default Gson date format though and choose a stable and machine readable one, see also this Stack Overflow question.

thanks