| Summary: | @XmlElementRef should support not specifying a name for abstract type with @XmlRootElements | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Paul Fullbright <paul.fullbright> |
| Component: | Eclipselink | Assignee: | Denise Smith <denise.mahar> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | blaise.doughan, denise.mahar, eclipselink.oxm-inbox |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
*** This bug has been marked as a duplicate of bug 355970 *** Is this really a duplicate? The problem with the other use case was that the JAXB context wasn't including other types (I think). Here there is an error if the user doesn't specify a name, which isn't used anyway. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
For the following object model: @XmlRootElement(name="root") public class Root { @XmlElementRef(type=Foo.class) public List foos; } @XmlSeeAlso({ FooA.class, FooB.class }) public abstract class Foo { @XmlValue public String value; } @XmlRootElement(name="foo-a") public class FooA extends Foo {} @XmlRootElement(name="foo-b") public class FooB extends Foo {} when attempting to marshal a document, I get the following exception: javax.xml.bind.JAXBException: Exception Description: Invalid XmlElementRef on property foos on class jaxbtest.model.Root. Referenced Element not declared. ... This is pretty much Example 1 (Ant Task example) (except the type is specified in the @XmlElementRef annotation, not the java field) in the @XmlElementRef javadocs, and is fully supported with Metro.