uima-uimaj icon indicating copy to clipboard operation
uima-uimaj copied to clipboard

Adding features to superclass can trip up synchronization between JCas class and type system

Open reckart opened this issue 1 year ago • 0 comments

Describe the bug The JCas classes have an "offset" assigned to their features. When committing a type system, these offsets are set the first time a type system is committed and validated on subsequent type system commits. This can cause problems if the type systems contain different numbers of features for a given type.

To Reproduce Steps to reproduce the behavior:

  1. Define a type MySuper with a feature x
  2. Define a type MySub with a feature z
  3. Generate JCas classes for both
  4. Load the type system description that defines the two types and add another feature y to MySuper
  5. Create a new JCas instance that uses the type system description from step 4
  6. Create a new JCas instance that uses the original type system description that does not contain y
  7. This should generate an error like
Caused by: org.apache.uima.UIMA_IllegalStateException: Loaded JCas Type MySub has feature z with two different type systems having different offsets; this is not supported.
     at org.apache.uima.cas.impl.FSClassRegistry.updateOrValidateAllCallSitesForJCasClass(FSClassRegistry.java:1662)
     ... 125 more

Expected behavior When assigning feature offsets to be used in JCas classes, all features that are actually part of the JCas class should always be assigned first through the entire JCas class hierarchy. Offsets for features defined in the type system description but not in the JCas class should always be assigned afterwards. Features that are defined in the JCas class but not in the type system description should still get assigned an offset to ensure that their offset is not consumed by the time another type system is loaded that might include the feature.

Please complete the following information:

  • Version: 3.5.1

reckart avatar Sep 11 '24 15:09 reckart