Package com.ibm.wala.cast.loader
Class CAstAbstractLoader
- java.lang.Object
-
- com.ibm.wala.cast.loader.CAstAbstractLoader
-
- All Implemented Interfaces:
IClassLoader
- Direct Known Subclasses:
CAstAbstractModuleLoader
public abstract class CAstAbstractLoader extends Object implements IClassLoader
basic abstract class loader implementation
-
-
Field Summary
Fields Modifier and Type Field Description protected IClassHierarchy
cha
protected IClassLoader
parent
protected Map<TypeName,IClass>
types
types loaded by this
-
Constructor Summary
Constructors Constructor Description CAstAbstractLoader(IClassHierarchy cha)
CAstAbstractLoader(IClassHierarchy cha, IClassLoader parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessage(ModuleEntry module, Warning message)
void
addMessage(ModuleEntry module, Set<Warning> message)
void
clearMessages()
Set<Warning>
getMessages(ModuleEntry m)
Iterator<ModuleEntry>
getModulesWithParseErrors()
Iterator<ModuleEntry>
getModulesWithWarnings()
Atom
getName()
int
getNumberOfClasses()
int
getNumberOfMethods()
IClassLoader
getParent()
Reader
getSource(IClass klass)
Reader
getSource(IMethod method, int bcOffset)
String
getSourceFileName(IClass klass)
String
getSourceFileName(IMethod method, int bcOffset)
Iterator<IClass>
iterateAllClasses()
IClass
lookupClass(TypeName className)
Find and return the IClass defined by this class loader that corresponds to the given class name.IClass
lookupClass(String className, IClassHierarchy cha)
void
removeAll(Collection<IClass> toRemove)
blow away references to any classes in the set-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.wala.classLoader.IClassLoader
getInstructionFactory, getLanguage, getReference, init
-
-
-
-
Field Detail
-
cha
protected final IClassHierarchy cha
-
parent
protected final IClassLoader parent
-
-
Constructor Detail
-
CAstAbstractLoader
public CAstAbstractLoader(IClassHierarchy cha, IClassLoader parent)
-
CAstAbstractLoader
public CAstAbstractLoader(IClassHierarchy cha)
-
-
Method Detail
-
addMessage
public void addMessage(ModuleEntry module, Set<Warning> message)
-
addMessage
public void addMessage(ModuleEntry module, Warning message)
-
getModulesWithParseErrors
public Iterator<ModuleEntry> getModulesWithParseErrors()
-
getModulesWithWarnings
public Iterator<ModuleEntry> getModulesWithWarnings()
-
getMessages
public Set<Warning> getMessages(ModuleEntry m)
-
clearMessages
public void clearMessages()
-
lookupClass
public IClass lookupClass(String className, IClassHierarchy cha)
-
lookupClass
public IClass lookupClass(TypeName className)
Description copied from interface:IClassLoader
Find and return the IClass defined by this class loader that corresponds to the given class name.- Specified by:
lookupClass
in 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.
-
iterateAllClasses
public Iterator<IClass> iterateAllClasses()
- Specified by:
iterateAllClasses
in interfaceIClassLoader
- Returns:
- an Iterator of all classes loaded by this loader
-
getNumberOfClasses
public int getNumberOfClasses()
- Specified by:
getNumberOfClasses
in interfaceIClassLoader
- Returns:
- the number of classes in scope to be loaded by this loader
-
getName
public Atom getName()
- Specified by:
getName
in interfaceIClassLoader
- Returns:
- the unique name that identifies this class loader.
-
getNumberOfMethods
public int getNumberOfMethods()
- Specified by:
getNumberOfMethods
in interfaceIClassLoader
-
getSourceFileName
public String getSourceFileName(IMethod method, int bcOffset)
- Specified by:
getSourceFileName
in interfaceIClassLoader
- Parameters:
method
- The method for which information is desiredbcOffset
- 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.
-
getSourceFileName
public String getSourceFileName(IClass klass)
- Specified by:
getSourceFileName
in 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
public Reader getSource(IClass klass)
- Specified by:
getSource
in interfaceIClassLoader
- Returns:
- input stream representing the source file for a class, or null if not available
-
getSource
public Reader getSource(IMethod method, int bcOffset)
- Specified by:
getSource
in interfaceIClassLoader
- Parameters:
method
- The method for which information is desiredbcOffset
- 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
-
getParent
public IClassLoader getParent()
- Specified by:
getParent
in interfaceIClassLoader
- Returns:
- the parent IClassLoader, if any, or null
-
removeAll
public void removeAll(Collection<IClass> toRemove)
Description copied from interface:IClassLoader
blow away references to any classes in the set- Specified by:
removeAll
in interfaceIClassLoader
- Parameters:
toRemove
- Collection
-
-