Status for this request:
Preference is for javax.xml.bind.JAXBElement and schema derived generated value
classes to follow the same methodology for equals.
Note that under certain circumstances, JAXB 2.0 RI is generating schema-derived
value classes annotated with @XmlRootElement. Independent of whether a JAXB
element is represented either as an instance of javax.xml.bind.JAXBElement or it
is generated as a value class annotated with @XmlRootElement, the current status
quo ensures both are using identity for equality comparisons.
I would be fine with both JAXBElement and @XmlRootElement class using values for
comparisons, but the feedback that I am receiving from RI team is they don't
want to see the specification specify value based equality for schema-derived
Minimally, if JAXBElement.equals was to implement value equality, JAXB 2.0 would
need to provide a customization to control whether schema-derived value classes
had equality by value or by identity. Otherwise, the JAXB 2.0 specification is
inconsistent by default and user has no ability to make it consistent:
JAXBElement.equal being by value, schema-derived classes being by identity and
only with a non-specified customization, does schema-derived value classes
generate a value-based equals that is equivalent to JAXBElement.equal.