-
1. Re: Collections with interfaces
starksm64 Oct 21, 2007 11:23 PM (in response to starksm64)This is due to this code block not checking the localPropertyType for the XmlType annotation:
else if (propertyType.isCollection() && ((ClassInfo) propertyType).getUnderlyingAnnotation(XmlType.class) == null) { isCol = true; propertyHandler = new CollectionPropertyHandler(property, propertyType); ClassInfo typeArg = (ClassInfo) findComponentType(property); //if (((ClassInfo) typeArg).getUnderlyingAnnotation(XmlType.class) != null) if (typeArg != null && typeArg.getUnderlyingAnnotation(JBossXmlModelGroup.class) == null) {// it may be a model group in which case we don't want to change the type // TODO yes, this is another hack with collections JBossXmlChild xmlChild = ((ClassInfo) propertyType).getUnderlyingAnnotation(JBossXmlChild.class); if (xmlChild == null && localPropertyType.equals(propertyType)) { // the localPropertyType was not overriden previously so use the collection parameter type localPropertyType = typeArg; } } }
when the property type is a parameterized interface, the localPropertyType refers to the real type that carries the annotation information. Changing the check to be:else if (propertyType.isCollection() && ((ClassInfo) localPropertyType).getUnderlyingAnnotation(XmlType.class) == null) {
gets the parsing to occur as I expect. -
2. Re: Collections with interfaces
aloubyansky Oct 22, 2007 5:49 AM (in response to starksm64)It introduced regression in the testsuite. It used be 8 errors and 8 failures. Now it's
Tests run: 651, Failures: 7, Errors: 180, Skipped: 0 -
3. Re: Collections with interfaces
starksm64 Oct 22, 2007 7:45 AM (in response to starksm64)Something else caused the regressions as I saw the same error counts with/without this change.
-
4. Re: Collections with interfaces
aloubyansky Oct 22, 2007 7:51 AM (in response to starksm64)I am sure it's this change.
I am looking into the issue with the interfaces. To start, I added @XmlTransient to getEnterpriseBeansMetaData on IEnterpriseBeanMetaData. -
-
6. Re: Collections with interfaces
wolfc Oct 22, 2007 8:11 AM (in response to starksm64)I was also looking at trying to add XmlTransient to getEnterpriseBeansMetaData on IEnterpriseBeanMetaData. The actual problem is that JBossMetaData.setEnterpriseBeans doesn't define a class. I've fixed that.
-
7. Re: Collections with interfaces
aloubyansky Oct 22, 2007 8:31 AM (in response to starksm64)There should be a CCE since XB uses ArrayList as the default collection impl.
-
8. Re: Collections with interfaces
aloubyansky Oct 22, 2007 8:40 AM (in response to starksm64)The CCE happens if I rollback Scott's change. It's the same problem with collections we had, i.e. we cannot specify the collection impl we want to use currently. It's easy to fix though by adding a new annotation.
-
9. Re: Collections with interfaces
aloubyansky Oct 22, 2007 10:11 AM (in response to starksm64)I added @JBossXmlCollection annotation and bound JBossMetaData.enterpriseBeans to JBossEnterpriseBeansMetaData.
-
10. Re: Collections with interfaces
starksm64 Oct 22, 2007 5:28 PM (in response to starksm64)With your changes these are the errors I'm seeing:
Tests run: 651, Failures: 20, Errors: 9, Skipped: 0
Is that what you have? -
11. Re: Collections with interfaces
starksm64 Oct 22, 2007 8:56 PM (in response to starksm64)I thought this was working, but when I updated another workspace the same incompatible type was seen. I checked the JBossMetaData but did not see the @JBossXmlCollection in use, so I added that and the tests are working again. Perhaps you forgot to commit this or it failed due to other changes. I have checked these changes in.
-
12. Re: Collections with interfaces
aloubyansky Oct 23, 2007 7:20 AM (in response to starksm64)Yes, perhaps, it failed to commit. Thanks for fixing.
-
13. Re: Collections with interfaces
starksm64 Oct 23, 2007 8:24 PM (in response to starksm64)I needed to add an elementType to JBossXmlCollection to allow for the specification of the collection element type for collections of unparameterized interfaces like:
@XmlType(name="service-refType") public class JBossServiceReferencesMetaData extends AbstractMappedMetaData<IServiceReferenceMetaData> implements IServiceReferencesMetaData { ...
so one can define both the collection class, and its concrete element type:@JBossXmlCollection(type=JBossServiceReferencesMetaData.class, elementType=JBossServiceReferenceMetaData.class) @XmlElement(name="service-ref") public void setServiceReferences(IServiceReferencesMetaData serviceReferences) { this.serviceReferences = (JBossServiceReferencesMetaData) serviceReferences; }
Can you check its use in the JBossXBNoSchemaBuilder? There was one location where I was not clear on whether this should override the localPropertyType. -
14. Re: Collections with interfaces
aloubyansky Oct 24, 2007 2:19 AM (in response to starksm64)Collection item should be specified with @XmlElement.type. If it didn't work it's a bug.