[ 
https://issues.apache.org/jira/browse/UIMA-5067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Eckart de Castilho updated UIMA-5067:
---------------------------------------------
    Description: 
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.

{noformat}
for (Annotation aa : cas.getAnnotationIndex(AA.type))
{
   Object ab = JCasUtil.selectSingleRelative(AB.class, aa, 0);
   System.out.println(ab.getClass().getName());
}
{noformat}

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.



  was:
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.




> 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.
> {noformat}
> for (Annotation aa : cas.getAnnotationIndex(AA.type))
> {
>    Object ab = JCasUtil.selectSingleRelative(AB.class, aa, 0);
>    System.out.println(ab.getClass().getName());
> }
> {noformat}
> 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.15#6346)

Reply via email to