You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2020/04/09 15:47:46 UTC

[uima-uimafit] 01/01: [UIMA-5847] Remove UV3 bug workarounds in FSCollectionFactory

This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch UIMA-5847-Remove-UV3-bug-workarounds-in-FSCollectionFactory
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 2232897aaab9db526f3a99323abff68e14e23e4b
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Thu Apr 9 17:47:37 2020 +0200

    [UIMA-5847] Remove UV3 bug workarounds in FSCollectionFactory
    
    - Remove workarounds
    - Update minimum requirements in README file
---
 README                                                      |  2 +-
 .../java/org/apache/uima/fit/util/FSCollectionFactory.java  | 13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/README b/README
index 90fd2ec..6bcfe76 100644
--- a/README
+++ b/README
@@ -50,7 +50,7 @@ A full list of issues addressed in this release can be found on the Apache issue
 Supported Platforms
 -------------------
 
-uimaFIT requires Java 1.8 or higher, UIMA 3.0.2 or higher, and the Spring Framework 4.3.22 or higher.
+uimaFIT requires Java 1.8 or higher, UIMA 3.1.0 or higher, and the Spring Framework 4.3.26 or higher.
 
 
 Availability
diff --git a/uimafit-core/src/main/java/org/apache/uima/fit/util/FSCollectionFactory.java b/uimafit-core/src/main/java/org/apache/uima/fit/util/FSCollectionFactory.java
index 67f1d73..40e39a6 100644
--- a/uimafit-core/src/main/java/org/apache/uima/fit/util/FSCollectionFactory.java
+++ b/uimafit-core/src/main/java/org/apache/uima/fit/util/FSCollectionFactory.java
@@ -100,9 +100,7 @@ public abstract class FSCollectionFactory {
     if (ts.subsumes(cas.getAnnotationType(), type)) {
       return (List) create(cas.getAnnotationIndex(type));
     } else {
-      Collection<FeatureStructure> result = create(cas.getIndexRepository().getAllIndexedFS(type));
-      return asList(result.toArray(new FeatureStructure[result.size()]));
-      // return (List) cas.select(type).asList(); - This call is still buggy in UIMA 3.0.0
+      return (List) cas.select(type).asList();
     }
   }
 
@@ -133,10 +131,7 @@ public abstract class FSCollectionFactory {
    */
   @Deprecated
   public static <T extends AnnotationFS> List<T> create(AnnotationIndex<T> aIndex) {
-    // Was: return new AnnotationIndexAdapter<T>(aIndex);
-    // return aIndex.select().asList(); // That call is still buggy in UIMA 3.0.0
-    Collection<T> result = new AnnotationIndexAdapter<T>(aIndex);
-    return (List) asList(result.toArray());
+    return aIndex.select().asList();
   }
 
   /**
@@ -164,7 +159,7 @@ public abstract class FSCollectionFactory {
    */
   @SuppressWarnings({ "unchecked", "rawtypes" })
   public static <T extends TOP> List<T> create(ArrayFS aArray, Class<T> aType) {
-    return (List) create(aArray, CasUtil.getType(aArray.getCAS(), aType));
+    return create(aArray, CasUtil.getType(aArray.getCAS(), aType));
   }
 
   /**
@@ -553,7 +548,7 @@ public abstract class FSCollectionFactory {
    * @return a new collection of all feature structures of the given type.
    */
   public static <T extends TOP> Collection<T> create(FSList<T> aList, Class<? extends T> aType) {
-    return (Collection<T>) create(aList, CasUtil.getType(aList.getCAS(), aType));
+    return create(aList, CasUtil.getType(aList.getCAS(), aType));
   }
 
   // Using TOP here because FSList is only available in the JCas.