| Summary: | XmlAccessorType is not being inherited by sub classes | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Karen Butzke <karenfbutzke> | ||||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | blaise.doughan, matt.macivor | ||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
To make this what I think is a valid use case, set @XmlAccessorType(XmlAccessType.NONE) on the package-info.java and remove it from the Y class. @XmlTransient is mutually exclusive with all other jaxb annotations. Should Dali have a validation error if any annotation is used with @XmlTransient? And should MOXy have an error or just ignore other annotations? I have realized that the bug here is how attributes are generated into derived classes of XmlTransient classes. It appears that they are always generated with PUBLIC_MEMBER access no matter what access is set on the XmlTransient on the derived class or in the package-info.java. The spec doesn't appear to address this use case. The reference implementation uses the access type of the derived class for determining what attributes are generated into the schema for the transient class. This seems reasonable to me. If no access type is set on the derived class then it uses the access type that is set on the XmlTransient class. I am unsure if that last bit of behavior is correct since the XmlTransient annotation states that '@XmlTransient is mutually exclusive with all other JAXB defined annotations.' Created attachment 189727 [details]
Code demonstration issue.
The issue is that subclasses without an XmlAccessorType specified are not inheriting the XmlAccessorType specified on the super classes. Created attachment 190776 [details]
Proposed fix and test case
Created attachment 190786 [details]
Updated fix.
Attached patch has been checked in to SVN The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Generate a schema using MOXy with the following 4 classes. @XmlType public class Z { public int zAttribute; } @XmlTransient @XmlAccessorType(XmlAccessType.NONE) public class Y extends Z { public int yAttribute; } @XmlType @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) public class X extends Y { public int xAttribute; } @XmlType public class X2 extends Y { public int copyOfXAttribute; } The x2 complex type is generated: <xsd:complexType name="x2"> <xsd:complexContent> <xsd:extension base="z"> <xsd:sequence> <xsd:element name="yAttribute" type="xsd:int"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> I don't think it should have generated the "yAttribute" element because the access type has been set to NONE in the parent class Y