|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.brics.string.java.StatementTranslatorFacadeImpl
public class StatementTranslatorFacadeImpl
Acts as the middle-man between MethodTranslator
and StatementTranslatorImpl
.
StatementTranslatorImpl
requires a large facade implementation to use (IntermediateFactory
),
and the method translator wants a simple-to-use statement translator.
This class satisfies both by acting as a facade pattern in both directions.
Constructor Summary | |
---|---|
StatementTranslatorFacadeImpl(StatementTranslator translator)
|
Method Summary | |
---|---|
void |
addHotspot(Variable var,
ValueBox box)
Registers the specified value box as a hotspot. |
void |
addStatement(Statement s)
Adds a statement to the intermediate program. |
boolean |
canBeNull(Local local)
Returns whether the specified local might be null at the current program point. |
Variable |
createVariable(VariableType type)
Creates a new variable with the specified type. |
void |
endBranch()
Ends the current branch, by removing the position stored by the previous call to IntermediateFactory.startBranch() ,
and restores the position marked by the startBranch before that. |
VariableType |
fromSootType(Type type)
|
Field |
getField(SootField field)
Returns the intermediate field corresponding to the specified field; |
Automaton |
getFieldType(SootField field)
Returns the static string type of the specified field, or null if the field has no static string type. |
Variable |
getLocal(Local local)
Returns the intermediate variable corresponding to the specified local. |
Method |
getMethod(SootMethod method)
Returns the intermediate method definition corresponding to the specified Soot method, or null if the method is external. |
Automaton |
getMethodReturnType(SootMethod method)
Returns the static string type of the specified method's return value, or null if the return value has no static string type. |
Variable |
getNothing()
Returns a variable representing everything we don't care about in the analysis. |
Variable |
getParameter(ParameterRef ref)
Returns the variable corresponding to a soot parameter reference |
Automaton |
getParameterType(ParameterRef ref)
Returns the static string type of the nth parameter to the specified method, or null if the parameter has no static string type. |
List<SootMethod> |
getTargetsOf(InstanceInvokeExpr expr)
Gets a list of possible targets for the specified invocation. |
Method |
getToStringMethod(SootClass c)
Returns the intermediate method representing the specified non-interface class's toString method. |
boolean |
isHotspot(ValueBox expr)
Returns true if the specified value is marked as a hotspot. |
boolean |
isSubtypeOf(SootClass a,
SootClass b)
Returns true if the first argument is a type that extends, implements, or equals the second argument. |
void |
setExpressionVariable(ValueBox value,
Variable variable)
Reports that the specified expression was evaluated and stored in the specified intermediate variable. |
void |
startBranch()
Remembers the current position in the program, so successive calls to IntermediateFactory.useBranch() jumps back here. |
TranslatedStatement |
translateStatement(Stmt stmt,
SootMethod sootMethod,
NullnessAnalysis nullAnalysis,
TranslationContext jt)
Translates the specified Jimple-statement into intermediate code, and returns the entry- and exitpoint for the created graph. |
void |
useBranch()
Jumps back to the statement added before the previous call to IntermediateFactory.startBranch() ,
so statements added with IntermediateFactory.addStatement(Statement) are added from there. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StatementTranslatorFacadeImpl(StatementTranslator translator)
Method Detail |
---|
public void addHotspot(Variable var, ValueBox box)
IntermediateFactory
IntermediateFactory.isHotspot(ValueBox)
returned true for
the specified value box.
addHotspot
in interface IntermediateFactory
var
- variable holding the result of the hotspto expressionbox
- value box containing the expression marked as a hotspotpublic void addStatement(Statement s)
IntermediateFactory
addStatement
in interface IntermediateFactory
s
- statement to add.public boolean canBeNull(Local local)
IntermediateFactory
canBeNull
in interface IntermediateFactory
local
- a soot local variable
public Variable createVariable(VariableType type)
IntermediateFactory
createVariable
in interface IntermediateFactory
type
- type of the variable to create.
public void endBranch()
IntermediateFactory
IntermediateFactory.startBranch()
,
and restores the position marked by the startBranch before that.
endBranch
in interface IntermediateFactory
public VariableType fromSootType(Type type)
fromSootType
in interface IntermediateFactory
public Field getField(SootField field)
IntermediateFactory
getField
in interface IntermediateFactory
public Automaton getFieldType(SootField field)
IntermediateFactory
getFieldType
in interface IntermediateFactory
field
- a field
public Variable getLocal(Local local)
IntermediateFactory
getLocal
in interface IntermediateFactory
public Method getMethod(SootMethod method)
IntermediateFactory
getMethod
in interface IntermediateFactory
public Automaton getMethodReturnType(SootMethod method)
IntermediateFactory
getMethodReturnType
in interface IntermediateFactory
method
- a soot method
public Variable getNothing()
IntermediateFactory
getNothing
in interface IntermediateFactory
public Variable getParameter(ParameterRef ref)
IntermediateFactory
getParameter
in interface IntermediateFactory
public Automaton getParameterType(ParameterRef ref)
IntermediateFactory
getParameterType
in interface IntermediateFactory
ref
- a parameter
public List<SootMethod> getTargetsOf(InstanceInvokeExpr expr)
IntermediateFactory
getTargetsOf
in interface IntermediateFactory
public Method getToStringMethod(SootClass c)
IntermediateFactory
getToStringMethod
in interface IntermediateFactory
c
- an application class that is not an interface.
public boolean isHotspot(ValueBox expr)
IntermediateFactory
isHotspot
in interface IntermediateFactory
public boolean isSubtypeOf(SootClass a, SootClass b)
IntermediateFactory
isSubtypeOf
in interface IntermediateFactory
public void setExpressionVariable(ValueBox value, Variable variable)
IntermediateFactory
setExpressionVariable
in interface IntermediateFactory
value
- a jimple expressionvariable
- an intermediate variablepublic void startBranch()
IntermediateFactory
IntermediateFactory.useBranch()
jumps back here.
startBranch
in interface IntermediateFactory
public TranslatedStatement translateStatement(Stmt stmt, SootMethod sootMethod, NullnessAnalysis nullAnalysis, TranslationContext jt)
StatementTranslatorFacade
translateStatement
in interface StatementTranslatorFacade
stmt
- the statement to translate.sootMethod
- the method whose body contains the statement.
public void useBranch()
IntermediateFactory
IntermediateFactory.startBranch()
,
so statements added with IntermediateFactory.addStatement(Statement)
are added from there.
useBranch
in interface IntermediateFactory
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |