Package soot

Class ModuleScene


  • public class ModuleScene
    extends Scene
    Manages the SootClasses of the application being analyzed for Java 9 modules.
    Author:
    Andreas Dann
    • Method Detail

      • extendSootModulePath

        public void extendSootModulePath​(String newPathElement)
      • getSootModulePath

        public String getSootModulePath()
      • setSootModulePath

        public void setSootModulePath​(String p)
      • addClassSilent

        protected void addClassSilent​(SootClass c)
        Description copied from class: Scene
        Adds the given class to the Scene. This method does not handle any dependencies such as invalidating the hierarchy. The class is neither marked as application class, nor library class.
        Overrides:
        addClassSilent in class Scene
        Parameters:
        c - The class to add
      • containsClass

        public boolean containsClass​(String className,
                                     com.google.common.base.Optional<String> moduleName)
      • tryLoadClass

        public SootClass tryLoadClass​(String className,
                                      int desiredLevel,
                                      com.google.common.base.Optional<String> moduleName)
        Attempts to load the given class and all of the required support classes. Returns the original class if it was loaded, or null otherwise.
      • loadClassAndSupport

        public SootClass loadClassAndSupport​(String className)
        Loads the given class and all of the required support classes. Returns the first class.
        Overrides:
        loadClassAndSupport in class Scene
      • loadClassAndSupport

        public SootClass loadClassAndSupport​(String className,
                                             com.google.common.base.Optional<String> moduleName)
      • loadClass

        public SootClass loadClass​(String className,
                                   int desiredLevel,
                                   com.google.common.base.Optional<String> moduleName)
      • getRefType

        public RefType getRefType​(String className)
        Description copied from class: Scene
        Returns the RefType with the given className.
        Overrides:
        getRefType in class Scene
      • getRefTypeUnsafe

        public RefType getRefTypeUnsafe​(String className,
                                        com.google.common.base.Optional<String> moduleName)
        Returns the RefType with the given className. Returns null if no type with the given name can be found.
      • getRefTypeUnsafe

        public RefType getRefTypeUnsafe​(String className)
        Description copied from class: Scene
        Returns the RefType with the given className. Returns null if no type with the given name can be found.
        Overrides:
        getRefTypeUnsafe in class Scene
      • addRefType

        public void addRefType​(RefType type)
      • getSootClassUnsafe

        public SootClass getSootClassUnsafe​(String className)
        Description copied from class: Scene
        Returns the SootClass with the given className. If no class with the given name exists, null is returned unless phantom refs are allowed. In this case, a new phantom class is created. The difference with the getSootClass() version is that this version doesn't throw a RuntimeException if the requested class doesn't exist in the Scene. Instead it returns null.
        Overrides:
        getSootClassUnsafe in class Scene
        Parameters:
        className - The name of the class to get
        Returns:
        The class if it exists, otherwise null
      • getSootClassUnsafe

        public SootClass getSootClassUnsafe​(String className,
                                            com.google.common.base.Optional<String> moduleName)
      • getSootClass

        public SootClass getSootClass​(String className)
        Description copied from class: Scene
        Returns the SootClass with the given className.
        Overrides:
        getSootClass in class Scene
        Parameters:
        className - The name of the class to get; throws RuntimeException if this class does not exist.
      • getSootClass

        public SootClass getSootClass​(String className,
                                      com.google.common.base.Optional<String> moduleName)
      • loadBasicClasses

        public void loadBasicClasses()
        Description copied from class: Scene
        Load just the set of basic classes soot needs, ignoring those specified on the command-line. You don't need to use both this and Scene.loadNecessaryClasses(), though it will only waste time.
        Overrides:
        loadBasicClasses in class Scene
      • loadNecessaryClasses

        public void loadNecessaryClasses()
        Load the set of classes that soot needs, including those specified on the command-line. This is the standard way of initialising the list of classes soot should use.
        Overrides:
        loadNecessaryClasses in class Scene
      • prepareClasses

        protected void prepareClasses()
        Generate classes to process, adding or removing package marked by command line options.
        Overrides:
        prepareClasses in class Scene
      • forceResolve

        public SootClass forceResolve​(String className,
                                      int level)
        Description copied from class: Scene
        Forces Soot to resolve the class with the given name to the given level, even if resolving has actually already finished.
        Overrides:
        forceResolve in class Scene
      • forceResolve

        public SootClass forceResolve​(String className,
                                      int level,
                                      com.google.common.base.Optional<String> moduleName)
      • getOrAddRefType

        public RefType getOrAddRefType​(String className,
                                       com.google.common.base.Optional<String> moduleName)