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

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

- Packages that use StatementTree
  Package | Description
  --- | ---
  com.sun.source.tree | Provides interfaces to represent source code as abstract syntax trees (AST).

- - ### Uses of StatementTree in com.sun.source.tree

    Subinterfaces of StatementTree in com.sun.source.tree
    Modifier and Type | Interface and Description
    --- | ---
    `interface` | `AssertTree` A tree node for an 'assert' statement.
    `interface` | `BlockTree` A tree node for a statement block.
    `interface` | `BreakTree` A tree node for a 'break' statement.
    `interface` | `ClassTree` A tree node for a class, interface, enum, or annotation type declaration.
    `interface` | `ContinueTree` A tree node for a 'continue' statement.
    `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` | `ExpressionStatementTree` A tree node for an expression statement.
    `interface` | `ForLoopTree` A tree node for a basic 'for' loop statement.
    `interface` | `IfTree` A tree node for an 'if' statement.
    `interface` | `LabeledStatementTree` A tree node for a labeled statement.
    `interface` | `ReturnTree` A tree node for a 'return' statement.
    `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` | `VariableTree` A tree node for a variable declaration.
    `interface` | `WhileLoopTree` A tree node for a 'while' loop statement.

    Methods in com.sun.source.tree that return StatementTree
    Modifier and Type | Method and Description
    --- | ---
    `StatementTree` | IfTree.`getElseStatement()`
    `StatementTree` | ForLoopTree.`getStatement()`
    `StatementTree` | LabeledStatementTree.`getStatement()`
    `StatementTree` | DoWhileLoopTree.`getStatement()`
    `StatementTree` | WhileLoopTree.`getStatement()`
    `StatementTree` | EnhancedForLoopTree.`getStatement()`
    `StatementTree` | IfTree.`getThenStatement()`

    Methods in com.sun.source.tree that return types with arguments of type StatementTree
    Modifier and Type | Method and Description
    --- | ---
    `List<? extends StatementTree>` | ForLoopTree.`getInitializer()`
    `List<? extends StatementTree>` | CaseTree.`getStatements()`
    `List<? extends StatementTree>` | BlockTree.`getStatements()`

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