code: public static Symbol symbol(JCTree tree) {
          tree = skipParens(tree);
          switch (tree.getTag()) {
          case IDENT:
              return ((JCIdent) tree).sym;
          case SELECT:
              return ((JCFieldAccess) tree).sym;
          case TYPEAPPLY:
              return symbol(((JCTypeApply) tree).clazz);
          case ANNOTATED_TYPE:
              return symbol(((JCAnnotatedType) tree).underlyingType);
          case REFERENCE:
              return ((JCMemberReference) tree).sym;
          default:
              return null;
          }
      }
docs: If this tree is an identifier or a field, return its symbol,
  otherwise return null.