Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
When UIMAv3 parses an XMI file and encounters a feature value which has a typed FSArray (e.g. FSArray with element type ...Token), then it deserializes this by default as an array subtype. This means the UIMA Type object bound to the generated FSArray instance is not simply the type for FSArray (where getName() returns "FSArray") but rather a special type which returns e.g. Token[] from getName().
However, when creating FSArray instances in regular code, this is typically done using new FSArray(...). In this case, a plain FSArray is created which identifies itself as FSArray via getType().getName().
One effect of this is that any approach of comparing annotations which uses internally calls Type.getName() may find that an array obtained from the XMI file is different from an array that was freshly created by our components - because the XMI one might identify itself to be a Token[] and the freshly created one might identify itself as FSArray - even though they are otherwise equivalent (same content, same functionality, etc.).
As a temporary workaround, the creation of FSArray subtypes can be globally disabled by setting the system property uima.disable_subtype_fsarray_creation (CASImpl.DISABLE_SUBTYPE_FSARRAY_CREATION).
I haven't found a way to actually create these subtypes in the UIMA API. I can see it being done during deserialization, but I have no idea how to do it when programmatically creating feature structures.