Hello!

I am seeing weird inheritance of annotations in 2.7.0.

Have a look at the following schema

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
            targetNamespace="urn:jboss:bean-deployer"
            xmlns="urn:jboss:bean-deployer"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            version="1.0">

  <!-- comment this type out to fix annotations -->
   <xsd:complexType name="parameterType">
      <xsd:annotation>
      </xsd:annotation>
      <xsd:complexContent>
         <xsd:extension base="annotatedValueType"/>
      </xsd:complexContent>
   </xsd:complexType>

   <xsd:complexType name="plainValueType">
      <xsd:annotation>
      </xsd:annotation>
   </xsd:complexType>

   <xsd:complexType name="valueType">
      <xsd:annotation>
      </xsd:annotation>
      <xsd:complexContent>
         <xsd:extension base="plainValueType"/>
      </xsd:complexContent>
   </xsd:complexType>

   <xsd:complexType name="annotatedValueType">
      <xsd:annotation>
      </xsd:annotation>
      <xsd:complexContent>
         <xsd:extension base="valueType"/>
      </xsd:complexContent>
   </xsd:complexType>
</xsd:schema>     

And the following code that prints the number of annotations

XSComplexTypeDefinition type = (XSComplexTypeDefinition)model.getTypeDefinition("plainValueType", ns);
System.out.println("plainValueType: " + type.getAnnotations().getLength());
type = (XSComplexTypeDefinition)model.getTypeDefinition("valueType", ns);
System.out.println("valueType: " + type.getAnnotations().getLength());
type = (XSComplexTypeDefinition)model.getTypeDefinition("annotatedValueType", ns); System.out.println("annotatedValueType: " + type.getAnnotations().getLength());

The result that I see is

plainValueType: 4
valueType: 3
annotatedValueType: 2

So, plainValueType actually gets annotations of its subclasses. If I comment out parameterType definition then the output is

plainValueType: 1
valueType: 1
annotatedValueType: 1

Any ideas?

Thanks,

alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to