[
https://issues.apache.org/jira/browse/UIMA-5067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15432500#comment-15432500
]
Richard Eckart de Castilho commented on UIMA-5067:
--------------------------------------------------
Thanks for reporting. It looks like a bug. Going to look into it before the
next uimaFIT release.
> JCasUtil.selectSingleRelative returns wrong object
> --------------------------------------------------
>
> Key: UIMA-5067
> URL: https://issues.apache.org/jira/browse/UIMA-5067
> Project: UIMA
> Issue Type: Bug
> Components: uimaFIT
> Affects Versions: 2.2.0uimaFIT
> Reporter: Asher Stern
> Fix For: 2.3.0uimaFIT
>
>
> The returned object of JCasUtil.selectSingleRelative() should match the
> generic-type of its first argument.
> However, when the last argument is 0, it returns an object whose class is
> identical to the second argument's class.
> for (Annotation aa : cas.getAnnotationIndex(AA.type))
> {
> Object ab = JCasUtil.selectSingleRelative(AB.class, aa, 0);
> System.out.println(ab.getClass().getName());
> }
> The output ought to be "AB", however it is "AA".
> (When the last argument is 0, I thought it would find an annotation which
> begins exactly where the annotation of the second argument begins. However,
> it returns a wrong object).
> Perhaps, if last-argument 0 is prohibited, an exception should be thrown (and
> documented).
> Thanks.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)