code: public static Name fullName(JCTree tree) {
          tree = skipParens(tree);
          switch (tree.getTag()) {
          case IDENT:
              return ((JCIdent) tree).name;
          case SELECT:
              Name sname = fullName(((JCFieldAccess) tree).selected);
              return sname == null ? null : sname.append('.', name(tree));
          default:
              return null;
          }
      }
docs: If this tree is a qualified identifier, its return fully qualified name,
  otherwise return null.