title: com.sun.istack.SAXException2 : Instance ... is substituting "java.lang.Object", but ... is bound to an anonymous type
body: <p>I'm upgrading a project to jaxb 2.2.7 from version 1.x.</p>
  
  <p>I've got the app working some of the time, but on some responses I see this:</p>
  
  <pre><code>java.lang.RuntimeException: javax.xml.bind.MarshalException
  - with linked exception:
  [com.sun.istack.SAXException2: Instance of "com.mycompany.global.er.decoupling.binding.response.PricePointType$BalanceImpactRates$BalanceImpactRate" 
  is substituting "java.lang.Object", but 
  "com.mycompany.global.er.decoupling.binding.response.PricePointType$BalanceImpactRates$BalanceImpactRate"
   is bound to an anonymous type.]
  </code></pre>
  
  <p>This worked fine in jaxb 1.0.  I've no idea what the problem could be.  </p>
  
  <p>Here's an extract from the xsd (which I can't change, since clients are using it):</p>
  
  <pre><code>&lt;xs:complexType name="price-pointType"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="id" type="xs:string" /&gt;
  .........
          &lt;xs:element name="duration" type="durationType" /&gt;
          &lt;xs:element name="order" type="xs:int" /&gt;
          &lt;xs:element name="min-sub-period" type="xs:int" /&gt;
          &lt;xs:element name="balance-impacts" minOccurs="0"&gt;
              &lt;xs:complexType&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element name="balance-impact" type="charging-resourceType"
                          minOccurs="0" maxOccurs="unbounded" /&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
          &lt;xs:element name="balance-impact-rates" minOccurs="0"&gt;
              &lt;xs:complexType&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element name="balance-impact-rate" minOccurs="0"
                          maxOccurs="unbounded"&gt;
                          &lt;xs:complexType&gt;
                              &lt;xs:sequence&gt;
                                  &lt;xs:element name="rate" type="xs:double" /&gt;
                              &lt;/xs:sequence&gt;
                              &lt;xs:attribute name="charging-resource-code" type="xs:string"
                                  use="required" /&gt;
                          &lt;/xs:complexType&gt;
                      &lt;/xs:element&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
  </code></pre>
  
  <p>Any suggestions?</p>