Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355970 - JAXBException with @XmlElementRefs use case
Summary: JAXBException with @XmlElementRefs use case
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Denise Smith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 355544 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-26 14:40 EDT by Paul Fullbright CLA
Modified: 2022-06-09 10:07 EDT (History)
3 users (show)

See Also:


Attachments
Proposed changes and test (14.44 KB, patch)
2011-09-15 13:43 EDT, Denise Smith CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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