Class ClassLoaderImpl
java.lang.Object
com.ibm.wala.classLoader.ClassLoaderImpl
- All Implemented Interfaces:
IClassLoader
- Direct Known Subclasses:
JavaSourceLoaderImpl, WDexClassLoaderImpl
A class loader that reads class definitions from a set of Modules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IClassHierarchyGoverning class hierarchystatic final intA mapping from class name (TypeName) to IClass -
Constructor Summary
ConstructorsConstructorDescriptionClassLoaderImpl(ClassLoaderReference loader, ArrayClassLoader arrayClassLoader, IClassLoader parent, StringFilter exclusions, IClassHierarchy cha) -
Method Summary
Modifier and TypeMethodDescriptiongetName()intintMethod getParent.Return the ClassLoaderReference for this class loader.getSourceFileName(IClass klass) getSourceFileName(IMethod method, int offset) voidInitialize internal data structuresprotected voidloadAllSources(Set<ModuleEntry> sourceModules) Set up mapping from type name to Module EntrylookupClass(TypeName className) Find and return the IClass defined by this class loader that corresponds to the given class name.voidremoveAll(Collection<IClass> toRemove) blow away references to any classes in the settoString()
-
Field Details
-
DEBUG_LEVEL
public static final int DEBUG_LEVEL- See Also:
-
loadedClasses
-
cha
Governing class hierarchy
-
-
Constructor Details
-
ClassLoaderImpl
public ClassLoaderImpl(ClassLoaderReference loader, ArrayClassLoader arrayClassLoader, IClassLoader parent, StringFilter exclusions, IClassHierarchy cha) - Parameters:
loader- class loader reference identifying this loaderparent- parent loader for delegationexclusions- set of classes to exclude from loading
-
-
Method Details
-
loadAllSources
Set up mapping from type name to Module Entry -
init
Initialize internal data structures- Specified by:
initin interfaceIClassLoader- Throws:
IllegalArgumentException- if modules is nullIOException
-
getReference
Description copied from interface:IClassLoaderReturn the ClassLoaderReference for this class loader.- Specified by:
getReferencein interfaceIClassLoader- Returns:
- ClassLoaderReference
-
iterateAllClasses
- Specified by:
iterateAllClassesin interfaceIClassLoader- Returns:
- an Iterator of all classes loaded by this loader
-
lookupClass
Description copied from interface:IClassLoaderFind and return the IClass defined by this class loader that corresponds to the given class name.- Specified by:
lookupClassin interfaceIClassLoader- Parameters:
className- name of the class- Returns:
- the IClass defined by this class loader that corresponds to the given class name, or null if not found.
-
getParent
Method getParent.- Specified by:
getParentin interfaceIClassLoader- Returns:
- the parent IClassLoader, if any, or null
-
getName
- Specified by:
getNamein interfaceIClassLoader- Returns:
- the unique name that identifies this class loader.
-
getLanguage
- Specified by:
getLanguagein interfaceIClassLoader- Returns:
- the unique name that identifies the programming language from which this class loader loads code.
-
toString
-
getNumberOfClasses
public int getNumberOfClasses()- Specified by:
getNumberOfClassesin interfaceIClassLoader- Returns:
- the number of classes in scope to be loaded by this loader
-
getNumberOfMethods
public int getNumberOfMethods()- Specified by:
getNumberOfMethodsin interfaceIClassLoader
-
getSourceFileName
- Specified by:
getSourceFileNamein interfaceIClassLoader- Parameters:
klass- the class for which information is desired.- Returns:
- name of source file corresponding to the class, or null if not available
-
getSource
- Specified by:
getSourcein interfaceIClassLoader- Parameters:
method- The method for which information is desiredoffset- an offset into the bytecode of the given method.- Returns:
- input stream representing the source file for a given bytecode index of a given method, or null if not available
-
getSourceFileName
- Specified by:
getSourceFileNamein interfaceIClassLoader- Parameters:
method- The method for which information is desiredoffset- an offset into the bytecode of the given method.- Returns:
- name of the source file corresponding to the given offset in the given method. Note that this api allows a single method to arise from multiple source files, which is deliberate as it can happen in some languages.
-
getSource
- Specified by:
getSourcein interfaceIClassLoader- Returns:
- input stream representing the source file for a class, or null if not available
-
removeAll
Description copied from interface:IClassLoaderblow away references to any classes in the set- Specified by:
removeAllin interfaceIClassLoader- Parameters:
toRemove- Collection<IClass>
-
getInstructionFactory
- Specified by:
getInstructionFactoryin interfaceIClassLoader
-