code: private JCTree matchAnnoToTree(final Attribute.Compound findme,
                                     final Attribute attr,
                                     final JCTree tree) {
          if (attr == findme)
              return (tree.type.tsym == findme.type.tsym) ? tree : null;
  
          class Vis implements Attribute.Visitor {
              JCTree result = null;
              public void visitConstant(Attribute.Constant value) {
              }
              public void visitClass(Attribute.Class clazz) {
              }
              public void visitCompound(Attribute.Compound anno) {
                  for (Pair<MethodSymbol, Attribute> pair : anno.values) {
                      JCExpression expr = scanForAssign(pair.fst, tree);
                      if (expr != null) {
                          JCTree match = matchAnnoToTree(findme, pair.snd, expr);
                          if (match != null) {
                              result = match;
                              return;
                          }
                      }
                  }
              }
              public void visitArray(Attribute.Array array) {
                  if (tree.hasTag(NEWARRAY) &&
                          types.elemtype(array.type).tsym == findme.type.tsym) {
                      List<JCExpression> elems = ((JCNewArray) tree).elems;
                      for (Attribute value : array.values) {
                          if (value == findme) {
                              result = elems.head;
                              return;
                          }
                          elems = elems.tail;
                      }
                  }
              }
              public void visitEnum(Attribute.Enum e) {
              }
              public void visitError(Attribute.Error e) {
              }
          }
          Vis vis = new Vis();
          attr.accept(vis);
          return vis.result;
      }
docs: Returns the tree for an annotation given an Attribute to
  search (recursively) and its corresponding tree.
  Returns null if the tree cannot be found.