Package com.sun.source.tree

Examples of com.sun.source.tree.Tree


            return null;
        return TreePath.getPath(treeTopLevel.snd, treeTopLevel.fst);
    }
   
    public Element getElement(TreePath path) {
        Tree t = path.getLeaf();
        return TreeInfo.symbolFor((JCTree) t);
    }
View Full Code Here


        Tree t = path.getLeaf();
        return TreeInfo.symbolFor((JCTree) t);
    }
   
    public TypeMirror getTypeMirror(TreePath path) {
        Tree t = path.getLeaf();
        return ((JCTree)t).type;
    }
View Full Code Here

            l = l.prepend(p.getLeaf());
            p = p.getParentPath();
        }
       
        for ( ; l.nonEmpty(); l = l.tail) {
            Tree tree = l.head;
            switch (tree.getKind()) {
                case COMPILATION_UNIT:
//                    System.err.println("COMP: " + ((JCCompilationUnit)tree).sourcefile);
                    env = enter.getTopLevelEnv((JCCompilationUnit)tree);
                    break;
                case CLASS:
View Full Code Here

        return results;
    }

    public TypeMirror getTypeMirror(Iterable<? extends Tree> path) {
        // TODO: Should complete attribution if necessary
        Tree last = null;
        for (Tree node : path)
            last = node;
        return ((JCTree)last).type;
    }
View Full Code Here

  }

  private TreePath getTreePath(Element enclosingElement) {
    TreePath path = trees.getPath(enclosingElement);
    if (path == null) {
      Tree tree = trees.getTree(enclosingElement);
      if (tree == null) {
        tree = new DummyTree();
      }
      // XXX: this is ugly, null is better here?
      path = new TreePath(new TreePath(compilationUnit), tree);
View Full Code Here

      return null;
    }

    // the check verifies the existence of a single method (first is the generated
    // constructor)
    Tree method = tw.getTree().getClassBody().getMembers().get(1);
    return visitor.scan(method, tw.getContext());
  }
View Full Code Here

                    if(e.getKind()==ElementKind.CONSTRUCTOR && e.getEnclosingElement().getSimpleName().length()==0)
                        return _; // this is a synthesized constructor for an anonymous class
                                  // TODO: I suspect we need some kind of uniform treatment for all synthesized methods

                    // mark up the method name
                    Tree prev = mt.getReturnType();
                    String name;
                    if(e.getKind()== ElementKind.CONSTRUCTOR)
                        name = e.getEnclosingElement().getSimpleName().toString();
                    else // constructor returns <init> from getName(), so we need the above code
                        name = mt.getName().toString();
View Full Code Here

TOP

Related Classes of com.sun.source.tree.Tree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.