private static <T> List<T> createAnnotations(
      PluginManager<T> pluginManager,
      List<String> annotationGroupsToUse,
      List<String> annotationsToUse) {
    // get the instances
    List<T> annotations = new ArrayList<T>();

    // get the classes from the provided groups (interfaces)
    // create a map for all annotation classes which implement our top-level interfaces
    HashMap<String, Class> classMap = new HashMap<String, Class>();
    for (Class c : pluginManager.getPlugins()) classMap.put(c.getSimpleName(), c);
    for (Class c : annotationTypePluginManager.getInterfaces()) classMap.put(c.getSimpleName(), c);

    // use a TreeSet so that classes are returned deterministically (the plugin manager apparently
    // isn't deterministic)
    TreeSet<Class> classes =
        new TreeSet<Class>(
            new Comparator<Class>() {
              public int compare(Class o1, Class o2) {
                return o1.getSimpleName().compareTo(o2.getSimpleName());
              }
            });

    if (annotationGroupsToUse.size() != 1 || !"none".equals(annotationGroupsToUse.get(0))) {
      for (String group : annotationGroupsToUse) {
        Class interfaceClass = classMap.get(group);
        if (interfaceClass == null) interfaceClass = classMap.get(group + "Annotation");
        if (interfaceClass != null)
          classes.addAll(pluginManager.getPluginsImplementing(interfaceClass));
      }
    }

    // get the specific classes provided
    for (String annotation : annotationsToUse) {
      Class annotationClass = classMap.get(annotation);
      if (annotationClass == null) annotationClass = classMap.get(annotation + "Annotation");
      if (annotationClass != null) classes.add(annotationClass);
    }

    // note that technically an annotation can work on both the INFO and FORMAT fields
    for (Class c : classes) annotations.add(pluginManager.createByType(c));

    return annotations;
  }
  public static void validateAnnotations(
      List<String> annotationGroupsToUse, List<String> annotationsToUse) {
    HashMap<String, Class> classMap = new HashMap<String, Class>();
    for (Class c : infoFieldAnnotationPluginManager.getPlugins())
      classMap.put(c.getSimpleName(), c);
    for (Class c : genotypeAnnotationPluginManager.getPlugins()) classMap.put(c.getSimpleName(), c);
    for (Class c : annotationTypePluginManager.getInterfaces()) classMap.put(c.getSimpleName(), c);

    if (annotationGroupsToUse.size() != 1 || !"none".equals(annotationGroupsToUse.get(0))) {
      for (String group : annotationGroupsToUse) {
        Class interfaceClass = classMap.get(group);
        if (interfaceClass == null) interfaceClass = classMap.get(group + "Annotation");
        if (interfaceClass == null)
          throw new UserException.BadArgumentValue(
              "group",
              "Annotation group "
                  + group
                  + " was not found; please check that you have specified the group name correctly");
      }
    }

    // validate the specific classes provided
    for (String annotation : annotationsToUse) {
      Class annotationClass = classMap.get(annotation);
      if (annotationClass == null) annotationClass = classMap.get(annotation + "Annotation");
      if (annotationClass == null) {
        if (DeprecatedToolChecks.isDeprecatedAnnotation(annotation)) {
          throw new UserException.DeprecatedAnnotation(
              annotation, DeprecatedToolChecks.getAnnotationDeprecationInfo(annotation));
        } else {
          throw new UserException.BadArgumentValue(
              "annotation",
              "Annotation "
                  + annotation
                  + " was not found; please check that you have specified the annotation name correctly");
        }
      }
    }
  }
 public static List<GenotypeAnnotation> createAllGenotypeAnnotations() {
   return genotypeAnnotationPluginManager.createAllTypes();
 }
 public static List<InfoFieldAnnotation> createAllInfoFieldAnnotations() {
   return infoFieldAnnotationPluginManager.createAllTypes();
 }