KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > Trap


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 1997-1999 Raja Vallee-Rai
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
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /*
21  * Modified by the Sable Research Group and others 1997-1999.
22  * See the 'credits' file distributed with Soot for the complete list of
23  * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24  */

25
26
27 package soot;
28
29 import soot.util.*;
30 import java.util.*;
31
32 /** A trap (exception catcher), used within Body
33  * classes. Intermediate representations must use an implementation
34  * of Trap to describe caught exceptions.
35  * */

36 public interface Trap extends UnitBoxOwner
37 {
38     /** <p>Returns the first trapped unit, unless this <code>Trap</code>
39      * does not trap any units at all.</p>
40      *
41      * <p>If this is a degenerate <code>Trap</code> which
42      * traps no units (which can occur if all the units originally trapped by
43      * the exception handler have been optimized away), returns an
44      * untrapped unit. The returned unit will likely be the first unit
45      * remaining after the point where the trapped units were once
46      * located, but the only guarantee provided is that for such an
47      * empty trap, <code>getBeginUnit()</code> will return the same value
48      * as {@link #getEndUnit()}.</p>
49      */

50     public Unit getBeginUnit();
51
52     /** <p>Returns the unit following the last trapped unit (that is, the
53      * first succeeding untrapped unit in the underlying
54      * <Code>Chain</code>), unless this <code>Trap</code> does not trap
55      * any units at all.</p>
56      *
57      * <p>In the case of a degenerate <code>Trap</code> which traps
58      * no units, returns the same untrapped unit as
59      * <code>getBeginUnit()</code></p>
60      *
61      * <p>Note that a weakness of marking the end of the trapped region
62      * with the first untrapped unit is that Soot has no good mechanism
63      * for describing a <code>Trap</code> which traps the last unit
64      * in a method.</p>
65      */

66     public Unit getEndUnit();
67
68     /** Returns the unit handling the exception being trapped. */
69     public Unit getHandlerUnit();
70
71     /** Returns the box holding the unit returned by {@link #getBeginUnit()}. */
72     public UnitBox getBeginUnitBox();
73
74     /** Returns the box holding the unit returned by {@link #getEndUnit()}. */
75     public UnitBox getEndUnitBox();
76
77     /** Returns the box holding the exception handler's unit. */
78     public UnitBox getHandlerUnitBox();
79
80     /** Returns the boxes for first, last and handler units. */
81     public List getUnitBoxes();
82
83     /** Returns the exception being caught. */
84     public SootClass getException();
85
86     /** Sets the value to be returned by {@link #getBeginUnit()} to
87      * <code>beginUnit</code>. */

88     public void setBeginUnit(Unit beginUnit);
89
90     /** Sets the value to be returned by {@link #getEndUnit()} to
91      * <code>endUnit</code>. */

92     public void setEndUnit(Unit endUnit);
93
94     /** Sets the unit handling the exception to <code>handlerUnit</code>. */
95     public void setHandlerUnit(Unit handlerUnit);
96
97     /** Sets the exception being caught to <code>exception</code>. */
98     public void setException(SootClass exception);
99
100     /** Performs a shallow clone of this trap. */
101     public Object JavaDoc clone();
102 }
103
Popular Tags