Adding features to superclass can trip up synchronization between JCas class and type system
- Dominant language
- Java
- Stars
- 71
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
**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
Contributor guide
Research direction
Start in FSClassRegistry.java at updateOrValidateAllCallSitesForJCasClass, then reproduce the two type-system loading sequences described in the issue with MySuper, MySub, x, y, and z. Trace how feature offsets are assigned across the JCas class hierarchy. Done means JCas features retain consistent offsets while type-system-only features are assigned afterward, without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100