KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > alt > jiapi > reflect > ExceptionTable


1 /*
2  * Copyright(C) 2001 Mika Riekkinen, Joni Suominen
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or(at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package alt.jiapi.reflect;
20
21 import java.util.Iterator JavaDoc;
22 import java.util.LinkedList JavaDoc;
23 import java.util.List JavaDoc;
24
25 import alt.jiapi.reflect.Instruction;
26
27 /**
28  * This class represents a low level Exception table in JiapiMethod.
29  *
30  * @author Mika Riekkinen
31  * @author Joni Suominen
32  * @version $Revision: 1.3 $ $Date: 2004/02/22 16:13:37 $
33  */

34
35 //
36
// !!!! Should be package protected !!!!
37
// This can be done once JiapiMethod has addTryBlock(...) method
38
//
39
public class ExceptionTable {
40     private LinkedList JavaDoc entries = new LinkedList JavaDoc();
41
42     /**
43      * Adds an entry.
44      * @param start Start of the try block
45      * @param end end of the try block
46      * @param handlerStart Start of the Exception Handler
47      */

48     public void addEntry(Instruction start, Instruction end,
49                          Instruction handlerStart, String JavaDoc name) {
50 // System.out.println("Adding Exception table entry for " + name + ":" +
51
// start + "<-->" + end + "==>" + handlerStart);
52
entries.add(new Entry(start, end, handlerStart, name));
53     }
54
55     /**
56      * Gets the entries in this Exception table.
57      */

58     public List JavaDoc getEntries() {
59         return entries;
60     }
61
62     // Entry in ExceptionTable
63
class Entry {
64         public Instruction start;
65         public Instruction end;
66         public Instruction handlerStart;
67         public String JavaDoc name;
68
69         Entry(Instruction start, Instruction end,
70               Instruction handlerStart, String JavaDoc name) {
71             this.start = start;
72             this.end = end;
73             this.handlerStart = handlerStart;
74             this.name = name;
75         }
76     }
77 }
78
Popular Tags