Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355970

Summary: JAXBException with @XmlElementRefs use case
Product: z_Archived Reporter: Paul Fullbright <paul.fullbright>
Component: EclipselinkAssignee: Denise Smith <denise.mahar>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: blaise.doughan, denise.mahar, eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed changes and test none

Description Paul Fullbright CLA 2011-08-26 14:40:41 EDT
(Occurs in 2.4 dev stream)

The following model:

@XmlRootElement(name="root")
public class Root {

	@XmlElementRefs({
			@XmlElementRef(name = "foo", type = Foo.class),
			@XmlElementRef(name = "bar", type = Bar.class)
		})
	public List content = new ArrayList();
}


@XmlRootElement(name="foo")
@XmlSeeAlso(SubFoo.class)
public class Foo {}


@XmlRootElement(name="subfoo")
public class SubFoo extends Foo {}


@XmlRootElement(name="bar")
@XmlSeeAlso(SubBar.class)
public class Bar {}


@XmlRootElement(name="subbar")
public class SubBar extends Bar {}


throws a JAXBException on marshalling (using Root.class as the context).

This works with the RI and generates an XML file of the form:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
    <foo/>
    <subfoo/>
    <bar/>
    <subbar/>
</root>
Comment 1 Denise Smith CLA 2011-09-15 13:43:45 EDT
Created attachment 203428 [details]
Proposed changes and test
Comment 2 Denise Smith CLA 2011-09-15 14:04:47 EDT
Fixed in AnnotationsProcessor.  Checked in to 2.3.1 and 2.4
Comment 3 Denise Smith CLA 2011-09-15 14:07:05 EDT
*** Bug 355544 has been marked as a duplicate of this bug. ***
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:03:22 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:07:41 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink