You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
Ok, so the convention is that a PEAR must embed all types it directly uses. Thus, if it wants to call H.getX(), it must embed H which would then be H_p and H_p.getX() would return X_p. So that should be consistent.
The text was updated successfully, but these errors were encountered:
Describe the bug
Let's assume with have a CAS with two types,
T
andS
whereS
is a subtype ofT
.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 itT_p
).When the code in the PEAR does a
for var T : select(T.class)
(which actually selectsT_p
and that select returns anS
, that leads to a class cast exception becauseS
cannot be cast toT_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 withclass
- which may in the case of selecting inside a PEAR in the scenario outlined above mean that instances ofS
are actually not returned.Please complete the following information:
Additional context
Another but similar scenario...
Imagine we have a class outside of the PEAR called
H
with a fieldH.x
of typeX
. Now the PEAR brings its own copy ofX
(i.e.X_p
) but not ofH
. If the pear now callsH.getX()
this will return anX
instead of anX_p
which probably also leads to a class cast exception...Ok, so the convention is that a PEAR must embed all types it directly uses. Thus, if it wants to call
H.getX()
, it must embedH
which would then beH_p
andH_p.getX()
would returnX_p
. So that should be consistent.The text was updated successfully, but these errors were encountered: