public class SourceLocator extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SourceLocator.ClassSourceType |
| Modifier and Type | Field and Description |
|---|---|
protected Set<ClassLoader> |
additionalClassLoaders |
protected com.google.common.cache.LoadingCache<String,Set<String>> |
archivePathToEntriesCache |
protected List<String> |
classPath |
protected List<ClassProvider> |
classProviders |
protected boolean |
java9Mode |
protected com.google.common.cache.LoadingCache<String,SourceLocator.ClassSourceType> |
pathToSourceType |
protected List<String> |
sourcePath |
| Constructor and Description |
|---|
SourceLocator(Singletons.Global g) |
| Modifier and Type | Method and Description |
|---|---|
void |
additionalClassLoader(ClassLoader c) |
Set<String> |
classesInDynamicPackage(String str) |
List<String> |
classPath() |
void |
clearDexClassPathExtensions()
Clears the set of dex or apk or assembly files that still need to be indexed
|
Map<String,File> |
dexClassIndex()
Return the class index that maps class names to dex/assembly(exe/dll) files.
|
static void |
ensureDirectoryExists(File dir)
Create the given directory and all parent directories if
dir is non-null. |
static List<String> |
explodeClassPath(String classPath)
Explodes a class path into a list of individual class path entries.
|
void |
extendClassPath(String newPathElement) |
List<String> |
getClassesUnder(String aPath) |
List<String> |
getClassesUnder(String aPath,
String prefix) |
ClassSource |
getClassSource(String className)
Given a class name, uses the soot-class-path to return a ClassSource for the given class.
|
protected SourceLocator.ClassSourceType |
getClassSourceType(String path) |
Set<String> |
getDexClassPathExtensions()
Gets all files that were added to the classpath later on and that have not yet been processed for the dexClassIndex
mapping
|
String |
getExtensionFor(int rep) |
String |
getFileNameFor(SootClass c,
int rep) |
String |
getOutputDir()
Returns the output directory given by
Options or a default if not set. |
String |
getOutputJarName()
If
Options#v()#output_jar() is set, returns the name of the jar file to which the output will be written. |
String |
getSourceForClass(String className)
Returns the name of the class in which the (possibly inner) class className appears.
|
void |
invalidateCaches() |
void |
invalidateClassPath() |
protected IFoundFile |
lookupInArchive(String archivePath,
String fileName) |
IFoundFile |
lookupInClassPath(String fileName)
Searches for a file with the given name in the exploded classPath.
|
protected IFoundFile |
lookupInDir(String dir,
String fileName) |
void |
resetCaches()
Resets the cached class path, class providers, and source path to null.
|
void |
setClassProviders(List<ClassProvider> classProviders) |
void |
setDexClassIndex(Map<String,File> index)
Set the class_container (dex, assembly) class index
|
protected void |
setupClassProviders() |
List<String> |
sourcePath() |
static SourceLocator |
v() |
protected final Set<ClassLoader> additionalClassLoaders
protected List<ClassProvider> classProviders
protected boolean java9Mode
protected final com.google.common.cache.LoadingCache<String,SourceLocator.ClassSourceType> pathToSourceType
public SourceLocator(Singletons.Global g)
public void invalidateCaches()
public static SourceLocator v()
public static void ensureDirectoryExists(File dir)
dir is non-null.dir - public static List<String> explodeClassPath(String classPath)
public ClassSource getClassSource(String className)
public void additionalClassLoader(ClassLoader c)
protected void setupClassProviders()
public void setClassProviders(List<ClassProvider> classProviders)
public void invalidateClassPath()
protected SourceLocator.ClassSourceType getClassSourceType(String path)
public String getExtensionFor(int rep)
public String getOutputDir()
Options or a default if not set. Also ensures that all directories in the
path exist.Options or a default if not setpublic String getOutputJarName()
Options#v()#output_jar() is set, returns the name of the jar file to which the output will be written. The
name of the jar file can be given with the -output-dir option or a default will be used. Also ensures that all
directories in the path exist.public IFoundFile lookupInClassPath(String fileName)
protected IFoundFile lookupInDir(String dir, String fileName)
protected IFoundFile lookupInArchive(String archivePath, String fileName)
public String getSourceForClass(String className)
public Map<String,File> dexClassIndex()
public void setDexClassIndex(Map<String,File> index)
index - the indexpublic void extendClassPath(String newPathElement)
public Set<String> getDexClassPathExtensions()
public void clearDexClassPathExtensions()
public void resetCaches()
Scene.loadNecessaryClasses()
to recompute and load the classes using updated configurations if provided.Copyright © 2024 Soot OSS. All rights reserved.