code: List<Annotation> getAnnotations(Multimap<String, Annotation> groups, TokenMatcher matcher) {
        if (relationType == null) {
           return getAnnotationStream(groups, matcher).filter(constraint).collect(Collectors.toList());
        }
        return getAnnotationStream(groups, matcher)
                  .flatMap(a -> {
                              if (relationType.equals(Types.DEPENDENCY)) {
                                 return a.children().stream()
                                         .filter(a2 -> a2.dependencyRelation().v1.equals(relationValue));
                              }
                              return a.sources(relationType, relationValue).stream();
                           }
                          ).flatMap(a -> {
                                       if (annotationType == null) {
                                          return Stream.of(a);
                                       }
                                       return a.get(annotationType).stream();
                                    }
                                   ).filter(constraint)
                  .collect(Collectors.toList());
     }
docs: Gets annotations.
  
  @param groups the groups
  @return the annotations