reckart opened a new issue, #384:
URL: https://github.com/apache/uima-uimaj/issues/384

   **Describe the bug**
   Let's assume with have a CAS with two types, `T` and `S` where `S` is a 
subtype of `T`.
   
   **To Reproduce**
   Now let's assume we are in a PEAR that brings along its own version of the 
`T` JCas class (let's call it `T_p`).
   
   When the code in the PEAR does a `for var T : select(T.class)` (which 
actually selects `T_p` and that select returns an `S`, that leads to a class 
cast exception because `S` cannot be cast to `T_p`.
   
   **Expected behavior**
   It would probably be a good idea to add a filter to `select(class)` to 
ensure that the values it returns are actually compatible with `class` - which 
may in the case of selecting inside a PEAR in the scenario outlined above mean 
that instances of `S` are actually not returned. 
   
   **Please complete the following information:**
    - Version: 3.5.0
   
   **Additional context**
   Another but similar scenario...
   
   Imagine we have a class outside of the PEAR called `H` with a field `H.x` of 
type `X`. Now the PEAR brings its own copy of `X` (i.e. `X_p`) but not of `H`. 
If the pear now calls `H.getX()` this will return an `X` instead of an `X_p` 
which probably also leads to a class cast exception... 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@uima.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to