users@jaxb.java.net

cyclic inheritance

From: Han Ming Ong <hanming_at_mac.com>
Date: Tue, 04 Mar 2003 15:44:58 -0800

Sorry if this has been discussed, I searched the archive and didn't
find what I need:

In SampleApp6, I noticed that if I used an 'annoymous' complexType for
the element purchaseOrder, I would get the following error:

     [javac]
/Users/Shared/Library/java/jaxb/examples/users-guide/SampleApp6/primer/
myPo/PurchaseOrderElement.java:66: cyclic inheritance involving
primer.myPo.PurchaseOrderElement
     [javac] public interface POType {
     [javac] ^

Here's the relevant schema change:

...
<xsd:element name="purchaseOrder">
<xsd:complexType>
   <xsd:annotation>
   <xsd:appinfo>
     <jxb:class name="POType">
       <jxb:javadoc>
       A &lt;b>Purchase Order&lt;/b> consists of addresses and items.
        </jxb:javadoc>
     </jxb:class>
   </xsd:appinfo>
   </xsd:annotation>

   <xsd:sequence>
     <xsd:element name="shipTo" type="USAddress"/>
     <xsd:element name="billTo" type="USAddress"/>
     <xsd:element ref="comment" minOccurs="0"/>
     <xsd:element name="items" type="Items"/>
   </xsd:sequence>
   <xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
</xsd:element>
...

of course, it used to be just

<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>

with an explicit named complexType declaration later.

Question: is this only a problem on Mac OS X? I don't have a PC or
Solaris to try this out.

thanks much.
ps: I know the workaround; just curious.