All the get methods on AnnotationSet return instances of ImmutableAnnotationSetImpl to force you to modify annotations via the main original document annotation set. Some of the methods on gate.Utils do the same when they simply delegate, but if they create a new set they don't make it immutable. This can result in some weird cases where you can some times modify a set and some times not.
My feeling is that all the methods on gate.Utils that return an AnnotationSet should be consistent and return an ImmutableAnnotationSetImpl
All the get methods on
AnnotationSet
return instances ofImmutableAnnotationSetImpl
to force you to modify annotations via the main original document annotation set. Some of the methods ongate.Utils
do the same when they simply delegate, but if they create a new set they don't make it immutable. This can result in some weird cases where you can some times modify a set and some times not.My feeling is that all the methods on
gate.Utils
that return anAnnotationSet
should be consistent and return anImmutableAnnotationSetImpl