Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-5067

JCasUtil.selectSingleRelative returns wrong object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.0uimaFIT
    • 2.3.0uimaFIT
    • uimaFIT
    • None

    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.

      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.

      Attachments

        Activity

          People

            rec Richard Eckart de Castilho
            asher-stern Asher Stern
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: