# Uses of Interface
com.sun.source.tree.Tree

Packages that use Tree
Package | Description
--- | ---
com.sun.source.tree | Provides interfaces to represent source code as abstract syntax trees (AST).
com.sun.source.util | Provides utilities for operations on abstract syntax trees (AST).

## Uses of Tree in com.sun.source.tree

Subinterfaces of Tree in com.sun.source.tree
Modifier and Type | Interface | Description
--- | --- | ---
`interface` | `AnnotatedTypeTree` | A tree node for an annotated type.
`interface` | `AnnotationTree` | A tree node for an annotation.
`interface` | `ArrayAccessTree` | A tree node for an array access expression.
`interface` | `ArrayTypeTree` | A tree node for an array type.
`interface` | `AssertTree` | A tree node for an `assert` statement.
`interface` | `AssignmentTree` | A tree node for an assignment expression.
`interface` | `BinaryTree` | A tree node for a binary expression.
`interface` | `BlockTree` | A tree node for a statement block.
`interface` | `BreakTree` | A tree node for a `break` statement.
`interface` | `CaseTree` | A tree node for a `case` in a `switch` statement or expression.
`interface` | `CatchTree` | A tree node for a `catch` block in a `try` statement.
`interface` | `ClassTree` | A tree node for a class, interface, enum, or annotation type declaration.
`interface` | `CompilationUnitTree` | Represents the abstract syntax tree for compilation units (source files) and package declarations (package-info.java).
`interface` | `CompoundAssignmentTree` | A tree node for compound assignment operator.
`interface` | `ConditionalExpressionTree` | A tree node for the conditional operator ?
`interface` | `ContinueTree` | A tree node for a `continue` statement.
`interface` | `DirectiveTree` | A super-type for all the directives in a ModuleTree.
`interface` | `DoWhileLoopTree` | A tree node for a `do` statement.
`interface` | `EmptyStatementTree` | A tree node for an empty (skip) statement.
`interface` | `EnhancedForLoopTree` | A tree node for an "enhanced" `for` loop statement.
`interface` | `ErroneousTree` | A tree node to stand in for a malformed expression.
`interface` | `ExportsTree` | A tree node for an 'exports' directive in a module declaration.
`interface` | `ExpressionStatementTree` | A tree node for an expression statement.
`interface` | `ExpressionTree` | A tree node used as the base class for the different types of expressions.
`interface` | `ForLoopTree` | A tree node for a basic `for` loop statement.
`interface` | `IdentifierTree` | A tree node for an identifier expression.
`interface` | `IfTree` | A tree node for an `if` statement.
`interface` | `ImportTree` | A tree node for an import declaration.
`interface` | `InstanceOfTree` | A tree node for an `instanceof` expression.
`interface` | `IntersectionTypeTree` | A tree node for an intersection type in a cast expression.
`interface` | `LabeledStatementTree` | A tree node for a labeled statement.
`interface` | `LambdaExpressionTree` | A tree node for a lambda expression.
`interface` | `LiteralTree` | A tree node for a literal expression.
`interface` | `MemberReferenceTree` | A tree node for a member reference expression.
`interface` | `MemberSelectTree` | A tree node for a member access expression.
`interface` | `MethodInvocationTree` | A tree node for a method invocation expression.
`interface` | `MethodTree` | A tree node for a method or annotation type element declaration.
`interface` | `ModifiersTree` | A tree node for the modifiers, including annotations, for a declaration.
`interface` | `ModuleTree` | A tree node for a module declaration.
`interface` | `NewArrayTree` | A tree node for an expression to create a new instance of an array.
`interface` | `NewClassTree` | A tree node to declare a new instance of a class.
`interface` | `OpensTree` | A tree node for an 'opens' directive in a module declaration.
`interface` | `PackageTree` | Represents the package declaration.
`interface` | `ParameterizedTypeTree` | A tree node for a type expression involving type parameters.
`interface` | `ParenthesizedTree` | A tree node for a parenthesized expression.
`interface` | `PrimitiveTypeTree` | A tree node for a primitive type.
`interface` | `ProvidesTree` | A tree node for a 'provides' directive in a module declaration.
`interface` | `RequiresTree` | A tree node for a 'requires' directive in a module declaration.
`interface` | `ReturnTree` | A tree node for a `return` statement.
`interface` | `StatementTree` | A tree node used as the base class for the different kinds of statements.
`interface` | `SwitchExpressionTree` | Deprecated, for removal: This API element is subject to removal in a future version. This method is modeling switch expressions, which are part of a preview feature and may be removed if the preview feature is removed.
`interface` | `SwitchTree` | A tree node for a `switch` statement.
`interface` | `SynchronizedTree` | A tree node for a `synchronized` statement.
`interface` | `ThrowTree` | A tree node for a `throw` statement.
`interface` | `TryTree` | A tree node for a `try` statement.
`interface` | `TypeCastTree` | A tree node for a type cast expression.
`interface` | `TypeParameterTree` | A tree node for a type parameter.
`interface` | `UnaryTree` | A tree node for postfix and unary expressions.
`interface` | `UnionTypeTree` | A tree node for a union type expression in a multicatch variable declaration.
`interface` | `UsesTree` | A tree node for a 'uses' directive in a module declaration.
`interface` | `VariableTree` | A tree node for a variable declaration.
`interface` | `WhileLoopTree` | A tree node for a `while` loop statement.
`interface` | `WildcardTree` | A tree node for a wildcard type argument.
`interface` | `YieldTree` | Deprecated, for removal: This API element is subject to removal in a future version. This class is modeling yield from switch expressions, which are part of a preview feature and may be removed if the preview feature is removed.

