The docs say that subtypes of AnnotationBase can only be added to indices in the CAS View associated with the Sofa for that Feature Structure (see http://uima.apache.org/d/uimaj-2.6.0/tutorials_and_users_guides.html#ugr.tug.aas.annotations_associated_sofa )
A check was put in to enforce this, in the casImpl code, when calling aCasView.addFsToIndexes. Unfortunately, this check misses checking the many other paths that are used to add a FS to an index. For instance, the path when using JCas: instance.addToIndexes(), and many others.
Fix this by moving the test downwards to the place where all code paths flow together.
Allow restoring the old behavior in case needed, via a JVM -D parameter: uima.disable_enhanced_check_wrong_add_to_index