users@jaxb.java.net

Re: mixed="true", JAXBElement and List<Serializable>

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 09 Jun 2006 17:59:15 -0700

Kenny MacLeod wrote:
> Folks,
>
> Take the following schema fragment:
>
> <xs:complexType name="MyMixedType" mixed="true">
> <xs:sequence>
> <xs:element name="inner" type="MyInnerType" minOccurs="0" maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
>
> <xs:complexType name="MyInnerType">
> <xs:simpleContent>
> <xs:extension base="xs:string"/>
> </xs:simpleContent>
> </xs:complexType>
>
>
> When passed through XJC, the MyMixedType class will have a List<Serializable> property. However,
> because MyInnerType isn't Serializable, you have to wrap instances of MyInnerType in JAXBElement
> before adding them to MyMixedType's list.
>
> This isn't very nice behaviour, given JAXB2's pojo-friendly emphasis. Why doesn't XJC generate
> List<Object> instead?

I think this is an anomaly in the common base type computation algorithm.

Can you file a bug for this?

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com