Class ASTTryStatement

  • All Implemented Interfaces:
    Node, JavaNode, ScopedNode

    public class ASTTryStatement
    extends AbstractJavaNode
    Try statement node.
     TryStatement ::= "try" ( ResourceSpecification )? Block ( CatchStatement )* [ FinallyStatement ]
     
    • Method Detail

      • isTryWithResources

        public boolean isTryWithResources()
        Returns true if this node is a try-with-resources, in which case it has a ResourceSpecification child node.
      • getBody

        public ASTBlock getBody()
        Returns the body of this try statement.
      • getCatchClauses

        public List<ASTCatchStatement> getCatchClauses()
        Returns the catch clauses of this try statement. If there are none, returns an empty list.
      • getFinally

        public ASTFinallyStatement getFinally()
        Deprecated.
        Returns the finally statement of this try statement, if any.
        Returns:
        The finally statement, or null if there is none
      • getFinallyClause

        public ASTFinallyStatement getFinallyClause()
        Returns the finally clause of this try statement, if any.
        Returns:
        The finally statement, or null if there is none