Class AbstractTrap
- java.lang.Object
-
- soot.AbstractTrap
-
- All Implemented Interfaces:
Serializable,Trap,UnitBoxOwner
public class AbstractTrap extends Object implements Trap, Serializable
Partial implementation of trap (exception catcher), used within Body classes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected UnitBoxbeginUnitBoxThe first unit being trapped.protected UnitBoxendUnitBoxThe unit just before the last unit being trapped.protected SootClassexceptionThe exception being caught.protected UnitBoxhandlerUnitBoxThe unit to which execution flows after the caught exception is triggered.protected List<UnitBox>unitBoxesThe list of UnitBoxes referred to in this Trap (begin, end, and handler).
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTrap(SootClass exception, UnitBox beginUnitBox, UnitBox endUnitBox, UnitBox handlerUnitBox)Creates an AbstractTrap with the given exception, handler, begin, and end units.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearUnitBoxes()Objectclone()Performs a shallow clone of this trap.UnitgetBeginUnit()Returns the first trapped unit, unless thisTrapdoes not trap any units at all.UnitBoxgetBeginUnitBox()Returns the box holding the unit returned byTrap.getBeginUnit().UnitgetEndUnit()Returns the unit following the last trapped unit (that is, the first succeeding untrapped unit in the underlyingChain), unless thisTrapdoes not trap any units at all.UnitBoxgetEndUnitBox()Returns the box holding the unit returned byTrap.getEndUnit().SootClassgetException()Returns the exception being caught.UnitgetHandlerUnit()Returns the unit handling the exception being trapped.UnitBoxgetHandlerUnitBox()Returns the box holding the exception handler unit.List<UnitBox>getUnitBoxes()Returns the boxes for first, last, and handler units.voidsetBeginUnit(Unit beginUnit)Sets the value to be returned byTrap.getBeginUnit()tobeginUnit.voidsetEndUnit(Unit endUnit)Sets the value to be returned byTrap.getEndUnit()toendUnit.voidsetException(SootClass exception)Sets the exception being caught toexception.voidsetHandlerUnit(Unit handlerUnit)Sets the unit handling the exception tohandlerUnit.
-
-
-
Field Detail
-
exception
protected transient SootClass exception
The exception being caught.
-
beginUnitBox
protected UnitBox beginUnitBox
The first unit being trapped.
-
endUnitBox
protected UnitBox endUnitBox
The unit just before the last unit being trapped.
-
handlerUnitBox
protected UnitBox handlerUnitBox
The unit to which execution flows after the caught exception is triggered.
-
-
Method Detail
-
getBeginUnit
public Unit getBeginUnit()
Description copied from interface:TrapReturns the first trapped unit, unless this
Trapdoes not trap any units at all.If this is a degenerate
Trapwhich 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 asTrap.getEndUnit().- Specified by:
getBeginUnitin interfaceTrap
-
getEndUnit
public Unit getEndUnit()
Description copied from interface:TrapReturns the unit following the last trapped unit (that is, the first succeeding untrapped unit in the underlying
Chain), unless thisTrapdoes not trap any units at all.In the case of a degenerate
Trapwhich traps no units, returns the same untrapped unit asgetBeginUnit()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
Trapwhich traps the last unit in a method.- Specified by:
getEndUnitin interfaceTrap
-
getHandlerUnit
public Unit getHandlerUnit()
Description copied from interface:TrapReturns the unit handling the exception being trapped.- Specified by:
getHandlerUnitin interfaceTrap
-
getHandlerUnitBox
public UnitBox getHandlerUnitBox()
Description copied from interface:TrapReturns the box holding the exception handler unit.- Specified by:
getHandlerUnitBoxin interfaceTrap
-
getBeginUnitBox
public UnitBox getBeginUnitBox()
Description copied from interface:TrapReturns the box holding the unit returned byTrap.getBeginUnit().- Specified by:
getBeginUnitBoxin interfaceTrap
-
getEndUnitBox
public UnitBox getEndUnitBox()
Description copied from interface:TrapReturns the box holding the unit returned byTrap.getEndUnit().- Specified by:
getEndUnitBoxin interfaceTrap
-
getUnitBoxes
public List<UnitBox> getUnitBoxes()
Description copied from interface:TrapReturns the boxes for first, last, and handler units.- Specified by:
getUnitBoxesin interfaceTrap- Specified by:
getUnitBoxesin interfaceUnitBoxOwner
-
clearUnitBoxes
public void clearUnitBoxes()
- Specified by:
clearUnitBoxesin interfaceUnitBoxOwner
-
getException
public SootClass getException()
Description copied from interface:TrapReturns the exception being caught.- Specified by:
getExceptionin interfaceTrap
-
setBeginUnit
public void setBeginUnit(Unit beginUnit)
Description copied from interface:TrapSets the value to be returned byTrap.getBeginUnit()tobeginUnit.- Specified by:
setBeginUnitin interfaceTrap
-
setEndUnit
public void setEndUnit(Unit endUnit)
Description copied from interface:TrapSets the value to be returned byTrap.getEndUnit()toendUnit.- Specified by:
setEndUnitin interfaceTrap
-
setHandlerUnit
public void setHandlerUnit(Unit handlerUnit)
Description copied from interface:TrapSets the unit handling the exception tohandlerUnit.- Specified by:
setHandlerUnitin interfaceTrap
-
setException
public void setException(SootClass exception)
Description copied from interface:TrapSets the exception being caught toexception.- Specified by:
setExceptionin interfaceTrap
-
-