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