Marshall Schor wrote:
I'll probably stop trying to convince others if they continue to feel that the tradeoffs here should be in the direction of returning only specific types (disallowing users from specifying downcasting in that manner), versus using types of the form T extends X, which allows users to specify downcasting.
The case of FSIndexRepository is maybe more clear then the other cases in our API.
With down casting it could be changed to interface FSIndexRepository { <T extends FeatureStructure> FSIndex<T> getIndex(String label); <T extends FeatureStructure> FSIterator<T> getAllIndexedFS(Type aType); ... } and then a user could write FSIndex<AnnotationFS> index = repo.getIndex(...); FSIterator<AnnotationFS> it = repo.getAllIndexedFS(...); Jörn