[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-j-user
Subject: Re: strange annotation inheritance
From: Alexey Loubyansky <alex () jboss ! com>
Date: 2005-11-02 11:47:37
Message-ID: 4368A759.1000207 () jboss ! com
[Download RAW message or body]
Thanks a lot, Michael!
Michael Glavassevich wrote:
> Hi Alexey,
>
> You've found a bug. It arises when a sub-type appears before its base type
> in the schema document and was caused by a field which wasn't being
> cleared. It's a one line fix. Just checked it into SVN. You can work
> around the problem when using 2.7.0 by moving the type declaration for
> "parameterType" to the bottom of the schema document.
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Alexey Loubyansky <alex@jboss.com> wrote on 11/01/2005 09:47:20 AM:
>
>
>>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: j-users-unsubscribe@xerces.apache.org
>>For additional commands, e-mail: j-users-help@xerces.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic