soot.toolkits.exceptions
Class UnitThrowAnalysis

java.lang.Object
  extended by soot.toolkits.exceptions.AbstractThrowAnalysis
      extended by soot.toolkits.exceptions.UnitThrowAnalysis
All Implemented Interfaces:
ThrowAnalysis

public class UnitThrowAnalysis
extends AbstractThrowAnalysis

A 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.


Nested Class Summary
protected  class UnitThrowAnalysis.UnitSwitch
           
protected  class UnitThrowAnalysis.ValueSwitch
           
 
Constructor Summary
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.
 
Method Summary
 ThrowableSet mightThrow(Unit u)
          Returns a set representing the Throwable types that the specified unit might throw.
 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.
static UnitThrowAnalysis v()
          Returns the single instance of UnitThrowAnalysis.
 
Methods inherited from class soot.toolkits.exceptions.AbstractThrowAnalysis
mightThrowExplicitly, mightThrowExplicitly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitThrowAnalysis

public UnitThrowAnalysis(Singletons.Global g)
Constructs a UnitThrowAnalysis for inclusion in Soot's global variable manager, G.

Parameters:
g - guarantees that the constructor may only be called from Singletons.

UnitThrowAnalysis

protected UnitThrowAnalysis()
A protected constructor for use by unit tests.

Method Detail

v

public static UnitThrowAnalysis v()
Returns the single instance of UnitThrowAnalysis.

Returns:
Soot's UnitThrowAnalysis.

mightThrow

public ThrowableSet mightThrow(Unit u)
Description copied from interface: ThrowAnalysis
Returns a set representing the Throwable types that the specified unit might throw.

Specified by:
mightThrow in interface ThrowAnalysis
Specified by:
mightThrow in class AbstractThrowAnalysis
Parameters:
u - Unit whose exceptions are to be returned.
Returns:
a representation of the Throwable types that u might throw.

mightThrowImplicitly

public ThrowableSet mightThrowImplicitly(ThrowInst t)
Description copied from interface: ThrowAnalysis
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.

Specified by:
mightThrowImplicitly in interface ThrowAnalysis
Specified by:
mightThrowImplicitly in class AbstractThrowAnalysis
Parameters:
t - ThrowStmt whose implicit exceptions are to be returned.
Returns:
a representation of the types of exceptions that t might throw implicitly.

mightThrowImplicitly

public ThrowableSet mightThrowImplicitly(ThrowStmt t)
Description copied from interface: ThrowAnalysis
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.

Specified by:
mightThrowImplicitly in interface ThrowAnalysis
Specified by:
mightThrowImplicitly in class AbstractThrowAnalysis
Parameters:
t - ThrowStmt whose implicit exceptions are to be returned.
Returns:
a representation of the types of exceptions that t might throw implicitly.