public class BypassSyntheticClassLoader extends java.lang.Object implements IClassLoader
The intention is that there be (at most) one such classloader in a given class hierarchy, and that it be referenced using the "Synthetic" classloader reference. Furthermore, it is required that this synthetic loader be a child loader of the Primordial, Extension and Application loaders.
This special classloader has some interactions with the hierarchy for, while the classes it loads are normal-seeming IClass objects, unlike the other loaders, its set of classes is not fixed, causing special cases in code that caches hierarchy data. Also note that this causes the getNumberfClasses and iterateAllClasses methods to behave differently for those of other classloaders.
Code that wants to introduce synthetic classes uses the registerClass method, giving it an Atom which is the class name, and an IClass which is the class to load. Since the synthetic loader must be a child of the others, it would be very bad to use an existing name for a new synthetic class.
Class lookup works just as for any other classloader.
| Constructor and Description |
|---|
BypassSyntheticClassLoader(ClassLoaderReference me,
IClassLoader parent,
com.ibm.wala.util.config.SetOfClasses exclusions,
IClassHierarchy cha)
Don't change my signature! ClassLoaderFactoryImpl calls me by reflection! yuck.
|
| Modifier and Type | Method and Description |
|---|---|
SSAInstructionFactory |
getInstructionFactory() |
Language |
getLanguage() |
Atom |
getName() |
int |
getNumberOfClasses() |
int |
getNumberOfMethods() |
IClassLoader |
getParent() |
ClassLoaderReference |
getReference()
Return the ClassLoaderReference for this class loader.
|
java.io.Reader |
getSource(IClass klass) |
java.io.Reader |
getSource(IMethod method,
int offset) |
java.lang.String |
getSourceFileName(IClass klass) |
java.lang.String |
getSourceFileName(IMethod method,
int offset) |
void |
init(java.util.List<Module> modules)
Initialize internal data structures.
|
java.util.Iterator<IClass> |
iterateAllClasses() |
IClass |
lookupClass(TypeName className)
Find and return the IClass defined by this class loader that corresponds to the given class
name.
|
void |
registerClass(TypeName className,
IClass theClass)
Register the existence of a new synthetic class
|
void |
removeAll(java.util.Collection<IClass> toRemove)
blow away references to any classes in the set
|
java.lang.String |
toString() |
public BypassSyntheticClassLoader(ClassLoaderReference me, IClassLoader parent, com.ibm.wala.util.config.SetOfClasses exclusions, IClassHierarchy cha)
me - the name of this class loaderparent - its parentexclusions - classes to ignorecha - governing class hierarchypublic java.lang.String toString()
toString in class java.lang.Objectpublic IClass lookupClass(TypeName className)
IClassLoaderlookupClass in interface IClassLoaderclassName - name of the classpublic void registerClass(TypeName className, IClass theClass)
public ClassLoaderReference getReference()
getReference in interface IClassLoaderpublic java.util.Iterator<IClass> iterateAllClasses()
iterateAllClasses in interface IClassLoaderpublic int getNumberOfClasses()
getNumberOfClasses in interface IClassLoaderpublic Atom getName()
getName in interface IClassLoaderpublic Language getLanguage()
getLanguage in interface IClassLoaderpublic int getNumberOfMethods()
getNumberOfMethods in interface IClassLoaderpublic java.lang.String getSourceFileName(IClass klass)
getSourceFileName in interface IClassLoaderklass - the class for which information is desired.public IClassLoader getParent()
getParent in interface IClassLoaderpublic void init(java.util.List<Module> modules) throws java.io.IOException
IClassLoaderinit in interface IClassLoaderjava.io.IOExceptionpublic void removeAll(java.util.Collection<IClass> toRemove)
IClassLoaderremoveAll in interface IClassLoadertoRemove - Collection<IClass>public java.io.Reader getSource(IClass klass)
getSource in interface IClassLoaderpublic SSAInstructionFactory getInstructionFactory()
getInstructionFactory in interface IClassLoaderpublic java.io.Reader getSource(IMethod method, int offset)
getSource in interface IClassLoadermethod - The method for which information is desiredoffset - an offset into the bytecode of the given method.public java.lang.String getSourceFileName(IMethod method, int offset)
getSourceFileName in interface IClassLoadermethod - The method for which information is desiredoffset - an offset into the bytecode of the given method.