Methods in com.sun.source.tree that return Tree
Modifier and Type | Method | Description
--- | --- | ---
`Tree` | AnnotationTree.`getAnnotationType()` | Returns the annotation type.
`default Tree` | CaseTree.`getBody()` | Deprecated, for removal: This API element is subject to removal in a future version. This method is modeling a rule case, which is part of a preview feature and may be removed if the preview feature is removed.
`Tree` | LambdaExpressionTree.`getBody()` | Returns the body of the lambda expression.
`Tree` | WildcardTree.`getBound()` | Returns the bound of the wildcard.
`Tree` | MethodTree.`getDefaultValue()` | Returns the default value, if this is an element within an annotation type declaration.
`Tree` | ClassTree.`getExtendsClause()` | Returns the supertype of this type declaration, or `null` if none is provided.
`Tree` | ImportTree.`getQualifiedIdentifier()` | Returns the qualified identifier for the declaration(s) being imported.
`Tree` | MethodTree.`getReturnType()` | Returns the return type of the method being declared.
`Tree` | ArrayTypeTree.`getType()` | Returns the element type of this array type.
`Tree` | InstanceOfTree.`getType()` | Returns the type for which to check.
`Tree` | NewArrayTree.`getType()` | Returns the base type of the expression.
`Tree` | ParameterizedTypeTree.`getType()` | Returns the base type.
`Tree` | TypeCastTree.`getType()` | Returns the target type of the cast.
`Tree` | VariableTree.`getType()` | Returns the type of the variable being declared.

Methods in com.sun.source.tree that return types with arguments of type Tree
Modifier and Type | Method | Description
--- | --- | ---
`Class<? extends Tree>` | Tree.Kind.`asInterface()` | Returns the associated interface type that uses this kind.
`List<? extends Tree>` | IntersectionTypeTree.`getBounds()` | Returns the bounds of the type.
`List<? extends Tree>` | TypeParameterTree.`getBounds()` | Returns the bounds of the type parameter.
`List<? extends Tree>` | ErroneousTree.`getErrorTrees()` | Returns any trees that were saved in this node.
`List<? extends Tree>` | ClassTree.`getImplementsClause()` | Returns the interfaces implemented by this type declaration.
`List<? extends Tree>` | ClassTree.`getMembers()` | Returns the members declared in this type declaration.
`List<? extends Tree>` | TryTree.`getResources()` | Returns any resource declarations provided in the `try` statement.
`List<? extends Tree>` | UnionTypeTree.`getTypeAlternatives()` | Returns the alternative type expressions.
`List<? extends Tree>` | MethodInvocationTree.`getTypeArguments()` | Returns the type arguments for this method invocation.
`List<? extends Tree>` | NewClassTree.`getTypeArguments()` | Returns the type arguments for the object being created.
`List<? extends Tree>` | ParameterizedTypeTree.`getTypeArguments()` | Returns the type arguments.
`List<? extends Tree>` | CompilationUnitTree.`getTypeDecls()` | Returns the type declarations appearing in this compilation unit.

Methods in com.sun.source.tree with parameters of type Tree
Modifier and Type | Method | Description
--- | --- | ---
`R` | TreeVisitor.`visitOther​(Tree node, P p)` | Visits an unknown type of Tree node.

## Uses of Tree in com.sun.source.util

Methods in com.sun.source.util that return Tree
Modifier and Type | Method | Description
--- | --- | ---
`Tree` | TreePath.`getLeaf()` | Returns the leaf node for this path.
`abstract Tree` | Trees.`getTree​(Element element)` | Returns the Tree node for a given Element.
`abstract Tree` | Trees.`getTree​(Element e, AnnotationMirror a)` | Returns the Tree node for an AnnotationMirror on a given Element.
`abstract Tree` | Trees.`getTree​(Element e, AnnotationMirror a, AnnotationValue v)` | Returns the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.

Methods in com.sun.source.util that return types with arguments of type Tree
Modifier and Type | Method | Description
--- | --- | ---
`Iterator<Tree>` | TreePath.`iterator()` | Iterates from leaves to root.

Methods in com.sun.source.util with parameters of type Tree
Modifier and Type | Method | Description
--- | --- | ---
`protected R` | SimpleTreeVisitor.`defaultAction​(Tree node, P p)` | The default action, used by all visit methods that are not overridden.
`long` | SourcePositions.`getEndPosition​(CompilationUnitTree file, Tree tree)` | Returns the ending position of tree within file.
`static TreePath` | TreePath.`getPath​(CompilationUnitTree unit, Tree target)` | Returns a tree path for a tree node within a compilation unit, or `null` if the node is not found.
`static TreePath` | TreePath.`getPath​(TreePath path, Tree target)` | Returns a tree path for a tree node within a subtree identified by a TreePath object.
`abstract TreePath` | Trees.`getPath​(CompilationUnitTree unit, Tree node)` | Returns the path to tree node within the specified compilation unit.
`long` | SourcePositions.`getStartPosition​(CompilationUnitTree file, Tree tree)` | Returns the starting position of tree within file.
`abstract void` | Trees.`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
`R` | TreePathScanner.`scan​(Tree tree, P p)` | Scans a single node.
`R` | TreeScanner.`scan​(Tree tree, P p)` | Scans a single node.
`R` | SimpleTreeVisitor.`visit​(Tree node, P p)` | Invokes the appropriate visit method specific to the type of the node.
`R` | SimpleTreeVisitor.`visitOther​(Tree node, P p)` | Visits an unknown type of Tree node.
`R` | TreeScanner.`visitOther​(Tree node, P p)` | Visits an unknown type of Tree node.

Method parameters in com.sun.source.util with type arguments of type Tree
Modifier and Type | Method | Description
--- | --- | ---
`abstract TypeMirror` | JavacTask.`getTypeMirror​(Iterable<? extends Tree> path)` | Returns a type mirror of the tree node determined by the specified path.
`R` | TreeScanner.`scan​(Iterable<? extends Tree> nodes, P p)` | Scans a sequence of nodes.
`R` | SimpleTreeVisitor.`visit​(Iterable<? extends Tree> nodes, P p)` | Invokes the appropriate visit method on each of a sequence of nodes.

Constructors in com.sun.source.util with parameters of type Tree
Constructor | Description
--- | ---
`TreePath​(TreePath path, Tree tree)` | Creates a TreePath for a child node.