| Summary: | schema generation with annotated static field is incorrect | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Karen Butzke <karenfbutzke> | ||||||
| Component: | Eclipselink | Assignee: | Matt MacIvor <matt.macivor> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | matt.macivor | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Looks like this is working for private static final attributes, but not for private static. Created attachment 185808 [details]
Propsed fix.
Created attachment 186012 [details]
Updated fix. Statics mapped to attributes need to be writeOnly.
Attached patch checked in to SVN Reviewed by David McCann The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
I am testing around with XmlAccessType.PUBLIC_MEMBER and hit a case where EclipseLink does not generate an attribute in the schema, but I think it should and the jdk does. foo8 a private static field annotated with @XmlAttribute does not have an attribute generated in the schema. @XmlType //@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) - default public class EmployeePublicMember { public int foo; //persistent public final int foo1 = 1; //persistent public transient int foo2; //not persistent public static int foo3; //not persistent public static final int foo4 = 4; //not persistent @XmlTransient public int foo5; //not "persistent", but comes in to Dali context model because it's "mapped" @XmlAttribute private int foo6;//persistent // @XmlAttribute // private transient int foo7; //persistent, but invalid @XmlAttribute private static int foo8; //persistent @XmlAttribute private static final int foo9 = 9; // persistent } EclipseLink generates: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="employeePublicMember"> <xsd:sequence> <xsd:element name="foo" type="xsd:int"/> <xsd:element name="foo1" type="xsd:int"/> </xsd:sequence> <xsd:attribute name="foo6" type="xsd:int" use="required"/> <xsd:attribute name="foo9" type="xsd:int" use="required" fixed="9"/> </xsd:complexType> </xsd:schema> JDK generates: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="employeePublicMember"> <xs:sequence> <xs:element name="foo" type="xs:int"/> <xs:element name="foo1" type="xs:int"/> </xs:sequence> <xs:attribute name="foo6" type="xs:int" use="required"/> <xs:attribute name="foo8" type="xs:int" use="required"/> <xs:attribute name="foo9" type="xs:int" use="required"/> </xs:complexType> </xs:schema>