[
https://issues.apache.org/jira/browse/UIMA-4299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14375209#comment-14375209
]
Marshall Schor commented on UIMA-4299:
--------------------------------------
The AnnotationIndex has a method, tree, which returns a tree of annotations.
If the AnnotationIndex is type restricted, then there's a design choice. The
design is such that all the children will come from the AnnotationIndex<T>
where T is a subtype of Annotation. However, the current design allows the
"top most" Annotation at the root of the tree to be of any type that's a
subtype of Annotation.
In doing the generics, this shows up as having the argument for the top level
annotation be of type <T> (the type of the restricted index) or of type
AnnotationFS - which is the supertype of all Annotations.
This also affects the type of the returned tree - it either contains just
things of T or its subtypes, or it contains that for all elements except the
root, which could be of any AnnotationFS type or subtype.
I guess in the interest of backwards compatibility, I thinking of this
approach: allow AnnotationFS for the argument, and define the resulting tree
to be of type AnnotationTree<T> where the T represents the type that subsumes
all of the items in the tree **except** the root.
> improve generics for UIMA indexes and iterators
> -----------------------------------------------
>
> Key: UIMA-4299
> URL: https://issues.apache.org/jira/browse/UIMA-4299
> Project: UIMA
> Issue Type: Improvement
> Components: Core Java Framework
> Affects Versions: 2.7.0SDK
> Reporter: Marshall Schor
> Priority: Minor
> Fix For: 2.7.1SDK
>
>
> When the JCas is being used, there are Java classes for UIMA types.
> Each index definition is associated with a top-most type in the type
> hierarchy.
> Indexes are used to create iterators of various kinds; some of these
> iterators are defined within classes which implement Iterable.
> Add generic mechanisms to the Indexes and iterators to support Iterables
> whose elements are JCas types.
> Update the APIs that get indexes over particular types to allow specifying
> those types by the type class, and use this for generic typing, so casts are
> not necessary for user code.
> Make the generics work also when JCas is not in use.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)