eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
203 stars 111 forks source link

Proporder doesn't recogonize property if it is inherited #993

Open Tomas-Kraus opened 10 years ago

Tomas-Kraus commented 10 years ago

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]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 10 years ago

@glassfishrobot Commented Reported by kavai

Tomas-Kraus commented 10 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-993