StatementTree, Tree
public interface TryTree extends StatementTree
try statement. For example:
try
block
catches
finally
finallyBlock
| Modifier and Type | Method | Description |
|---|---|---|
BlockTree |
getBlock() |
Returns the block of the try statement. |
List |
getCatches() |
Returns any catch blocks provided in the try statement. |
BlockTree |
getFinallyBlock() |
Returns the finally block provided in the try statement, or null if there is none. |
List |
getResources() |
Returns any resource declarations provided in the try statement. |
BlockTree getBlock()
try statement.List<? extends CatchTree> getCatches()
try statement. The result will be an empty list if there are no catch blocks.BlockTree getFinallyBlock()
try statement, or null if there is none.List<? extends Tree> getResources()
try statement. The result will be an empty list if there are no resource declarations.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/tree/TryTree.html