Constructor and Description |
---|
Trees() |
Modifier and Type | Method and Description |
---|---|
abstract String |
getDocComment(TreePath path)
Gets the doc comment, if any, for the Tree node identified by a given TreePath.
|
abstract Element |
getElement(TreePath path)
Gets the Element for the Tree node identified by a given TreePath.
|
abstract TypeMirror |
getLub(CatchTree tree)
Gets the lub of an exception parameter declared in a catch clause.
|
abstract TypeMirror |
getOriginalType(ErrorType errorType)
Gets the original type from the ErrorType object.
|
abstract TreePath |
getPath(CompilationUnitTree unit,
Tree node)
Gets the path to tree node within the specified compilation unit.
|
abstract TreePath |
getPath(Element e)
Gets the TreePath node for a given Element.
|
abstract TreePath |
getPath(Element e,
AnnotationMirror a)
Gets the TreePath node for an AnnotationMirror on a given Element.
|
abstract TreePath |
getPath(Element e,
AnnotationMirror a,
AnnotationValue v)
Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.
|
abstract Scope |
getScope(TreePath path)
Gets the Scope for the Tree node identified by a given TreePath.
|
abstract SourcePositions |
getSourcePositions()
Gets a utility object for obtaining source positions.
|
abstract Tree |
getTree(Element element)
Gets the Tree node for a given Element.
|
abstract Tree |
getTree(Element e,
AnnotationMirror a)
Gets the Tree node for an AnnotationMirror on a given Element.
|
abstract Tree |
getTree(Element e,
AnnotationMirror a,
AnnotationValue v)
Gets the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.
|
abstract MethodTree |
getTree(ExecutableElement method)
Gets the MethodTree node for a given ExecutableElement.
|
abstract ClassTree |
getTree(TypeElement element)
Gets the ClassTree node for a given TypeElement.
|
abstract TypeMirror |
getTypeMirror(TreePath path)
Gets the TypeMirror for the Tree node identified by a given TreePath.
|
static Trees |
instance(JavaCompiler.CompilationTask task)
Gets a Trees object for a given CompilationTask.
|
static Trees |
instance(ProcessingEnvironment env)
Gets a Trees object for a given ProcessingEnvironment.
|
abstract 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.
|
abstract boolean |
isAccessible(Scope scope,
TypeElement type)
Checks whether a given type is accessible in a given scope.
|
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
|
public static Trees instance(JavaCompiler.CompilationTask task)
task
- the compilation task for which to get the Trees objectIllegalArgumentException
- if the task does not support the Trees API.public static Trees instance(ProcessingEnvironment env)
env
- the processing environment for which to get the Trees objectIllegalArgumentException
- if the env does not support the Trees API.public abstract SourcePositions getSourcePositions()
public abstract Tree getTree(Element element)
public abstract ClassTree getTree(TypeElement element)
public abstract MethodTree getTree(ExecutableElement method)
public abstract Tree getTree(Element e, AnnotationMirror a)
public abstract Tree getTree(Element e, AnnotationMirror a, AnnotationValue v)
public abstract TreePath getPath(CompilationUnitTree unit, Tree node)
public abstract TreePath getPath(Element e)
public abstract TreePath getPath(Element e, AnnotationMirror a)
public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v)
public abstract Element getElement(TreePath path)
IllegalArgumentException
- is the TreePath does not identify
a Tree node that might have an associated Element.public abstract TypeMirror getTypeMirror(TreePath path)
IllegalArgumentException
- is the TreePath does not identify
a Tree node that might have an associated TypeMirror.public abstract Scope getScope(TreePath path)
public abstract String getDocComment(TreePath path)
DocTrees.getDocCommentTree(TreePath)
public abstract boolean isAccessible(Scope scope, TypeElement type)
scope
- the scope to be checkedtype
- the type to be checkedtype
is accessiblepublic abstract boolean isAccessible(Scope scope, Element member, DeclaredType type)
scope
- the scope to be checkedmember
- the member to be checkedtype
- the type for which to check if the member is accessiblemember
is accessible in type
public abstract TypeMirror getOriginalType(ErrorType errorType)
errorType
- The errorType for which we want to get the original type.public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, Tree t, CompilationUnitTree root)
kind
- the kind of messagemsg
- the message, or an empty string if nonet
- the tree to use as a position hintroot
- the compilation unit that contains treepublic abstract TypeMirror getLub(CatchTree tree)
tree
- the tree for the catch clause
Copyright © 2005, 2022, Oracle and/or its affiliates. All rights reserved.