java.lang.Object
com.sun.source.util.Trees
- Direct Known Subclasses:
- DocTrees
Bridges JSR 199, JSR 269, and the Tree API.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract StringgetDocComment(TreePath path)Returns the doc comment, if any, for the Tree node identified by a given TreePath.abstract ElementgetElement(TreePath path)Returns the Element for the Tree node identified by a given TreePath.abstract TypeMirrorReturns the lub of an exception parameter declared in a catch clause.abstract TypeMirrorgetOriginalType(ErrorType errorType)Returns the original type from the ErrorType object.abstract TreePathgetPath(CompilationUnitTree unit, Tree node)Returns the path to tree node within the specified compilation unit.abstract TreePathReturns the TreePath node for a given Element.abstract TreePathgetPath(Element e, AnnotationMirror a)Returns the TreePath node for an AnnotationMirror on a given Element.abstract TreePathgetPath(Element e, AnnotationMirror a, AnnotationValue v)Returns the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.abstract ScopeReturns the Scope for the Tree node identified by a given TreePath.abstract SourcePositionsReturns a utility object for obtaining source positions.abstract TreeReturns the Tree node for a given Element.abstract TreegetTree(Element e, AnnotationMirror a)Returns the Tree node for an AnnotationMirror on a given Element.abstract TreegetTree(Element e, AnnotationMirror a, AnnotationValue v)Returns the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.abstract MethodTreegetTree(ExecutableElement method)Returns the MethodTree node for a given ExecutableElement.abstract ClassTreegetTree(TypeElement element)Returns the ClassTree node for a given TypeElement.abstract TypeMirrorgetTypeMirror(TreePath path)Returns the TypeMirror for the Tree node identified by a given TreePath.static TreesReturns a Trees object for a given ProcessingEnvironment.static TreesReturns a Trees object for a given CompilationTask.abstract booleanisAccessible(Scope scope, Element member, DeclaredType type)Checks whether the given element is accessible as a member of the given type in a given scope.abstract booleanisAccessible(Scope scope, TypeElement type)Checks whether a given type is accessible in a given scope.abstract voidprintMessage(Diagnostic.Kind kind, CharSequence msg, Tree t, CompilationUnitTree root)Prints a message of the specified kind at the location of the tree within the provided compilation unit
- 
Constructor Details- 
Treespublic Trees()Constructor for subclasses to call.
 
- 
- 
Method Details- 
instanceReturns a Trees object for a given CompilationTask.- Parameters:
- task- the compilation task for which to get the Trees object
- Returns:
- the Trees object
- Throws:
- IllegalArgumentException- if the task does not support the Trees API.
 
- 
instanceReturns a Trees object for a given ProcessingEnvironment.- Parameters:
- env- the processing environment for which to get the Trees object
- Returns:
- the Trees object
- Throws:
- IllegalArgumentException- if the env does not support the Trees API.
 
- 
getSourcePositionsReturns a utility object for obtaining source positions.- Returns:
- the utility object for obtaining source positions
 
- 
getTreeReturns the Tree node for a given Element. Returnsnullif the node can not be found.- Parameters:
- element- the element
- Returns:
- the tree node
 
- 
getTreeReturns the ClassTree node for a given TypeElement. Returnsnullif the node can not be found.- Parameters:
- element- the element
- Returns:
- the class tree node
 
- 
getTreeReturns the MethodTree node for a given ExecutableElement. Returnsnullif the node can not be found.- Parameters:
- method- the executable element
- Returns:
- the method tree node
 
- 
getTreeReturns the Tree node for an AnnotationMirror on a given Element. Returnsnullif the node can not be found.- Parameters:
- e- the element
- a- the annotation mirror
- Returns:
- the tree node
 
- 
getTreeReturns the Tree node for an AnnotationValue for an AnnotationMirror on a given Element. Returnsnullif the node can not be found.- Parameters:
- e- the element
- a- the annotation mirror
- v- the annotation value
- Returns:
- the tree node
 
- 
getPathReturns the path to tree node within the specified compilation unit.- Parameters:
- unit- the compilation unit
- node- the tree node
- Returns:
- the tree path
 
- 
getPathReturns the TreePath node for a given Element. Returnsnullif the node can not be found.- Parameters:
- e- the element
- Returns:
- the tree path
 
- 
getPathReturns the TreePath node for an AnnotationMirror on a given Element. Returnsnullif the node can not be found.- Parameters:
- e- the element
- a- the annotation mirror
- Returns:
- the tree path
 
- 
getPathReturns the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element. Returnsnullif the node can not be found.- Parameters:
- e- the element
- a- the annotation mirror
- v- the annotation value
- Returns:
- the tree path
 
- 
getElementReturns the Element for the Tree node identified by a given TreePath. Returnsnullif the element is not available.- Parameters:
- path- the tree path
- Returns:
- the element
- Throws:
- IllegalArgumentException- is the TreePath does not identify a Tree node that might have an associated Element.
 
- 
getTypeMirrorReturns the TypeMirror for the Tree node identified by a given TreePath. Returnsnullif the TypeMirror is not available.- Parameters:
- path- the tree path
- Returns:
- the type mirror
- Throws:
- IllegalArgumentException- is the TreePath does not identify a Tree node that might have an associated TypeMirror.
 
- 
getScopeReturns the Scope for the Tree node identified by a given TreePath. Returnsnullif the Scope is not available.- Parameters:
- path- the tree path
- Returns:
- the scope
 
- 
getDocCommentReturns the doc comment, if any, for the Tree node identified by a given TreePath. Returnsnullif no doc comment was found.- Parameters:
- path- the tree path
- Returns:
- the doc comment
- See Also:
- DocTrees.getDocCommentTree(TreePath)
 
- 
isAccessibleChecks whether a given type is accessible in a given scope.- Parameters:
- scope- the scope to be checked
- type- the type to be checked
- Returns:
- true if typeis accessible
 
- 
isAccessibleChecks whether the given element is accessible as a member of the given type in a given scope.- 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 memberis accessible intype
 
- 
getOriginalTypeReturns the original type from the ErrorType object.- Parameters:
- errorType- the errorType for which we want to get the original type
- Returns:
- the type mirror corresponding to the original type, replaced by the ErrorType
 
- 
printMessagepublic abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, Tree t, CompilationUnitTree root)Prints a message of the specified kind at the location of the tree within the provided compilation unit- Parameters:
- kind- the kind of message
- msg- the message, or an empty string if none
- t- the tree to use as a position hint
- root- the compilation unit that contains tree
 
- 
getLubReturns the lub of an exception parameter declared in a catch clause.- Parameters:
- tree- the tree for the catch clause
- Returns:
- the lub of the exception parameter
 
 
-