You need to check that the annotation is of the correct type before attempting to call `isCollection` on it.