public static Name name(JCTree tree) {
        switch (tree.getTag()) {
        case JCTree.IDENT:
            return ((JCIdent) tree).name;
        case JCTree.SELECT:
            return ((JCFieldAccess) tree).name;
        case JCTree.TYPEAPPLY:
            return name(((JCTypeApply) tree).clazz);
        default:
            return null;
        }
    }