Asher Stern created UIMA-5067:
---------------------------------

             Summary: 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


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)

Reply via email to