Package soot

Class Hierarchy


  • public class Hierarchy
    extends Object
    Represents the class hierarchy. It is closely linked to a Scene, and must be recreated if the Scene changes. The general convention is that if a method name contains "Including", then it returns the non-strict result; otherwise, it does a strict query (e.g. strict superclass).
    • Constructor Detail

      • Hierarchy

        public Hierarchy()
        Constructs a hierarchy from the current scene.
    • Method Detail

      • initializeHierarchy

        protected void initializeHierarchy​(Chain<SootClass> allClasses)
        Initializes the hierarchy given a chain of all classes that shall be included in the hierarchy
        Parameters:
        allClasses - The chain of all classes to be included in the hierarchy
      • checkState

        protected void checkState()
      • getSubclassesOfIncluding

        public List<SootClass> getSubclassesOfIncluding​(SootClass c)
        Returns a list of subclasses of c, including itself.
      • getSubclassesOf

        public List<SootClass> getSubclassesOf​(SootClass c)
        Returns a list of subclasses of c, excluding itself.
      • getSuperclassesOfIncluding

        public List<SootClass> getSuperclassesOfIncluding​(SootClass sootClass)
        Returns a list of superclasses of sootClass, including itself.
        Parameters:
        sootClass - the class of which superclasses will be taken. Must not be null or interface
        Returns:
        list of superclasses, including itself
        Throws:
        IllegalArgumentException - when passed class is an interface
        NullPointerException - when passed argument is null
      • getSuperclassesOf

        public List<SootClass> getSuperclassesOf​(SootClass sootClass)
        Returns a list of direct superclasses of passed class in reverse order, starting with its parent.
        Parameters:
        sootClass - the class of which superclasses will be taken. Must not be null or interface
        Returns:
        list of superclasses
        Throws:
        IllegalArgumentException - when passed class is an interface
        NullPointerException - when passed argument is null
      • getSubinterfacesOfIncluding

        public List<SootClass> getSubinterfacesOfIncluding​(SootClass sootClass)
        Returns a list of subinterfaces of sootClass, including itself.
        Parameters:
        sootClass - the interface of which subinterfaces will be taken. Must not be null or class
        Returns:
        list of subinterfaces, including passed one
        Throws:
        IllegalArgumentException - when passed class is a class
        NullPointerException - when passed argument is null
      • getSubinterfacesOf

        public List<SootClass> getSubinterfacesOf​(SootClass sootClass)
        Returns a list of subinterfaces of sootClass, excluding itself.
        Parameters:
        sootClass - the interface of which subinterfaces will be taken. Must not be null or class
        Returns:
        list of subinterfaces, including passed one
        Throws:
        IllegalArgumentException - when passed sootClass is a class
        NullPointerException - when passed argument is null
      • getSuperinterfacesOfIncluding

        public List<SootClass> getSuperinterfacesOfIncluding​(SootClass c)
        Returns a list of superinterfaces of c, including itself.
      • getSuperinterfacesOf

        public List<SootClass> getSuperinterfacesOf​(SootClass c)
        Returns a list of superinterfaces of c, excluding itself.
      • getDirectSuperclassesOf

        public List<SootClass> getDirectSuperclassesOf​(SootClass c)
        Returns a list of direct superclasses of c, excluding c.
      • getDirectSubclassesOf

        public List<SootClass> getDirectSubclassesOf​(SootClass c)
        Returns a list of direct subclasses of c, excluding c.
      • getDirectSubclassesOfIncluding

        public List<SootClass> getDirectSubclassesOfIncluding​(SootClass c)
        Returns a list of direct subclasses of c, including c.
      • getDirectSuperinterfacesOf

        public List<SootClass> getDirectSuperinterfacesOf​(SootClass c)
        Returns a list of direct superinterfaces of c.
      • getDirectSubinterfacesOf

        public List<SootClass> getDirectSubinterfacesOf​(SootClass c)
        Returns a list of direct subinterfaces of c.
      • getDirectSubinterfacesOfIncluding

        public List<SootClass> getDirectSubinterfacesOfIncluding​(SootClass c)
        Returns a list of direct subinterfaces of c, including itself.
      • getDirectImplementersOf

        public List<SootClass> getDirectImplementersOf​(SootClass i)
        Returns a list of direct implementers of c, excluding itself.
      • getImplementersOf

        public List<SootClass> getImplementersOf​(SootClass i)
        Returns a list of implementers of c, excluding itself.
      • isClassSubclassOf

        public boolean isClassSubclassOf​(SootClass child,
                                         SootClass possibleParent)
        Returns true if child is a subclass of possibleParent. If one of the known parent classes is phantom, we conservatively assume that the current class might be a child.
      • isClassSubclassOfIncluding

        public boolean isClassSubclassOfIncluding​(SootClass child,
                                                  SootClass possibleParent)
        Returns true if child is, or is a subclass of, possibleParent. If one of the known parent classes is phantom, we conservatively assume that the current class might be a child.
      • isClassDirectSubclassOf

        public boolean isClassDirectSubclassOf​(SootClass c,
                                               SootClass c2)
        Returns true if child is a direct subclass of possibleParent.
      • isClassSuperclassOf

        public boolean isClassSuperclassOf​(SootClass parent,
                                           SootClass possibleChild)
        Returns true if child is a superclass of possibleParent.
      • isClassSuperclassOfIncluding

        public boolean isClassSuperclassOfIncluding​(SootClass parent,
                                                    SootClass possibleChild)
        Returns true if parent is, or is a superclass of, possibleChild.
      • isInterfaceSubinterfaceOf

        public boolean isInterfaceSubinterfaceOf​(SootClass child,
                                                 SootClass possibleParent)
        Returns true if child is a subinterface of possibleParent.
      • isInterfaceDirectSubinterfaceOf

        public boolean isInterfaceDirectSubinterfaceOf​(SootClass child,
                                                       SootClass possibleParent)
        Returns true if child is a direct subinterface of possibleParent.
      • isInterfaceSuperinterfaceOf

        public boolean isInterfaceSuperinterfaceOf​(SootClass parent,
                                                   SootClass possibleChild)
        Returns true if parent is a superinterface of possibleChild.
      • isInterfaceDirectSuperinterfaceOf

        public boolean isInterfaceDirectSuperinterfaceOf​(SootClass parent,
                                                         SootClass possibleChild)
        Returns true if parent is a direct superinterface of possibleChild.
      • getLeastCommonSuperclassOf

        public SootClass getLeastCommonSuperclassOf​(SootClass c1,
                                                    SootClass c2)
        Returns the most specific type which is an ancestor of both c1 and c2.
      • isVisible

        public boolean isVisible​(SootClass from,
                                 SootClass check)
        Checks whether check is a visible class in view of the from class. It assumes that protected and private classes do not exit. If they exist and check is either protected or private, the check will return false.
      • isVisible

        public boolean isVisible​(SootClass from,
                                 ClassMember m)
        Returns true if the classmember m is visible from code in the class from.
      • resolveConcreteDispatch

        public 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.
      • resolveConcreteDispatch

        public List<SootMethod> resolveConcreteDispatch​(List<Type> classes,
                                                        SootMethod m)
        Given a set of definite receiver types, returns a list of possible targets.
      • resolveAbstractDispatch

        public List<SootMethod> resolveAbstractDispatch​(SootClass c,
                                                        SootMethod m)
        Given an abstract dispatch to an object of type c and a method m, gives a list of possible receiver methods.
      • resolveAbstractDispatch

        public List<SootMethod> resolveAbstractDispatch​(List<SootClass> classes,
                                                        SootMethod m)
        Returns a list of possible targets for the given method and set of receiver types.