Community
Participate
Working Groups
@XmlList on an array property is not being processed when bootstrapping via TypeMappingInfo. The following test case can be used to reproduce the issue: ----- public class XmlListTest { @XmlList public static Float[] f = new Float[] { 3.14f }; public static void main(String[] args) throws Exception { TypeMappingInfo ti = new TypeMappingInfo(); ti.setXmlTagName(new QName("FooFloatListType")); ti.setType(Float[].class); ti.setElementScope(ElementScope.Global); JAXBContext ctx = JAXBContextFactory.createContext( new TypeMappingInfo[] { ti }, new HashMap<Object, Object>(), Thread.currentThread().getContextClassLoader()); JAXBElement<Float[]> elt = new JAXBElement<Float[]>( ti.getXmlTagName(), Float[].class, f); JAXBMarshaller jm = (JAXBMarshaller) ctx.createMarshaller(); StreamResult result = new StreamResult(System.out); jm.marshal(elt, result, ti); } } ----- If @XmlList is handled properly we would expect: <FooFloatListType><item>3.14 3.25</item></FooFloatListType> But instead get: <FooFloatListType><item>3.14</item><item>3.25</item></FooFloatListType>
Created attachment 186416 [details] Proposed fix + supporting testcase
Created attachment 186418 [details] Proposed fix + supporting test case
Reviewed by: matt.macivor@oracle.com Tests: jaxb/typemappinginfo/arraywithannotations/ArrayWithAnnotationsTestCases; all unit tests pass as expected Revision: 8794
Fixed.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink