KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > toolkits > exceptions > ThrowAnalysis


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 John Jorgensen
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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 package soot.toolkits.exceptions;
21
22 import soot.Unit;
23 import soot.baf.ThrowInst;
24 import soot.jimple.ThrowStmt;
25
26 /**
27  * <p>A source of information about the exceptions that
28  * {@link Unit}s might throw.</p>
29  *
30  * <p>The <code>Unit</code>s corresponding to <code>athrow</code>
31  * instructions may throw exceptions either explicitly&mdash;because
32  * the exception is the <code>athrow</code>'s argument&mdash; or
33  * implicitly&mdash;because some error arises in the course of
34  * executing the instruction (only implicit exceptions are possible
35  * for bytecode instructions other than <code>athrow</code>). The
36  * <code>mightThrowExplicitly()</code> and
37  * <code>mightThrowImplicitly()</code> methods allow analyses to
38  * exploit any extra precision that may be gained by distinguishing
39  * between an <code>athrow</code>'s implicit and explicit exceptions.</p>
40  */

41
42 public interface ThrowAnalysis {
43     /**
44      * Returns a set representing the {@link Throwable} types that
45      * the specified unit might throw.
46      *
47      * @param u {@link Unit} whose exceptions are to be returned.
48      *
49      * @return a representation of the <code>Throwable</code> types that
50      * <code>u</code> might throw.
51      */

52     ThrowableSet mightThrow(Unit u);
53
54     /**
55      * Returns a set representing the {@link Throwable} types that
56      * the specified throw instruction might throw explicitly, that is,
57      * the possible types for its <code>Throwable</code> argument.
58      *
59      * @param t {@link ThrowInst} whose explicit exceptions are
60      * to be returned.
61      *
62      * @return a representation of the possible types of
63      * <code>t</code>'s <code>Throwable</code> operand.
64      */

65     ThrowableSet mightThrowExplicitly(ThrowInst t);
66
67     /**
68      * Returns a set representing the {@link Throwable} types that
69      * the specified throw statement might throw explicitly, that is,
70      * the possible types for its <code>Throwable</code> argument.
71      *
72      * @param t {@link ThrowStmt} whose explicit exceptions are
73      * to be returned.
74      *
75      * @return a representation of the possible types of
76      * <code>t</code>'s <code>Throwable</code> operand.
77      */

78     ThrowableSet mightThrowExplicitly(ThrowStmt t);
79
80     /**
81      * Returns a set representing the {@link Throwable} types that
82      * the specified throw instruction might throw implicitly, that is,
83      * the possible types of errors which might arise in the course
84      * of executing the <code>throw</code> instruction, rather than
85      * the type of the <code>throw</code>'s operand.
86      *
87      * @param t {@link ThrowStmt} whose implicit exceptions are
88      * to be returned.
89      *
90      * @return a representation of the types of exceptions that
91      * <code>t</code> might throw implicitly.
92      */

93     ThrowableSet mightThrowImplicitly(ThrowInst t);
94
95     /**
96      * Returns a set representing the {@link Throwable} types that
97      * the specified throw statement might throw implicitly, that is,
98      * the possible types of errors which might arise in the course
99      * of executing the <code>throw</code> statement, rather than
100      * the type of the <code>throw</code>'s operand.
101      *
102      * @param t {@link ThrowStmt} whose implicit exceptions are
103      * to be returned.
104      *
105      * @return a representation of the types of exceptions that
106      * <code>t</code> might throw implicitly.
107      */

108     ThrowableSet mightThrowImplicitly(ThrowStmt t);
109
110 }
111
Popular Tags