dk.brics.xact.analysis.soot
Class TranslatorContext

java.lang.Object
  extended by dk.brics.xact.analysis.soot.TranslatorContext

public class TranslatorContext
extends Object

Context for producing flow graph statements. This is simple storage with no actual functionality.


Constructor Summary
TranslatorContext(FlowGraph g, ErrorHandler errors)
          Constructs a new translator context.
 
Method Summary
 boolean definitelyNonNull(Value v)
           
 boolean definitelyNull(Value v)
           
 String expandQName(String qname)
          Expands a QName according to the current namespace declarations.
 Map<String,String> expandQNames(Map<String,String> qnames)
          Expands a QName map according to the current namespace declarations.
 ArrayConstantInfo getConstantArray(Value v)
          Returns the information known about the specified array variable, if any.
 Origin getConstantOrigin(Value v)
          Returns the origin constant value for the given Soot value.
 String getConstantString(Value v)
          Returns the string constant value for the given Soot value or null if it is a null constant.
 SootClass getCurrentClass()
          Returns the current class.
 int getCurrentLine()
          Returns the current line number.
 Method getCurrentMethod()
           
 Origin getCurrentOrigin()
          Returns the current origin.
 SootMethod getCurrentSootMethod()
          Returns the current method.
 ErrorHandler getErrors()
           
 Variable getField(SootField field)
           
 SchemaType getFieldSchemaType(SootField sf)
           
 FlowGraph getFlowGraph()
           
 Hierarchy getHierarchy()
          Returns the class hierarchy.
 Map<ValueBox,AnalyzeStm> getHotspotMap()
          Returns the map from soot expression hotspots to their corresponding statements in the flow graph.
 Variable getLocal(String name)
           
 Method getMethod(SootMethod method)
           
 String getModifiedPackageNameFromClassConstant(Value v)
           
 String getNamespace(Statement s)
           
 Map<String,String> getNamespaces()
          Returns the namespace declaration map (from prefix to URI).
 int getNextVarID()
          Returns the next fresh variable ID.
 Variable getNothing()
           
 String getResourceString(String name)
          Retrieves a resource string using the current class loader.
 ValueBox getStringHotspot1(Statement s)
           
 ValueBox getStringHotspot2(Statement s)
           
 List<SootClass> getSubclassesOfIncluding(RefType t)
           
 List<SootClass> getSubtypesOfIncluding(RefType type)
          Returns list of all classes extending or implementing the specified class or interface.
 List<SootClass> getSubtypesOfIncluding(SootClass clazz)
          Returns list of all classes extending or implementing the specified class or interface.
 String getTypeAnnotation(SootField sf)
          Returns the Type annotation for a field, or null if not present.
 String getTypeAnnotation(SootMethod m)
          Returns the Type annotation for a method return, or null if not present.
 String getTypeAnnotationForParameter(SootMethod m, int parameter)
          Returns the Type annotation for a method parameter, or null if not present.
 boolean hasConstantString(Value v)
           
 boolean implementsToXMLable(SootClass cl)
           
 boolean isAnnotatableType(Type t)
          Returns true if the specified type can have @Type annotations.
static boolean isStringType(ValueBox b)
          Returns an automaton representing the possible string values of the given Soot string expression.
 boolean isSubtypeOf(SootClass a, SootClass b)
          Returns true if the first argument is a subtype of the second argument.
 boolean isSubtypeOf(SootClass a, String b)
          Returns true if the first argument is a subtype of the class or interface named by the second argument.
 boolean isSubtypeOf(Type a, String b)
          Returns true if the first argument is a class or interface that is a subtype of the class or interface named by the second argument.
 boolean maybeNonNull(Value v)
           
 boolean maybeNull(Value v)
           
 SchemaType parseSchemaType(String annotation, Origin origin)
           
 void putHotspot(ValueBox expr, AnalyzeStm stm)
          Marks that the specified soot expression hotspot is being modelled by the specified analyze statement.
 void setArrayConstants(ArrayConstantAnalysis arrayConstants)
           
 void setCurrentClass(SootClass c)
          Sets the current class.
 void setCurrentLine(int line)
          Sets the current line number.
 void setCurrentSootMethod(SootMethod m)
          Sets the current method.
 void setCurrentUnit(Unit unit)
           
 void setFieldSchemaType(SootField sf, SchemaType type)
           
 void setMethod(SootMethod sm, Method method)
           
 void setNullness(NullnessAnalysis nullness)
           
 void setStringConstants(StringConstantAnalysis stringConstants)
           
 void setStringHotspot(Statement stm, ValueBox box)
           
 void setStringHotspot(Statement stm, ValueBox box1, ValueBox box2)
           
 void setStringHotspot(Statement stm, ValueBox box1, ValueBox box2, String namespace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TranslatorContext

public TranslatorContext(FlowGraph g,
                         ErrorHandler errors)
Constructs a new translator context.

Method Detail

definitelyNonNull

public boolean definitelyNonNull(Value v)

definitelyNull

public boolean definitelyNull(Value v)

expandQName

public String expandQName(String qname)
Expands a QName according to the current namespace declarations.


expandQNames

public Map<String,String> expandQNames(Map<String,String> qnames)
Expands a QName map according to the current namespace declarations.


getConstantArray

public ArrayConstantInfo getConstantArray(Value v)
Returns the information known about the specified array variable, if any.

Parameters:
v - any value (UNKNOWN is simply returned for non-array variables)
Returns:
an instance of ArrayConstantInfo (note that its contents may be null)
See Also:
ArrayConstantInfo, ArrayConstantAnalysis

getConstantOrigin

public Origin getConstantOrigin(Value v)
Returns the origin constant value for the given Soot value.

Throws:
XMLAnalysisException - if the value does not appear to be a constant origin

getConstantString

public String getConstantString(Value v)
Returns the string constant value for the given Soot value or null if it is a null constant.

Throws:
XMLAnalysisException - if the value does not appear to be a constant string

getCurrentClass

public SootClass getCurrentClass()
Returns the current class.


getCurrentLine

public int getCurrentLine()
Returns the current line number.


getCurrentMethod

public Method getCurrentMethod()

getCurrentOrigin

public Origin getCurrentOrigin()
Returns the current origin.


getCurrentSootMethod

public SootMethod getCurrentSootMethod()
Returns the current method.


getErrors

public ErrorHandler getErrors()

getField

public Variable getField(SootField field)

getFieldSchemaType

public SchemaType getFieldSchemaType(SootField sf)

getFlowGraph

public FlowGraph getFlowGraph()

getHierarchy

public Hierarchy getHierarchy()
Returns the class hierarchy.


getHotspotMap

public Map<ValueBox,AnalyzeStm> getHotspotMap()
Returns the map from soot expression hotspots to their corresponding statements in the flow graph.

Returns:
modifiable map backed by this object

getLocal

public Variable getLocal(String name)

getMethod

public Method getMethod(SootMethod method)

getModifiedPackageNameFromClassConstant

public String getModifiedPackageNameFromClassConstant(Value v)

getNamespace

public String getNamespace(Statement s)

getNamespaces

public Map<String,String> getNamespaces()
Returns the namespace declaration map (from prefix to URI).


getNextVarID

public int getNextVarID()
Returns the next fresh variable ID.


getNothing

public Variable getNothing()

getResourceString

public String getResourceString(String name)
Retrieves a resource string using the current class loader. Assumes UTF-8.


getStringHotspot1

public ValueBox getStringHotspot1(Statement s)

getStringHotspot2

public ValueBox getStringHotspot2(Statement s)

getSubclassesOfIncluding

public List<SootClass> getSubclassesOfIncluding(RefType t)

getSubtypesOfIncluding

public List<SootClass> getSubtypesOfIncluding(RefType type)
Returns list of all classes extending or implementing the specified class or interface.

Parameters:
type - a class or interface
Returns:
an unmodifiable list

getSubtypesOfIncluding

public List<SootClass> getSubtypesOfIncluding(SootClass clazz)
Returns list of all classes extending or implementing the specified class or interface.

Parameters:
clazz - a class or interface
Returns:
an unmodifiable list

getTypeAnnotation

public String getTypeAnnotation(SootField sf)
Returns the Type annotation for a field, or null if not present.


getTypeAnnotation

public String getTypeAnnotation(SootMethod m)
Returns the Type annotation for a method return, or null if not present.


getTypeAnnotationForParameter

public String getTypeAnnotationForParameter(SootMethod m,
                                            int parameter)
Returns the Type annotation for a method parameter, or null if not present.


hasConstantString

public boolean hasConstantString(Value v)

implementsToXMLable

public boolean implementsToXMLable(SootClass cl)

isAnnotatableType

public boolean isAnnotatableType(Type t)
Returns true if the specified type can have @Type annotations.


isStringType

public static boolean isStringType(ValueBox b)
Returns an automaton representing the possible string values of the given Soot string expression.


isSubtypeOf

public boolean isSubtypeOf(SootClass a,
                           SootClass b)
Returns true if the first argument is a subtype of the second argument.


isSubtypeOf

public boolean isSubtypeOf(SootClass a,
                           String b)
Returns true if the first argument is a subtype of the class or interface named by the second argument.


isSubtypeOf

public boolean isSubtypeOf(Type a,
                           String b)
Returns true if the first argument is a class or interface that is a subtype of the class or interface named by the second argument.


maybeNonNull

public boolean maybeNonNull(Value v)

maybeNull

public boolean maybeNull(Value v)

parseSchemaType

public SchemaType parseSchemaType(String annotation,
                                  Origin origin)

putHotspot

public void putHotspot(ValueBox expr,
                       AnalyzeStm stm)
Marks that the specified soot expression hotspot is being modelled by the specified analyze statement.

Parameters:
expr - a hotspot expression
stm - the corresponding statement in the flow graph

setArrayConstants

public void setArrayConstants(ArrayConstantAnalysis arrayConstants)

setCurrentClass

public void setCurrentClass(SootClass c)
Sets the current class.


setCurrentLine

public void setCurrentLine(int line)
Sets the current line number.


setCurrentSootMethod

public void setCurrentSootMethod(SootMethod m)
Sets the current method.


setCurrentUnit

public void setCurrentUnit(Unit unit)

setFieldSchemaType

public void setFieldSchemaType(SootField sf,
                               SchemaType type)

setMethod

public void setMethod(SootMethod sm,
                      Method method)

setNullness

public void setNullness(NullnessAnalysis nullness)

setStringConstants

public void setStringConstants(StringConstantAnalysis stringConstants)

setStringHotspot

public void setStringHotspot(Statement stm,
                             ValueBox box)

setStringHotspot

public void setStringHotspot(Statement stm,
                             ValueBox box1,
                             ValueBox box2)

setStringHotspot

public void setStringHotspot(Statement stm,
                             ValueBox box1,
                             ValueBox box2,
                             String namespace)


Copyright © 2005-2011 Aarhus University.