Uses of Package com.sun.source.tree (Compiler Tree API )
Date: 2026-03-29

# Uses of Package
com.sun.source.tree

- Packages that use com.sun.source.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).

- Classes in com.sun.source.tree used by com.sun.source.tree
  Class and Description
  AnnotatedTypeTree A tree node for an annotated type For example:
  AnnotationTree A tree node for an annotation.
  ArrayAccessTree A tree node for an array access expression.
  ArrayTypeTree A tree node for an array type.
  AssertTree A tree node for an 'assert' statement.
  AssignmentTree A tree node for an assignment expression.
  BinaryTree A tree node for a binary expression.
  BlockTree A tree node for a statement block.
  BreakTree A tree node for a 'break' statement.
  CaseTree A tree node for a 'case' in a 'switch' statement.
  CatchTree A tree node for a 'catch' block in a 'try' statement.
  ClassTree A tree node for a class, interface, enum, or annotation type declaration.
  CompilationUnitTree Represents the abstract syntax tree for compilation units (source files) and package declarations (package-info.java).
  CompoundAssignmentTree A tree node for compound assignment operator.
  ConditionalExpressionTree A tree node for the conditional operator ? :.
  ContinueTree A tree node for a 'continue' statement.
  DoWhileLoopTree A tree node for a 'do' statement.
  EmptyStatementTree A tree node for an empty (skip) statement.
  EnhancedForLoopTree A tree node for an "enhanced" 'for' loop statement.
  ErroneousTree A tree node to stand in for a malformed expression.
  ExpressionStatementTree A tree node for an expression statement.
  ExpressionTree A tree node used as the base class for the different types of expressions.
  ForLoopTree A tree node for a basic 'for' loop statement.
  IdentifierTree A tree node for an identifier expression.
  IfTree A tree node for an 'if' statement.
  ImportTree A tree node for an import statement.
  InstanceOfTree A tree node for an 'instanceof' expression.
  IntersectionTypeTree A tree node for an intersection type in a cast expression.
  LabeledStatementTree A tree node for a labeled statement.
  LambdaExpressionTree A tree node for a lambda expression.
  LambdaExpressionTree.BodyKind Lambda expressions come in two forms: (i) expression lambdas, whose body is an expression, and (ii) statement lambdas, whose body is a block
  LineMap Provides methods to convert between character positions and line numbers for a compilation unit.
  LiteralTree A tree node for a literal expression.
  MemberReferenceTree A tree node for a member reference expression.
  MemberReferenceTree.ReferenceMode There are two kinds of member references: (i) method references and (ii) constructor references
  MemberSelectTree A tree node for a member access expression.
  MethodInvocationTree A tree node for a method invocation expression.
  MethodTree A tree node for a method or annotation type element declaration.
  ModifiersTree A tree node for the modifiers, including annotations, for a declaration.
  NewArrayTree A tree node for an expression to create a new instance of an array.
  NewClassTree A tree node to declare a new instance of a class.
  ParameterizedTypeTree A tree node for a type expression involving type parameters.
  ParenthesizedTree A tree node for a parenthesized expression.
  PrimitiveTypeTree A tree node for a primitive type.
  ReturnTree A tree node for a 'return' statement.
  Scope Interface for determining locally available program elements, such as local variables and imports.
  StatementTree A tree node used as the base class for the different kinds of statements.
  SwitchTree A tree node for a 'switch' statement.
  SynchronizedTree A tree node for a 'synchronized' statement.
  ThrowTree A tree node for a 'throw' statement.
  Tree Common interface for all nodes in an abstract syntax tree.
  Tree.Kind Enumerates all kinds of trees.
  TreeVisitor A visitor of trees, in the style of the visitor design pattern.
  TryTree A tree node for a 'try' statement.
  TypeCastTree A tree node for a type cast expression.
  TypeParameterTree A tree node for a type parameter.
  UnaryTree A tree node for postfix and unary expressions.
  UnionTypeTree A tree node for a union type expression in a multicatch var declaration.
  VariableTree A tree node for a variable declaration.
  WhileLoopTree A tree node for a 'while' loop statement.
  WildcardTree A tree node for a wildcard type argument.

- Classes in com.sun.source.tree used by com.sun.source.util
  Class and Description
  AnnotatedTypeTree A tree node for an annotated type For example:
  AnnotationTree A tree node for an annotation.
  ArrayAccessTree A tree node for an array access expression.
  ArrayTypeTree A tree node for an array type.
  AssertTree A tree node for an 'assert' statement.
  AssignmentTree A tree node for an assignment expression.
  BinaryTree A tree node for a binary expression.
  BlockTree A tree node for a statement block.
  BreakTree A tree node for a 'break' statement.
  CaseTree A tree node for a 'case' in a 'switch' statement.
  CatchTree A tree node for a 'catch' block in a 'try' statement.
  ClassTree A tree node for a class, interface, enum, or annotation type declaration.
  CompilationUnitTree Represents the abstract syntax tree for compilation units (source files) and package declarations (package-info.java).
  CompoundAssignmentTree A tree node for compound assignment operator.
  ConditionalExpressionTree A tree node for the conditional operator ? :.
  ContinueTree A tree node for a 'continue' statement.
  DoWhileLoopTree A tree node for a 'do' statement.
  EmptyStatementTree A tree node for an empty (skip) statement.
  EnhancedForLoopTree A tree node for an "enhanced" 'for' loop statement.
  ErroneousTree A tree node to stand in for a malformed expression.
  ExpressionStatementTree A tree node for an expression statement.
  ForLoopTree A tree node for a basic 'for' loop statement.
  IdentifierTree A tree node for an identifier expression.
  IfTree A tree node for an 'if' statement.
  ImportTree A tree node for an import statement.
  InstanceOfTree A tree node for an 'instanceof' expression.
  IntersectionTypeTree A tree node for an intersection type in a cast expression.
  LabeledStatementTree A tree node for a labeled statement.
  LambdaExpressionTree A tree node for a lambda expression.
  LiteralTree A tree node for a literal expression.
  MemberReferenceTree A tree node for a member reference expression.
  MemberSelectTree A tree node for a member access expression.
  MethodInvocationTree A tree node for a method invocation expression.
  MethodTree A tree node for a method or annotation type element declaration.
  ModifiersTree A tree node for the modifiers, including annotations, for a declaration.
  NewArrayTree A tree node for an expression to create a new instance of an array.
  NewClassTree A tree node to declare a new instance of a class.
  ParameterizedTypeTree A tree node for a type expression involving type parameters.
  ParenthesizedTree A tree node for a parenthesized expression.
  PrimitiveTypeTree A tree node for a primitive type.
  ReturnTree A tree node for a 'return' statement.
  Scope Interface for determining locally available program elements, such as local variables and imports.
  SwitchTree A tree node for a 'switch' statement.
  SynchronizedTree A tree node for a 'synchronized' statement.
  ThrowTree A tree node for a 'throw' statement.
  Tree Common interface for all nodes in an abstract syntax tree.
  TreeVisitor A visitor of trees, in the style of the visitor design pattern.
  TryTree A tree node for a 'try' statement.
  TypeCastTree A tree node for a type cast expression.
  TypeParameterTree A tree node for a type parameter.
  UnaryTree A tree node for postfix and unary expressions.
  UnionTypeTree A tree node for a union type expression in a multicatch var declaration.
  VariableTree A tree node for a variable declaration.
  WhileLoopTree A tree node for a 'while' loop statement.
  WildcardTree A tree node for a wildcard type argument.

Copyright © 2005, 2026, Oracle and/or its affiliates. All rights reserved.