com.sun.tools.javac.api
Class JavacTrees

java.lang.Object
  extended by com.sun.source.util.Trees
      extended by com.sun.tools.javac.api.JavacTrees

public class JavacTrees
extends Trees

Provides an implementation of Trees.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.


Nested Class Summary
(package private) static class JavacTrees.Copier
          Makes a copy of a tree, noting the value resulting from copying a particular leaf.
 
Field Summary
private  Attr attr
           
private  JavacElements elements
           
private  Enter enter
           
private  JavacTaskImpl javacTaskImpl
           
private  Log log
           
private  MemberEnter memberEnter
           
private  Resolve resolve
           
private  TreeMaker treeMaker
           
 
Constructor Summary
private JavacTrees(Context context)
           
 
Method Summary
private  Env<AttrContext> attribExprToTree(JCTree.JCExpression expr, Env<AttrContext> env, JCTree tree)
           
private  Env<AttrContext> attribStatToTree(JCTree stat, Env<AttrContext> env, JCTree tree)
           
private  Env<AttrContext> getAttrContext(TreePath path)
           
 Element getElement(TreePath path)
          Gets the Element for the Tree node identified by a given TreePath.
 TypeMirror getOriginalType(ErrorType errorType)
          Gets the original type from the ErrorType object.
 TreePath getPath(CompilationUnitTree unit, Tree node)
          Gets the path to tree node within the specified compilation unit.
 TreePath getPath(Element e)
          Gets the TreePath node for a given Element.
 TreePath getPath(Element e, AnnotationMirror a)
          Gets the TreePath node for an AnnotationMirror on a given Element.
 TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v)
          Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.
 JavacScope getScope(TreePath path)
          Gets the Scope for the Tree node identified by a given TreePath.
 SourcePositions getSourcePositions()
          Gets a utility object for obtaining source positions.
 JCTree getTree(Element element)
           
 JCTree getTree(Element e, AnnotationMirror a)
           
 JCTree getTree(Element e, AnnotationMirror a, AnnotationValue v)
           
 JCTree.JCMethodDecl getTree(ExecutableElement method)
          Gets the MethodTree node for a given ExecutableElement.
 JCTree.JCClassDecl getTree(TypeElement element)
          Gets the ClassTree node for a given TypeElement.
 TypeMirror getTypeMirror(TreePath path)
          Gets the TypeMirror for the Tree node identified by a given TreePath.
static JavacTrees instance(Context context)
           
static JavacTrees instance(JavaCompiler.CompilationTask task)
           
static JavacTrees instance(ProcessingEnvironment env)
           
 boolean isAccessible(Scope scope, Element member, DeclaredType type)
          Checks whether the given element is accessible as a member of the given type in a given scope.
 boolean isAccessible(Scope scope, TypeElement type)
          Checks whether a given type is accessible in a given scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resolve

private final Resolve resolve

enter

private final Enter enter

log

private final Log log

memberEnter

private final MemberEnter memberEnter

attr

private final Attr attr

treeMaker

private final TreeMaker treeMaker

elements

private final JavacElements elements

javacTaskImpl

private final JavacTaskImpl javacTaskImpl
Constructor Detail

JavacTrees

private JavacTrees(Context context)
Method Detail

instance

public static JavacTrees instance(JavaCompiler.CompilationTask task)

instance

public static JavacTrees instance(ProcessingEnvironment env)

instance

public static JavacTrees instance(Context context)

getSourcePositions

public SourcePositions getSourcePositions()
Description copied from class: Trees
Gets a utility object for obtaining source positions.

Specified by:
getSourcePositions in class Trees

getTree

public JCTree.JCClassDecl getTree(TypeElement element)
Description copied from class: Trees
Gets the ClassTree node for a given TypeElement. Returns null if the node can not be found.

Specified by:
getTree in class Trees

getTree

public JCTree.JCMethodDecl getTree(ExecutableElement method)
Description copied from class: Trees
Gets the MethodTree node for a given ExecutableElement. Returns null if the node can not be found.

Specified by:
getTree in class Trees

getTree

public JCTree getTree(Element element)

getTree

public JCTree getTree(Element e,
                      AnnotationMirror a)

getTree

public JCTree getTree(Element e,
                      AnnotationMirror a,
                      AnnotationValue v)

getPath

public TreePath getPath(CompilationUnitTree unit,
                        Tree node)
Description copied from class: Trees
Gets the path to tree node within the specified compilation unit.

Specified by:
getPath in class Trees

getPath

public TreePath getPath(Element e)
Description copied from class: Trees
Gets the TreePath node for a given Element. Returns null if the node can not be found.

Specified by:
getPath in class Trees

getPath

public TreePath getPath(Element e,
                        AnnotationMirror a)
Description copied from class: Trees
Gets the TreePath node for an AnnotationMirror on a given Element. Returns null if the node can not be found.

Specified by:
getPath in class Trees

getPath

public TreePath getPath(Element e,
                        AnnotationMirror a,
                        AnnotationValue v)
Description copied from class: Trees
Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element. Returns null if the node can not be found.

Specified by:
getPath in class Trees

getElement

public Element getElement(TreePath path)
Description copied from class: Trees
Gets the Element for the Tree node identified by a given TreePath. Returns null if the element is not available.

Specified by:
getElement in class Trees

getTypeMirror

public TypeMirror getTypeMirror(TreePath path)
Description copied from class: Trees
Gets the TypeMirror for the Tree node identified by a given TreePath. Returns null if the TypeMirror is not available.

Specified by:
getTypeMirror in class Trees

getScope

public JavacScope getScope(TreePath path)
Description copied from class: Trees
Gets the Scope for the Tree node identified by a given TreePath. Returns null if the Scope is not available.

Specified by:
getScope in class Trees

isAccessible

public boolean isAccessible(Scope scope,
                            TypeElement type)
Description copied from class: Trees
Checks whether a given type is accessible in a given scope.

Specified by:
isAccessible in class Trees
Parameters:
scope - the scope to be checked
type - the type to be checked
Returns:
true if type is accessible

isAccessible

public boolean isAccessible(Scope scope,
                            Element member,
                            DeclaredType type)
Description copied from class: Trees
Checks whether the given element is accessible as a member of the given type in a given scope.

Specified by:
isAccessible in class Trees
Parameters:
scope - the scope to be checked
member - the member to be checked
type - the type for which to check if the member is accessible
Returns:
true if member is accessible in type

getAttrContext

private Env<AttrContext> getAttrContext(TreePath path)

attribStatToTree

private Env<AttrContext> attribStatToTree(JCTree stat,
                                          Env<AttrContext> env,
                                          JCTree tree)

attribExprToTree

private Env<AttrContext> attribExprToTree(JCTree.JCExpression expr,
                                          Env<AttrContext> env,
                                          JCTree tree)

getOriginalType

public TypeMirror getOriginalType(ErrorType errorType)
Gets the original type from the ErrorType object.

Specified by:
getOriginalType in class Trees
Parameters:
errorType - The errorType for which we want to get the original type.