public class AbstractTrap extends java.lang.Object implements Trap, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected UnitBox |
beginUnitBox
The first unit being trapped.
|
protected UnitBox |
endUnitBox
The unit just before the last unit being trapped.
|
protected SootClass |
exception
The exception being caught.
|
protected UnitBox |
handlerUnitBox
The unit to which execution flows after the caught exception is triggered.
|
protected java.util.List<UnitBox> |
unitBoxes
The list of unitBoxes referred to in this Trap (begin, end and handler.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractTrap(SootClass exception,
UnitBox beginUnitBox,
UnitBox endUnitBox,
UnitBox handlerUnitBox)
Creates an AbstractTrap with the given exception, handler, begin and end units.
|
Modifier and Type | Method and Description |
---|---|
void |
clearUnitBoxes() |
java.lang.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
Trap.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
Trap.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.
|
java.util.List<UnitBox> |
getUnitBoxes()
Returns the boxes for first, last and handler units.
|
void |
setBeginUnit(Unit beginUnit)
Sets the value to be returned by
Trap.getBeginUnit() to
beginUnit . |
void |
setEndUnit(Unit endUnit)
Sets the value to be returned by
Trap.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 . |
protected transient SootClass exception
protected UnitBox beginUnitBox
protected UnitBox endUnitBox
protected UnitBox handlerUnitBox
protected java.util.List<UnitBox> unitBoxes
public Unit getBeginUnit()
Trap
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 Trap.getEndUnit()
.
getBeginUnit
in interface Trap
public Unit getEndUnit()
Trap
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.
getEndUnit
in interface Trap
public Unit getHandlerUnit()
Trap
getHandlerUnit
in interface Trap
public UnitBox getHandlerUnitBox()
Trap
getHandlerUnitBox
in interface Trap
public UnitBox getBeginUnitBox()
Trap
Trap.getBeginUnit()
.getBeginUnitBox
in interface Trap
public UnitBox getEndUnitBox()
Trap
Trap.getEndUnit()
.getEndUnitBox
in interface Trap
public java.util.List<UnitBox> getUnitBoxes()
Trap
getUnitBoxes
in interface Trap
getUnitBoxes
in interface UnitBoxOwner
public void clearUnitBoxes()
clearUnitBoxes
in interface UnitBoxOwner
public SootClass getException()
Trap
getException
in interface Trap
public void setBeginUnit(Unit beginUnit)
Trap
Trap.getBeginUnit()
to
beginUnit
.setBeginUnit
in interface Trap
public void setEndUnit(Unit endUnit)
Trap
Trap.getEndUnit()
to
endUnit
.setEndUnit
in interface Trap
public void setHandlerUnit(Unit handlerUnit)
Trap
handlerUnit
.setHandlerUnit
in interface Trap
public void setException(SootClass exception)
Trap
exception
.setException
in interface Trap