code: private <T extends ProgramElementDoc> void mapAnnotations(Map<String,List<T>> map, Object doc,
              T holder) {
          AnnotationDesc[] annotations;
          boolean isPackage = false;
          if (doc instanceof ProgramElementDoc) {
              annotations = ((ProgramElementDoc) doc).annotations();
          } else if (doc instanceof PackageDoc) {
              annotations = ((PackageDoc) doc).annotations();
              isPackage = true;
          } else if (doc instanceof Parameter) {
              annotations = ((Parameter) doc).annotations();
          } else {
              throw new DocletAbortException("should not happen");
          }
          for (AnnotationDesc annotation : annotations) {
              AnnotationTypeDoc annotationDoc = annotation.annotationType();
              if (isPackage)
                  refList(map, annotationDoc).add(holder);
              else
                  add(map, annotationDoc, holder);
          }
      }
docs: Map the AnnotationType to the ProgramElementDocs that use them as
  type parameters.
  
  @param map the map the insert the information into.
  @param doc the doc whose type parameters are being checked.
  @param holder the holder that owns the type parameters.