| Summary: | Interfaces unneccessarily excluded from annotation processing | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> | ||||||||||||||||
| Component: | Eclipselink | Assignee: | Blaise Doughan <blaise.doughan> | ||||||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||||||
| Severity: | normal | ||||||||||||||||||
| Priority: | P3 | CC: | eclipselink.oxm-inbox, karenfbutzke | ||||||||||||||||
| Version: | unspecified | ||||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||
| OS: | Windows XP | ||||||||||||||||||
| Whiteboard: | |||||||||||||||||||
| Attachments: |
|
||||||||||||||||||
Created attachment 174858 [details]
MOXy - Fix
Created attachment 174871 [details]
MOXy - Fix
Created attachment 174880 [details]
MOXy - Test Cases
Created attachment 174976 [details]
MOXy - Test Cases
Created attachment 174977 [details]
MOXy - Fix
Blaise, isn't this an enhancement, I'm curious how it can go in a maintenance release? (In reply to comment #6) > Blaise, isn't this an enhancement, I'm curious how it can go in a maintenance > release? Not really an enhacement, just a one line change to enable this functionality. Now interfaces aren't excluded from annotation process. When using interfaces you must set up a corresponding ObjectFactory. Fix checked into 2.1.1 at rev: 7890 Fix checked into trunk at rev: 7891 I don't think it matters that the enhancement is simple to implement, it is still new functionality. Thinking in terms of future Dali support, if we were to support interfaces in the next release we would have to have a 2.1.0 platform that doesn't support them and a specific 2.1.1+ platform that does. Problem encountered with the fix. There may be cases where a property type is an interface but it will have values of objects that implement that interface and therefore there does not need to be a way to instantiate an instance of that interface. Created attachment 175503 [details]
MOXy - Fix (to address issue for re-opening)
Created attachment 175508 [details]
MOXy - Test Cases (to test issue for re-opening)
Amended fix checked into: - 2.1.1 at revision: 7949 - trunk at revision: 7950 The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
EclipseLink MOXy should support: package example.interfaces; import java.io.FileInputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); FileInputStream xml = new FileInputStream("src/example/interfaces/input.xml"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Customer customer = (Customer) unmarshaller.unmarshal(xml); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(customer, System.out); } } For the interface: package example.interfaces; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.eclipse.persistence.oxm.annotations.XmlCustomizer; import example.interfaces.metadata.InterfaceCustomizer; @XmlRootElement() @XmlCustomizer(InterfaceCustomizer.class) @XmlType(propOrder={"name", "address"}) public interface Customer { String getName(); void setName(String name); Address getAddress(); void setAddress(Address address); public List<PhoneNumber> getPhoneNumbers(); public void setPhoneNumbers(List<PhoneNumber> phoneNumbers); }