1
2
3 package net.sourceforge.pmd.ast;
4
5
6
7 public class ASTTryStatement extends SimpleNode {
8
9 public ASTTryStatement(int id) {
10 super(id);
11 }
12
13 public ASTTryStatement(JavaParser p, int id) {
14 super(p, id);
15 }
16
17 /***
18 * Accept the visitor. *
19 */
20 public Object jjtAccept(JavaParserVisitor visitor, Object data) {
21 return visitor.visit(this, data);
22 }
23
24 public boolean hasFinally() {
25 for (int i =0; i<this.jjtGetNumChildren(); i++) {
26 if (jjtGetChild(i) instanceof ASTFinallyStatement) {
27 return true;
28 }
29 }
30 return false;
31 }
32
33 public ASTFinallyStatement getFinally() {
34 for (int i =0; i<this.jjtGetNumChildren(); i++) {
35 if (jjtGetChild(i) instanceof ASTFinallyStatement) {
36 return (ASTFinallyStatement)jjtGetChild(i);
37 }
38 }
39 throw new RuntimeException("ASTTryStatement.getFinally called but this try stmt doesn't contain a finally block");
40 }
41
42 }