soot
Interface Trap

All Superinterfaces:
UnitBoxOwner
All Known Implementing Classes:
AbstractTrap, BTrap, GTrap, JTrap

public interface Trap
extends UnitBoxOwner

A trap (exception catcher), used within Body classes. Intermediate representations must use an implementation of Trap to describe caught exceptions.


Method Summary
 Object clone()
          Performs a shallow clone of this trap.
 Unit getBeginUnit()
          Returns the first trapped unit, unless this Trap does not trap any units at all.
 UnitBox getBeginUnitBox()
          Returns the box holding the unit returned by getBeginUnit().
 Unit getEndUnit()
          Returns the unit following the last trapped unit (that is, the first succeeding untrapped unit in the underlying Chain), unless this Trap does not trap any units at all.
 UnitBox getEndUnitBox()
          Returns the box holding the unit returned by getEndUnit().
 SootClass getException()
          Returns the exception being caught.
 Unit getHandlerUnit()
          Returns the unit handling the exception being trapped.
 UnitBox getHandlerUnitBox()
          Returns the box holding the exception handler's unit.
 List<UnitBox> getUnitBoxes()
          Returns the boxes for first, last and handler units.
 void setBeginUnit(Unit beginUnit)
          Sets the value to be returned by getBeginUnit() to beginUnit.
 void setEndUnit(Unit endUnit)
          Sets the value to be returned by getEndUnit() to endUnit.
 void setException(SootClass exception)
          Sets the exception being caught to exception.
 void setHandlerUnit(Unit handlerUnit)
          Sets the unit handling the exception to handlerUnit.
 
Methods inherited from interface soot.UnitBoxOwner
clearUnitBoxes
 

Method Detail

getBeginUnit

Unit getBeginUnit()

Returns the first trapped unit, unless this Trap does not trap any units at all.

If this is a degenerate Trap which traps no units (which can occur if all the units originally trapped by the exception handler have been optimized away), returns an untrapped unit. The returned unit will likely be the first unit remaining after the point where the trapped units were once located, but the only guarantee provided is that for such an empty trap, getBeginUnit() will return the same value as getEndUnit().


getEndUnit

Unit getEndUnit()

Returns the unit following the last trapped unit (that is, the first succeeding untrapped unit in the underlying Chain), unless this Trap does not trap any units at all.

In the case of a degenerate Trap which traps no units, returns the same untrapped unit as getBeginUnit()

Note that a weakness of marking the end of the trapped region with the first untrapped unit is that Soot has no good mechanism for describing a Trap which traps the last unit in a method.


getHandlerUnit

Unit getHandlerUnit()
Returns the unit handling the exception being trapped.


getBeginUnitBox

UnitBox getBeginUnitBox()
Returns the box holding the unit returned by getBeginUnit().


getEndUnitBox

UnitBox getEndUnitBox()
Returns the box holding the unit returned by getEndUnit().


getHandlerUnitBox

UnitBox getHandlerUnitBox()
Returns the box holding the exception handler's unit.


getUnitBoxes

List<UnitBox> getUnitBoxes()
Returns the boxes for first, last and handler units.

Specified by:
getUnitBoxes in interface UnitBoxOwner

getException

SootClass getException()
Returns the exception being caught.


setBeginUnit

void setBeginUnit(Unit beginUnit)
Sets the value to be returned by getBeginUnit() to beginUnit.


setEndUnit

void setEndUnit(Unit endUnit)
Sets the value to be returned by getEndUnit() to endUnit.


setHandlerUnit

void setHandlerUnit(Unit handlerUnit)
Sets the unit handling the exception to handlerUnit.


setException

void setException(SootClass exception)
Sets the exception being caught to exception.


clone

Object clone()
Performs a shallow clone of this trap.