jaxb-v2
jaxb-v2 copied to clipboard
JAXB does not support java.time.* types
This refers to JDK issue https://bugs.openjdk.java.net/browse/JDK-8016742
FULL PRODUCT VERSION : java version " 1.8.0-ea " Java(TM) SE Runtime Environment (build 1.8.0-ea-b93) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b34, mixed mode)
ADDITIONAL OS VERSION INFORMATION : Windows 7 64-bit
A DESCRIPTION OF THE PROBLEM : There needs to be java.time support in JAXB. I have a POJO with an @XmlElement " lastModified " of type java.time.Instant, and it just gets printed out <lastModified /> (the value is ignored). It should be printed out ISO 8601-formatted (Instant.toString()). This should be the case for all ISO 8601-representable java.time types.
REPRODUCIBILITY : This bug can be reproduced always.
Unfortunately, unlike JDBC, JAXB doesn't seem to support the new Date & Time API out-of-the-box.
Eg. there are no according methods in DatatypeConverter to easily create custom JAXB bindings: https://docs.oracle.com/javase/10/docs/api/javax/xml/bind/DatatypeConverter.html