Community
Participate
Working Groups
Steps to reproduce issue: **Root** package example; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @XmlRootElement public class Root { @XmlJavaTypeAdapter(AAdapter.class) public A<B> a; } **A** package example; public class A<T> { public T t; } **AAdapter** package example; import javax.xml.bind.annotation.adapters.XmlAdapter; public class AAdapter<T> extends XmlAdapter<T, A<T>> { @Override public A<T> unmarshal(T v) throws Exception { return new A<T>(); } @Override public T marshal(A<T> v) throws Exception { return v.t; } } **B** package example; public class B { } **Demo** package example; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Root.class, B.class); Root root = new Root(); A<B> a = new A<B>(); a.t = new B(); root.a = a; Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(root, System.out); } } **Output** <?xml version="1.0" encoding="UTF-8"?> <root> <a>example.B@3ecfff</a> </root> **Expected Output** <?xml version="1.0" encoding="UTF-8"?> <root> <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="b"/> </root>
Created attachment 199285 [details] Proposed Fix and Test Cases
Attached patch has been checked in to SVN Reviewed by Blaise Doughan.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink