public class FastHierarchy extends Object
| Modifier and Type | Class and Description |
|---|---|
protected class |
FastHierarchy.Interval |
| Modifier and Type | Field and Description |
|---|---|
protected Map<SootClass,FastHierarchy.Interval> |
classToInterval
For each class (NOT interface), this map contains a Interval, which is a pair of numbers giving a preorder and postorder
ordering of classes in the inheritance tree.
|
protected MultiMap<SootClass,SootClass> |
classToSubclasses
This map holds all key,value pairs such that value.getSuperclass() == key.
|
protected MultiMap<SootClass,SootClass> |
interfaceToAllImplementers
This map gives, for an interface, all concrete classes that implement that interface and all its subinterfaces, but NOT
their subclasses.
|
protected MultiMap<SootClass,SootClass> |
interfaceToAllSubinterfaces
This map is a transitive closure of interfaceToSubinterfaces, and each set contains its superinterface itself.
|
protected MultiMap<SootClass,SootClass> |
interfaceToImplementers
This map holds all key,value pairs such that value is a class (NOT an interface) and key is in value.getInterfaces().
|
protected MultiMap<SootClass,SootClass> |
interfaceToSubinterfaces
This map holds all key,value pairs such that value is an interface and key is in value.getInterfaces().
|
protected RefType |
rtCloneable |
protected RefType |
rtObject |
protected RefType |
rtSerializable |
protected Scene |
sc |
| Constructor and Description |
|---|
FastHierarchy()
Constructs a hierarchy from the current scene.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildInverseMaps() |
boolean |
canStoreClass(SootClass child,
SootClass parent)
Given an object of declared type child, returns true if the object can be stored in a variable of type parent.
|
protected boolean |
canStoreClassClassic(SootClass child,
SootClass parent)
"Classic" implementation using the intuitive approach (without using
FastHierarchy.Interval) to check whether
child can be stored in a type of parent: |
boolean |
canStoreType(Type child,
Type parent)
Given an object of declared type child, returns true if the object can be stored in a variable of type parent.
|
protected int |
dfsVisit(int start,
SootClass c) |
Set<SootClass> |
getAllImplementersOfInterface(SootClass parent)
For an interface parent (MUST be an interface), returns set of all implementers of it but NOT their subclasses.
|
Set<SootClass> |
getAllSubinterfaces(SootClass parent)
For an interface parent (MUST be an interface), returns set of all subinterfaces including
parent. |
Collection<SootClass> |
getSubclassesOf(SootClass c)
Gets the direct subclasses of a given class.
|
boolean |
isSubclass(SootClass child,
SootClass parent)
Return true if class child is a subclass of class parent, neither of them being allowed to be interfaces.
|
Set<SootMethod> |
resolveAbstractDispatch(SootClass abstractType,
SootMethod m)
Given an object of declared type C, returns the methods which could be called on an o.f() invocation.
|
Collection<SootMethod> |
resolveConcreteDispatch(Collection<Type> concreteTypes,
SootMethod m,
RefType declaredTypeOfBase) |
SootMethod |
resolveConcreteDispatch(SootClass concreteType,
SootMethod m)
Given an object of actual type C (o = new C()), returns the method which will be called on an o.f() invocation.
|
Collection<SootMethod> |
resolveConcreteDispatchWithoutFailing(Collection<Type> concreteTypes,
SootMethod m,
RefType declaredTypeOfBase) |
SootMethod |
resolveSpecialDispatch(SpecialInvokeExpr ie,
SootMethod container)
Returns the target for the given SpecialInvokeExpr.
|
protected MultiMap<SootClass,SootClass> classToSubclasses
protected MultiMap<SootClass,SootClass> interfaceToSubinterfaces
protected MultiMap<SootClass,SootClass> interfaceToImplementers
protected MultiMap<SootClass,SootClass> interfaceToAllSubinterfaces
protected MultiMap<SootClass,SootClass> interfaceToAllImplementers
protected Map<SootClass,FastHierarchy.Interval> classToInterval
protected Scene sc
protected final RefType rtObject
protected final RefType rtSerializable
protected final RefType rtCloneable
public FastHierarchy()
protected int dfsVisit(int start,
SootClass c)
protected void buildInverseMaps()
public boolean isSubclass(SootClass child, SootClass parent)
public Set<SootClass> getAllImplementersOfInterface(SootClass parent)
parent - the parent interface.public Set<SootClass> getAllSubinterfaces(SootClass parent)
parent.
This method can be used concurrently (is thread safe).parent - the parent interface.public boolean canStoreType(Type child, Type parent)
public boolean canStoreClass(SootClass child, SootClass parent)
protected boolean canStoreClassClassic(SootClass child, SootClass parent)
FastHierarchy.Interval) to check whether
child can be stored in a type of parent:
If parent is not an interface we simply traverse and check the super-classes of child.
If parent is an interface we traverse the super-classes of child and check each interface
implemented by this class. Also each interface is checked recursively for super interfaces it implements.
This implementation can be much faster (compared to the interval based implementation of
canStoreClass(SootClass, SootClass) in cases where one interface is implemented in thousands of classes.
child - parent - public Collection<SootMethod> resolveConcreteDispatchWithoutFailing(Collection<Type> concreteTypes, SootMethod m, RefType declaredTypeOfBase)
public Collection<SootMethod> resolveConcreteDispatch(Collection<Type> concreteTypes, SootMethod m, RefType declaredTypeOfBase)
public Set<SootMethod> resolveAbstractDispatch(SootClass abstractType, SootMethod m)
public SootMethod resolveConcreteDispatch(SootClass concreteType, SootMethod m)
public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container)
public Collection<SootClass> getSubclassesOf(SootClass c)
c - the classCopyright © 2020 Soot OSS. All rights reserved.