Package soot
Class ModuleScene
- java.lang.Object
-
- soot.Scene
-
- soot.ModuleScene
-
public class ModuleScene extends Scene
Manages the SootClasses of the application being analyzed for Java 9 modules.- Author:
- Andreas Dann
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class soot.Scene
Scene.AndroidVersionInfo
-
-
Field Summary
-
Fields inherited from class soot.Scene
accessibilityOracle, activeCallGraph, activeFastHierarchy, activeHierarchy, activePointsToAnalysis, activeSideEffectAnalysis, allowsPhantomRefs, applicationClasses, basicclasses, classAddedListeners, classes, cscg, doneResolving, dynamicClasses, entryPoints, excludedPackages, incrementalBuild, libraryClasses, mainClass, phantomClasses, reachableMethods, reservedNames, sootClassPath, subSigNumberer, typeNumberer
-
-
Constructor Summary
Constructors Constructor Description ModuleScene(Singletons.Global g)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddClassSilent(SootClass c)Adds the given class to the Scene.voidaddRefType(RefType type)booleancontainsClass(String className)booleancontainsClass(String className, com.google.common.base.Optional<String> moduleName)booleancontainsType(String className)voidextendSootClassPath(String newPathElement)voidextendSootModulePath(String newPathElement)SootClassforceResolve(String className, int level)Forces Soot to resolve the class with the given name to the given level, even if resolving has actually already finished.SootClassforceResolve(String className, int level, com.google.common.base.Optional<String> moduleName)SootMethodgetMainMethod()RefTypegetObjectType()RefTypegetOrAddRefType(String className, com.google.common.base.Optional<String> moduleName)RefTypegetOrAddRefType(RefType tp)RefTypegetRefType(String className)Returns the RefType with the given className.RefTypegetRefType(String className, com.google.common.base.Optional<String> moduleName)Returns the RefType with the given className.RefTypegetRefTypeUnsafe(String className)Returns the RefType with the given className.RefTypegetRefTypeUnsafe(String className, com.google.common.base.Optional<String> moduleName)Returns the RefType with the given className.SootClassgetSootClass(String className)Returns the SootClass with the given className.SootClassgetSootClass(String className, com.google.common.base.Optional<String> moduleName)StringgetSootClassPath()SootClassgetSootClassUnsafe(String className)Returns the SootClass with the given className.SootClassgetSootClassUnsafe(String className, com.google.common.base.Optional<String> moduleName)StringgetSootModulePath()TypegetType(String arg, com.google.common.base.Optional<String> moduleName)Returns the RefType with the given class name or primitive type.voidloadBasicClasses()Load just the set of basic classes soot needs, ignoring those specified on the command-line.SootClassloadClass(String className, int desiredLevel)SootClassloadClass(String className, int desiredLevel, com.google.common.base.Optional<String> moduleName)SootClassloadClassAndSupport(String className)Loads the given class and all of the required support classes.SootClassloadClassAndSupport(String className, com.google.common.base.Optional<String> moduleName)voidloadDynamicClasses()voidloadNecessaryClasses()Load the set of classes that soot needs, including those specified on the command-line.SootClassmakeSootClass(String className)SootClassmakeSootClass(String name, String moduleName)protected voidprepareClasses()Generate classes to process, adding or removing package marked by command line options.voidsetMainClassFromOptions()voidsetSootClassPath(String p)voidsetSootModulePath(String p)SootClasstryLoadClass(String className, int desiredLevel, com.google.common.base.Optional<String> moduleName)Attempts to load the given class and all of the required support classes.static ModuleScenev()-
Methods inherited from class soot.Scene
addBasicClass, addBasicClass, addClass, addReflectionTraceClasses, allowsPhantomRefs, containsField, containsMethod, createLocalCreation, createLocalCreation, createLocalGenerator, defaultClassPath, defaultJavaClassPath, doneResolving, dynamicClasses, getActiveHierarchy, getAndroidAPIVersion, getAndroidJarPath, getAndroidSDKVersionInfo, getApplicationClasses, getBaseExceptionType, getBasicClasses, getCallGraph, getClasses, getClasses, getClientAccessibilityOracle, getContextSensitiveCallGraph, getDefaultThrowAnalysis, getEntryPoints, getFastHierarchy, getField, getLibraryClasses, getMainClass, getMethod, getOrAddRefType, getOrMakeFastHierarchy, getPhantomClasses, getPhantomRefs, getPkgList, getPointsToAnalysis, getReachableMethods, getReservedNames, getSideEffectAnalysis, getSootClassUnsafe, getState, getSubSigNumberer, getType, getTypeNumberer, getTypeUnsafe, getTypeUnsafe, grabField, grabMethod, hasActiveHierarchy, hasCallGraph, hasClientAccessibilityOracle, hasCustomEntryPoints, hasFastHierarchy, hasMainClass, hasPointsToAnalysis, hasReachableMethods, hasSideEffectAnalysis, incrementalBuildFinished, initiateIncrementalBuild, internalMakeCallGraph, isApk, isBasicClass, isExcluded, isExcluded, isIncluded, isIncluded, isIncrementalBuild, isJavaGEQ9, loadNecessaryClass, makeConstructorRef, makeFieldRef, makeMethodRef, makeMethodRef, makeMethodRef, makeSootClass, makeSootField, makeSootField, makeSootMethod, makeSootMethod, makeSootMethod, modifyHierarchy, quotedNameOf, registerSootClassAddedListener, releaseActiveHierarchy, releaseCallGraph, releaseClientAccessibilityOracle, releaseFastHierarchy, releasePointsToAnalysis, releaseReachableMethods, releaseSideEffectAnalysis, removeClass, reset, resetSootClassPathCache, setActiveHierarchy, setCallGraph, setClientAccessibilityOracle, setContextSensitiveCallGraph, setDefaultThrowAnalysis, setDoneResolving, setEntryPoints, setFastHierarchy, setMainClass, setPhantomRefs, setPkgList, setPointsToAnalysis, setReachableMethods, setResolving, setSideEffectAnalysis, signatureToClass, signatureToSubsignature, tryLoadClass, unescapeName, unregisterSootClassAddedListener
-
-
-
-
Constructor Detail
-
ModuleScene
public ModuleScene(Singletons.Global g)
-
-
Method Detail
-
v
public static ModuleScene v()
-
getMainMethod
public SootMethod getMainMethod()
- Overrides:
getMainMethodin classScene
-
extendSootClassPath
public void extendSootClassPath(String newPathElement)
- Overrides:
extendSootClassPathin classScene
-
extendSootModulePath
public void extendSootModulePath(String newPathElement)
-
getSootClassPath
public String getSootClassPath()
- Overrides:
getSootClassPathin classScene
-
setSootClassPath
public void setSootClassPath(String p)
- Overrides:
setSootClassPathin classScene
-
getSootModulePath
public String getSootModulePath()
-
setSootModulePath
public void setSootModulePath(String p)
-
addClassSilent
protected void addClassSilent(SootClass c)
Description copied from class:SceneAdds 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:
addClassSilentin classScene- Parameters:
c- The class to add
-
containsClass
public boolean containsClass(String className)
- Overrides:
containsClassin classScene
-
containsClass
public boolean containsClass(String className, com.google.common.base.Optional<String> moduleName)
-
containsType
public boolean containsType(String className)
- Overrides:
containsTypein classScene
-
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:
loadClassAndSupportin classScene
-
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)
-
getType
public Type getType(String arg, com.google.common.base.Optional<String> moduleName)
Returns the RefType with the given class name or primitive type.- Throws:
RuntimeException- if the Type for this name cannot be found. UsegetRefTypeUnsafe(String, Optional)to check if type is an registered RefType.
-
getRefType
public RefType getRefType(String className, com.google.common.base.Optional<String> moduleName)
Returns the RefType with the given className.- Throws:
IllegalStateException- if the RefType for this class cannot be found. UsecontainsType(String)to check if type is registered
-
getRefType
public RefType getRefType(String className)
Description copied from class:SceneReturns the RefType with the given className.- Overrides:
getRefTypein classScene
-
getObjectType
public RefType getObjectType()
Description copied from class:Scene- Overrides:
getObjectTypein classScene
-
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:SceneReturns the RefType with the given className. Returns null if no type with the given name can be found.- Overrides:
getRefTypeUnsafein classScene
-
addRefType
public void addRefType(RefType type)
-
getSootClassUnsafe
public SootClass getSootClassUnsafe(String className)
Description copied from class:SceneReturns 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:
getSootClassUnsafein classScene- 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:SceneReturns the SootClass with the given className.- Overrides:
getSootClassin classScene- 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:SceneLoad just the set of basic classes soot needs, ignoring those specified on the command-line. You don't need to use both this andScene.loadNecessaryClasses(), though it will only waste time.- Overrides:
loadBasicClassesin classScene
-
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:
loadNecessaryClassesin classScene
-
loadDynamicClasses
public void loadDynamicClasses()
- Overrides:
loadDynamicClassesin classScene
-
prepareClasses
protected void prepareClasses()
Generate classes to process, adding or removing package marked by command line options.- Overrides:
prepareClassesin classScene
-
setMainClassFromOptions
public void setMainClassFromOptions()
- Overrides:
setMainClassFromOptionsin classScene
-
forceResolve
public SootClass forceResolve(String className, int level)
Description copied from class:SceneForces Soot to resolve the class with the given name to the given level, even if resolving has actually already finished.- Overrides:
forceResolvein classScene
-
forceResolve
public SootClass forceResolve(String className, int level, com.google.common.base.Optional<String> moduleName)
-
makeSootClass
public SootClass makeSootClass(String className)
- Overrides:
makeSootClassin classScene
-
-