Whenever I inherit a property from a base-class, propOrder doesn't recognize it, and throws an exception:
Exception in thread "main" com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Property traceId appears in @XmlType.propOrder, but no such property exists.
at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
...
Example to reproduce:
----------------------PropOrderDemo.java---------------------------------
public class PropOrderDemo
{
public static void main(String[] args) throws Exception
)
@javax.xml.bind.annotation.XmlRootElement
@javax.xml.bind.annotation.XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.PROPERTY)
public class FaultObject extends AbstractTraceableObject
{
private int traceId;
public FaultObject()
{
}
public FaultObject(int traceId)
{ this.traceId = traceId; }
@Override public int getTraceId()
{ return this.traceId; }
@Override public void setTraceId(int traceId)
{ this.traceId = traceId; }
}
--------------------------AbstractTraceableObject.java--------------------------------------
public class AbstractTraceableObject
{
public int getTraceId()
Whenever I inherit a property from a base-class, propOrder doesn't recognize it, and throws an exception:
Exception in thread "main" com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Property traceId appears in @XmlType.propOrder, but no such property exists. at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106) ...
Example to reproduce: ----------------------PropOrderDemo.java--------------------------------- public class PropOrderDemo { public static void main(String[] args) throws Exception
{ javax.xml.bind.JAXBContext jaxbContext = javax.xml.bind.JAXBContext.newInstance(FaultObject.class); javax.xml.bind.Marshaller marshaller = jaxbContext.createMarshaller(); FaultObject exception = new FaultObject(13); marshaller.marshal(exception, System.out); }
}
----------------------FaultObject.java---------------------------------
@javax.xml.bind.annotation.XmlType(propOrder =
{ "traceId" }
) @javax.xml.bind.annotation.XmlRootElement @javax.xml.bind.annotation.XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.PROPERTY) public class FaultObject extends AbstractTraceableObject { private int traceId;
public FaultObject() { }
public FaultObject(int traceId)
{ this.traceId = traceId; }
@Override public int getTraceId() { return this.traceId; }
@Override public void setTraceId(int traceId) { this.traceId = traceId; }
}
--------------------------AbstractTraceableObject.java-------------------------------------- public class AbstractTraceableObject { public int getTraceId()
{ return 0; }
public void setTraceId(int traceId) { } }
Environment
Ubuntu, jdk1.6.0_45
Affected Versions
[2.2.7]