I've defined a mapping in my binding like this:
<mapping name="Application" class="Application">
<collection name="MandatoryComponents" create-type="java.util.ArrayList" item-type="ComponentInstance" get-method="getMandatoryComponentInstances" set-method="addMandatoryComponentInstances"/>
I noticed in the bytecode enhanced Application class, the generated unmarshalling method becomes:
public final Application JiBX_application_unmarshal_1_1(UnmarshallingContext arg1)
It turns out that the my method getMandatoryComponentInstances(), I am returning an unmodifiable Collection. I do not return null if the collection is empty. When I run my unmarshalling testcase, I will get an UnsupportedOperationException because you cannot add to the collection my method returns.
It seems to me it would be wrong to assume my get-method will return something you can add to. Furthermore, why is the get-method being used for unmarshalling? I already specified a create-type="java.util.ArrayList", so why not just instantiate one of those?