[ 
https://issues.apache.org/jira/browse/XMLSCHEMA-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexandr Klimov updated XMLSCHEMA-30:
-------------------------------------

    Attachment: sample_proj.zip

> Each type from W3C base schema (http://www.w3.org/2001/XMLSchema) is equals 
> to each other
> -----------------------------------------------------------------------------------------
>
>                 Key: XMLSCHEMA-30
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-30
>             Project: XmlSchema
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3, 2.0.4
>         Environment: Oracle JDK-1.6
> Oracle JDK-1.7
>            Reporter: Alexandr Klimov
>            Priority: Critical
>              Labels: XmlSchemaType, comparison, equals, hashCode
>         Attachments: sample_proj.zip
>
>
> h2. MAIN DESCIPRTION
> At this time, all simple types of the base xml schema _( W3C Schema has 
> namesapce http://www.w3.org/2001/XMLSchema )_ *always equlals to each other* 
> from point of view *Object@equals* method, but they have different hash codes.
> I've attched a simple sample_proj.zip project to be more clean.
> Such situation *may lead to wrong behaviour* of some Set or Map 
> implementations.
> F.e. ImmutableSet of Guava project doesn't copy all items from 
> java.util.HashSet over creation operation _( ImmutableSet#copyOf )_
> *Moreover*, such behaviuor isn't in accordance with [Oracle 
> rules|http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()]
> h2. DETAILS
> Comparison of a XmlSchemaType (both simple and complex) is performed by 
> *XmlSchemaObject#equals* method.
> This method takes in account folowing properties of a XmlSchemaObject:
> * lineNumber
> * linePosition
> * sourceURI
> But all base W3C xsd types _(namespace http://www.w3.org/2001/XMLSchema )_ 
> has one peculiarity: all the above properties is not set throughout base W3C 
> schema creation.
> *XmlSchemaCollection#addSimpletype* method is responsible for creation all 
> these base schema simple types.
> In result, all these "synthatic" types may be distinguished by they QNames 
> only.
> h2. SIGGESTION
> I suggest to override *equals* method on *XmlSchemaType* class with taking in 
> account its *namedDelegate* field comparison result.
>  



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to