Package com.ibm.wala.classLoader
Interface IClassLoader
-
- All Known Implementing Classes:
BypassSyntheticClassLoader,CAstAbstractLoader,CAstAbstractModuleLoader,ClassLoaderImpl,WDexClassLoaderImpl
public interface IClassLoaderBase class for an object that represents a single Java classloader for analysis purposes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SSAInstructionFactorygetInstructionFactory()LanguagegetLanguage()AtomgetName()intgetNumberOfClasses()intgetNumberOfMethods()IClassLoadergetParent()ClassLoaderReferencegetReference()Return the ClassLoaderReference for this class loader.ReadergetSource(IClass klass)ReadergetSource(IMethod method, int offset)StringgetSourceFileName(IClass klass)StringgetSourceFileName(IMethod method, int offset)voidinit(List<Module> modules)Initialize internal data structures.Iterator<IClass>iterateAllClasses()IClasslookupClass(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 set
-
-
-
Method Detail
-
lookupClass
IClass lookupClass(TypeName className)
Find and return the IClass defined by this class loader that corresponds to the given class name.- 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.
-
getReference
ClassLoaderReference getReference()
Return the ClassLoaderReference for this class loader.- Returns:
- ClassLoaderReference
-
iterateAllClasses
Iterator<IClass> iterateAllClasses()
- Returns:
- an Iterator of all classes loaded by this loader
-
getNumberOfClasses
int getNumberOfClasses()
- Returns:
- the number of classes in scope to be loaded by this loader
-
getName
Atom getName()
- Returns:
- the unique name that identifies this class loader.
-
getLanguage
Language getLanguage()
- Returns:
- the unique name that identifies the programming language from which this class loader loads code.
-
getInstructionFactory
SSAInstructionFactory getInstructionFactory()
-
getNumberOfMethods
int getNumberOfMethods()
-
getSourceFileName
String getSourceFileName(IMethod method, int offset)
- 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
Reader getSource(IMethod method, int offset)
- 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
String getSourceFileName(IClass klass) throws NoSuchElementException
- Parameters:
klass- the class for which information is desired.- Returns:
- name of source file corresponding to the class, or null if not available
- Throws:
NoSuchElementException- if this class was generated from more than one source file The assumption that a class is generated from a single source file is java specific, and will change in the future. In place of this API, use the version that takes a method and an offset, since that is now the granularity at which source file information will be recorded. SJF .. we should think about this deprecation. postponing deprecation for now.
-
getSource
Reader getSource(IClass klass) throws NoSuchElementException
- Returns:
- input stream representing the source file for a class, or null if not available
- Throws:
NoSuchElementException- if this class was generated from more than one source file The assumption that a class is generated from a single source file is java specific, and will change in the future. In place of this API, use the version that takes a method and an offset, since that is now the granularity at which source file information will be recorded. SJF .. we should think about this deprecation. postponing deprecation for now.
-
getParent
IClassLoader getParent()
- Returns:
- the parent IClassLoader, if any, or null
-
init
void init(List<Module> modules) throws IOException
Initialize internal data structures.- Throws:
IOExceptionIllegalArgumentException- if modules is null
-
removeAll
void removeAll(Collection<IClass> toRemove)
blow away references to any classes in the set- Parameters:
toRemove- Collection
-
-