Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339268 - Incorrect schema generation of methods that don't have a corresponding setter
Summary: Incorrect schema generation of methods that don't have a corresponding setter
Status: RESOLVED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Blaise Doughan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 13:44 EST by Karen Butzke CLA
Modified: 2022-06-09 10:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2011-03-08 13:44:40 EST
@XmlType
public class Employee {

	private Collection<String> foos;
	private int bar;
	
	public Collection<String> getFoos() {
		return foos;
	}
	
	public int getBar() {
		return bar;
	}
}

EclipseLink schema generation generates elements for both foos and bar. The metro implementation does not since neither of them have a corresponding setter. If getFoos() returns a List instead of a collection, then the foos element should be generated.
Comment 1 Blaise Doughan CLA 2011-05-06 15:31:08 EDT
From section B.5 "Getters/Setters" of the JAXB 2.2 spec:

"Unmarshalling : A property must have a setter method if
• @XmlAccessorType.PUBLIC_MEMBER or @XmlAccessorType.PROPERTY applies to the property.
• or if the property’s getter/setter method is annotated with a mapping
annotation."

MOXy Interpretation:
That means that if a setter is present the property should be unmarshalled

"Marshalling: A property must have a getter method if
• @XmlAccessType.PUBLIC_MEMBER or
@XmlAccessType.PROPERTY applies to the class
• or if the property’s getter/setter method is annotated with a mapping
annotation."

MOXy Interpretation:
That means that if a getter is present the property should be marshalled

Decision:
Since the presence of only a getter or setter affects marshalling/unmarshalling then those properties should be reflected in the XML schema.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:05:41 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink