Uses of Interface com.sun.source.tree.Tree (Java SE 21 & JDK 21)
Description: use: module: jdk.compiler, package: com.sun.source.tree, interface: Tree

# 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`
  `AnyPatternTreePREVIEW`
  Preview.
  A tree node for a binding pattern that matches a pattern with a variable of any name and a type of the match candidate; an unnamed pattern.
  `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`
  `BindingPatternTree`
  A binding pattern tree
  `interface`
  `BlockTree`
  A tree node for a statement block.
  `interface`
  `BreakTree`
  A tree node for a `break` statement.
  `interface`
  `CaseLabelTree`
  A marker interface for `Tree`s that may be used as `CaseTree` labels.
  `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, record, or annotation type declaration.
  `interface`
  `CompilationUnitTree`
  Represents the abstract syntax tree for ordinary compilation units and modular compilation units.
  `interface`
  `CompoundAssignmentTree`
  A tree node for compound assignment operator.
  `interface`
  `ConditionalExpressionTree`
  A tree node for the conditional operator `? :`.
  `interface`
  `ConstantCaseLabelTree`
  A case label element that refers to a constant expression
  `interface`
  `ContinueTree`
  A tree node for a `continue` statement.
  `interface`
  `DeconstructionPatternTree`
  A deconstruction pattern tree.
  `interface`
  `DefaultCaseLabelTree`
  A case label that marks `default` in `case null, default`.
  `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`
  `PatternCaseLabelTree`
  A case label element that refers to an expression
  `interface`
  `PatternTree`
  A tree node used as the base class for the different kinds of patterns.
  `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`
  `StringTemplateTreePREVIEW`
  Preview.
  A tree node for a string template expression.
  `interface`
  `SwitchExpressionTree`
  A tree node for a `switch` expression.
  `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`
  A tree node for a `yield` statement.
  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()`
  For case with kind CaseTree.CaseKind.RULE, returns the statement or expression after the arrow.
  `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.
  `default List<? extends Tree>`
  ClassTree.`getPermitsClause()`
  Returns the subclasses permitted by 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, or an empty list if there are no type declarations.
  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.
  `final 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.
  `final 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
  Modifier
  Constructor
  Description
  ``
  `TreePath(TreePath path, Tree tree)`
  Creates a TreePath for a child node.