public class UnitThrowAnalysis extends AbstractThrowAnalysis
ThrowAnalysis
which returns the set of runtime exceptions
and errors that might be thrown by the bytecode instructions
represented by a unit, as indicated by the Java Virtual Machine
specification. I.e. this analysis is based entirely on the
“opcode” of the unit, the types of its arguments, and
the values of constant arguments.
The mightThrow
methods could be declared static.
They are left virtual to facilitate testing. For example,
to verify that the expressions in a method call are actually being
examined, a test case can override the mightThrow(SootMethod)
with an implementation which returns the empty set instead of
all possible exceptions.
Modifier and Type | Class and Description |
---|---|
protected class |
UnitThrowAnalysis.UnitSwitch |
protected class |
UnitThrowAnalysis.ValueSwitch |
Modifier and Type | Field and Description |
---|---|
static UnitThrowAnalysis |
interproceduralAnalysis |
protected boolean |
isInterproc |
protected <any> |
methodToThrowSet |
protected ThrowableSet.Manager |
mgr |
Modifier | Constructor and Description |
---|---|
protected |
UnitThrowAnalysis()
A protected constructor for use by unit tests.
|
|
UnitThrowAnalysis(Singletons.Global g)
Constructs a
UnitThrowAnalysis for inclusion in
Soot's global variable manager, G . |
Modifier and Type | Method and Description |
---|---|
protected ThrowableSet |
defaultResult() |
static UnitThrowAnalysis |
interproc() |
protected ThrowableSet |
mightThrow(SootMethod sm)
Returns the set of types that might be thrown as a result of
calling the specified method.
|
protected ThrowableSet |
mightThrow(SootMethodRef m) |
ThrowableSet |
mightThrow(Unit u)
Returns a set representing the
Throwable types that
the specified unit might throw. |
protected ThrowableSet |
mightThrow(Value v) |
ThrowableSet |
mightThrowImplicitly(ThrowInst t)
Returns a set representing the
Throwable types that
the specified throw instruction might throw implicitly, that is,
the possible types of errors which might arise in the course
of executing the throw instruction, rather than
the type of the throw 's operand. |
ThrowableSet |
mightThrowImplicitly(ThrowStmt t)
Returns a set representing the
Throwable types that
the specified throw statement might throw implicitly, that is,
the possible types of errors which might arise in the course
of executing the throw statement, rather than
the type of the throw 's operand. |
protected UnitThrowAnalysis.UnitSwitch |
unitSwitch() |
static UnitThrowAnalysis |
v()
Returns the single instance of
UnitThrowAnalysis . |
protected UnitThrowAnalysis.ValueSwitch |
valueSwitch() |
mightThrowExplicitly, mightThrowExplicitly
protected final ThrowableSet.Manager mgr
protected final boolean isInterproc
public static UnitThrowAnalysis interproceduralAnalysis
protected final <any> methodToThrowSet
public UnitThrowAnalysis(Singletons.Global g)
UnitThrowAnalysis
for inclusion in
Soot's global variable manager, G
.g
- guarantees that the constructor may only be called
from Singletons
.protected UnitThrowAnalysis()
public static UnitThrowAnalysis v()
UnitThrowAnalysis
.UnitThrowAnalysis
.public static UnitThrowAnalysis interproc()
protected ThrowableSet defaultResult()
protected UnitThrowAnalysis.UnitSwitch unitSwitch()
protected UnitThrowAnalysis.ValueSwitch valueSwitch()
public ThrowableSet mightThrow(Unit u)
ThrowAnalysis
Throwable
types that
the specified unit might throw.mightThrow
in interface ThrowAnalysis
mightThrow
in class AbstractThrowAnalysis
u
- Unit
whose exceptions are to be returned.Throwable
types that
u
might throw.public ThrowableSet mightThrowImplicitly(ThrowInst t)
ThrowAnalysis
Throwable
types that
the specified throw instruction might throw implicitly, that is,
the possible types of errors which might arise in the course
of executing the throw
instruction, rather than
the type of the throw
's operand.mightThrowImplicitly
in interface ThrowAnalysis
mightThrowImplicitly
in class AbstractThrowAnalysis
t
- ThrowStmt
whose implicit exceptions are
to be returned.t
might throw implicitly.public ThrowableSet mightThrowImplicitly(ThrowStmt t)
ThrowAnalysis
Throwable
types that
the specified throw statement might throw implicitly, that is,
the possible types of errors which might arise in the course
of executing the throw
statement, rather than
the type of the throw
's operand.mightThrowImplicitly
in interface ThrowAnalysis
mightThrowImplicitly
in class AbstractThrowAnalysis
t
- ThrowStmt
whose implicit exceptions are
to be returned.t
might throw implicitly.protected ThrowableSet mightThrow(Value v)
protected ThrowableSet mightThrow(SootMethodRef m)
protected ThrowableSet mightThrow(SootMethod sm)
sm
- method whose exceptions are to be returned.Throwable
types that m
might
throw.